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

Tyler/caleb/drive #136

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Tyler/caleb/drive #136

merged 4 commits into from
Apr 4, 2024

Conversation

tylerrlin
Copy link
Collaborator

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

@@ -67,6 +70,52 @@ export const POST = async (request: NextRequest) => {
approved: "APPROVED",
},
});

const baseFolder = process.env.GOOGLE_BASEFOLDER; // TODO: make env variable
Copy link
Collaborator

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(
Copy link
Collaborator

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({
Copy link
Collaborator

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],
};
Copy link
Collaborator

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!

Copy link
Collaborator

@nickbar01234 nickbar01234 left a 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.

@tylerrlin tylerrlin merged commit 28c3863 into main Apr 4, 2024
4 checks passed
@tylerrlin tylerrlin deleted the tyler/caleb/drive branch April 4, 2024 00:52
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.

[RFC] Google Drive Structure
2 participants