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

Set Up Coffee Chat API #635

Merged
merged 15 commits into from
Sep 22, 2024
Merged

Set Up Coffee Chat API #635

merged 15 commits into from
Sep 22, 2024

Conversation

patriciaahuang
Copy link
Contributor

@patriciaahuang patriciaahuang commented Sep 22, 2024

Summary

This PR sets up the Coffee Chat API (and DAO). Members are not allowed to submit a coffee chat with themselves, or with someone they have coffee chatted in a previous semester.

Notion/Figma Link

Coffee Chat DAO Design Doc
Coffee Chat API Design Doc

Test Plan

The endpoints were tested using Jest (PR #363).

@patriciaahuang patriciaahuang requested a review from a team as a code owner September 22, 2024 18:54
@dti-github-bot
Copy link
Member

dti-github-bot commented Sep 22, 2024

[diff-counting] Significant lines: 243.

/**
* Deletes all coffee chats for all users
*/
static async clearAllCoffeeChats(): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should be able to use deleteCollection here.

export async function deleteCollection(
db: FirebaseFirestore.Firestore,
collectionPath: string,
batchSize: number
): Promise<void> {
const collectionRef = db.collection(collectionPath);
const query = collectionRef.orderBy('__name__').limit(batchSize);
return new Promise((resolve, reject) => {
deleteQueryBatch(db, query, resolve).catch(reject);
});
}


if (
!isLeadOrAdmin &&
(coffeeChat.members[0].email !== user.email || coffeeChat.members[1].email !== user.email)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, I'm thinking about this more and I think it probably only makes sense for a lead to delete a coffee chat for now. i.e. say that a person submits a coffee chat and it gets approved for both members. And then one member for some reason deletes the coffee chat, since we don't have two "copies" of it, the other members gets affected too.

Right now since we just use the google form and the lead already has control over the coffee chat, I think it makes sense to make this not allowed for any non-lead. Seems much easier to manage permissions-wise this way, since coffee chats concern two people.

@patriciaahuang patriciaahuang merged commit 22d340d into main Sep 22, 2024
17 checks passed
@patriciaahuang patriciaahuang deleted the set-up-coffee-chat-api branch September 22, 2024 21:17
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.

4 participants