-
Notifications
You must be signed in to change notification settings - Fork 0
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
deleted seniors, request, and chapter #173
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes are functionally correct! Echoing @sburchfield33 feedback, I think we can condensed the code a bit further. As mentioned, we want to reduce the number of API calls. This is important for a couple of reasons:
- Less network traffic is usually better
- Prisma handles transaction for us within 1 API call
In summary,
- We can use
onDelete: Cascade
forUserRequest
- Unset relationship on user side when a chapter is deleted. You may find this doc helpful.
013a0d6
to
afebb72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good maybe look at my comments. I am a little confused about the ChapterRequest onDelete but otherwise looks good
@@ -131,6 +131,8 @@ model ChapterRequest { | |||
motivation String | |||
availabilities String | |||
questions String | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a chapterid field not necessary here?
@@ -144,6 +146,11 @@ model Chapter { | |||
// Google Drive API related fields | |||
chapterFolder String @default("") | |||
permissions String[] | |||
|
|||
chapterRequestId String @db.ObjectId @unique | |||
chapterRequest ChapterRequest @relation(fields: [chapterRequestId], references: [id], onDelete: Cascade) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the onDelete cascade be on the ChapterRequest field here? Wouldn't the onDelete here just delete the chapter if the chapterrequest is deleted?
I assume what you are trying to do here is delete the ChapterRequest if the chapter is deleted so I believe the onDelete should be on the chapterrequest side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with @sburchfield33! We're good to go.
Description
Issues
#155
Screenshots
No user interface changes
Test
Submit new chapter request and accept. Add members, seniors, and files. Delete chapter and check database.