Skip to content

Commit

Permalink
Handle JWT generation properly
Browse files Browse the repository at this point in the history
Would be nice to make the apiRoute thing properly typed so CI would catch this error, but I think that's a challenge for another day.
  • Loading branch information
domdomegg committed Sep 26, 2024
1 parent 0a8dbfd commit ec449dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions apps/meet/src/lib/api/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const cohortTable: Table<Cohort> = {
};

export interface CohortClass extends Item {
'Facilitator': string[],
'Facilitators': string[],
'Participants (Expected)': string[],
'Attendees': string[],
'Start date/time': number | null,
Expand All @@ -40,15 +40,15 @@ export const cohortClassTable: Table<CohortClass> = {
baseId: airtableBaseId,
tableId: 'tblDNME0bA9OoApTk',
schema: {
Facilitator: 'string[]',
Facilitators: 'string[]',
'Participants (Expected)': 'string[]',
Attendees: 'string[]',
'Start date/time': 'number | null',
Cohort: 'string',
'Zoom account': 'string | null',
},
mappings: {
Facilitator: 'fldP5BqdFfcn8enfc',
Facilitators: 'fldP5BqdFfcn8enfc',
'Participants (Expected)': 'fldEKYwcacAa6nBEE',
Attendees: 'fldo0xEi6vJKSJlFN',
'Start date/time': 'flduTqIxS6OEHNr4H',
Expand Down
2 changes: 1 addition & 1 deletion apps/meet/src/pages/api/public/meeting-jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default apiRoute(async (
const oPayload = {
sdkKey: env.NEXT_PUBLIC_ZOOM_CLIENT_ID,
mn: meetingNumber,
role: cohortClass.Facilitator === req.body.participantId ? ZOOM_ROLE.HOST : ZOOM_ROLE.PARTICIPANT,
role: cohortClass.Facilitators.includes(req.body.participantId) ? ZOOM_ROLE.HOST : ZOOM_ROLE.PARTICIPANT,
iat: issuedAt,
exp: expiresAt,
tokenExp: expiresAt,
Expand Down
2 changes: 1 addition & 1 deletion apps/meet/src/pages/api/public/meeting-participants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default apiRoute(async (
throw new createHttpError.InternalServerError(`Cohort class ${cohortClass.id} missing Zoom account`);
}
const zoomAccount = await db.get(zoomAccountTable, cohortClass['Zoom account']);
const facilitators = await Promise.all(cohortClass.Facilitator.map((facilitatorId) => db.get(personTable, facilitatorId)));
const facilitators = await Promise.all(cohortClass.Facilitators.map((facilitatorId) => db.get(personTable, facilitatorId)));
const participants = await Promise.all(
cohortClass['Participants (Expected)']
.map((participantId) => db.get(personTable, participantId)),
Expand Down

0 comments on commit ec449dd

Please sign in to comment.