-
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
Tyler/caleb/drive #136
Tyler/caleb/drive #136
Conversation
…ew senior folder in correct chapter, and update share permissions on new member.
@@ -67,6 +70,52 @@ export const POST = async (request: NextRequest) => { | |||
approved: "APPROVED", | |||
}, | |||
}); | |||
|
|||
const baseFolder = process.env.GOOGLE_BASEFOLDER; // TODO: make env variable |
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.
We can add GOOGLE_BASEFOLDER
to src/env/schema.mjs
to quickly detect missing variables. You can use the environment variables by importing from src/env/server.mjs
(see next.config.mjs
for examples)
fields: "id", | ||
}; | ||
|
||
const { access_token, refresh_token } = (await prisma.account.findFirst( |
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.
nit: Use createDriveService
from server/service
).files.create(fileCreateData); | ||
const googleFolderId = (file as any).data.id; | ||
|
||
await prisma.chapter.update({ |
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.
I wonder if it's necessary to include the new chapter ID as part of the folder name. We currently don't have any constraints that uni name is unique. What do you guys think?
name: [ | ||
`${seniorBody.firstname}_${seniorBody.lastname}-${randomUUID()}`, | ||
], | ||
name: [`${seniorBody.firstname}_${seniorBody.lastname}_${senior.id}`], | ||
mimeType: "application/vnd.google-apps.folder", | ||
parents: [baseFolder], | ||
}; |
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.
If we're changing the other route to use createDriveService
, we should also make the changes here!
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.
Changes are great! The only changes are reusingcreateDriveService
to initialize Google API.
Description
Created new base folder, created folders for each chapter after new chapter created, create new folder in correct chapter for new senior, and updated folder sharing when new member added to chapter.
TODO: new file sharing
Issues
Resolve #58
Screenshots
Test
Create new chapters, seniors, and add members to chapters.
Possible Downsides
Additional Documentations