Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat user backup #64

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Conversation

dubisdev
Copy link
Contributor

@dubisdev dubisdev commented Dec 5, 2021

Contributing Guidelines pull request Making a pull request

Guidelines

This pull request regarding on

  • developed new feature

Briefly describe what you did

Created a form for getting a backup and restore from files.
image

image

If the file is not a valid backup, returns error and no data is lost.
image

I also included the linkin version in the backup for future compatibility checks (if breaking changes are included).

Appreciate your contribution to making Linkin better 🚀.

@vercel
Copy link

vercel bot commented Dec 5, 2021

Someone is attempting to deploy a commit to a Personal Account owned by @RizkyRajitha on Vercel.

@RizkyRajitha first needs to authorize it.

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2021

Codecov Report

Merging #64 (52e36cb) into dev (ca6190d) will decrease coverage by 2.01%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #64      +/-   ##
==========================================
- Coverage   76.71%   74.69%   -2.02%     
==========================================
  Files           3        3              
  Lines         146      166      +20     
  Branches       29       30       +1     
==========================================
+ Hits          112      124      +12     
- Misses         27       35       +8     
  Partials        7        7              
Impacted Files Coverage Δ
lib/dbfuncprisma.js 74.34% <60.00%> (-2.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca6190d...52e36cb. Read the comment docs.

@dubisdev dubisdev marked this pull request as ready for review December 5, 2021 15:23

// delete old data
await Promise.all([
Prisma.linkdata.deleteMany(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 await Prisma.$executeRaw("ALTER SEQUENCE linkdata_id_seq RESTART WITH 1;");

i thinks it's better to reset the id sequence also because we are backing up with id
better to do this with social icons also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!, I had not taken it into account
fixed in 52e36cb

Copy link
Owner

@RizkyRajitha RizkyRajitha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work @dubisdev ,
lets keep this as a draft until we test it enough and then release with next version
thanks.

} from "../../../lib/dbfuncprisma";

// endoint for download and restore backups
async function handler(req, res) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 await use(req, res, jwtAuth);

use middleware here to avoid duplicates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 7586d13

@dubisdev dubisdev requested a review from RizkyRajitha December 8, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants