Skip to content

Commit

Permalink
meet: Handle 0 or >1 facilitators
Browse files Browse the repository at this point in the history
  • Loading branch information
domdomegg committed Sep 26, 2024
1 parent 43bbfb1 commit 0a8dbfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 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,
'Facilitator': string[],
'Participants (Expected)': string[],
'Attendees': string[],
'Start date/time': number | null,
Expand All @@ -40,7 +40,7 @@ export const cohortClassTable: Table<CohortClass> = {
baseId: airtableBaseId,
tableId: 'tblDNME0bA9OoApTk',
schema: {
Facilitator: 'string',
Facilitator: 'string[]',
'Participants (Expected)': 'string[]',
Attendees: 'string[]',
'Start date/time': 'number | null',
Expand Down
4 changes: 2 additions & 2 deletions 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 facilitator = await db.get(personTable, cohortClass.Facilitator);
const facilitators = await Promise.all(cohortClass.Facilitator.map((facilitatorId) => db.get(personTable, facilitatorId)));
const participants = await Promise.all(
cohortClass['Participants (Expected)']
.map((participantId) => db.get(personTable, participantId)),
Expand All @@ -85,7 +85,7 @@ export default apiRoute(async (
type: 'success',
cohortClassId: cohortClass.id,
participants: [
{ id: facilitator.id, name: facilitator.name, role: 'host' as const },
...facilitators.map((facilitator) => ({ id: facilitator.id, name: facilitator.name, role: 'host' as const })),
...participants.map((participant) => ({ id: participant.id, name: participant.name, role: 'participant' as const })),
// eslint-disable-next-line no-nested-ternary
].sort((a, b) => ((a.name < b.name) ? -1 : (a.name > b.name) ? 1 : 0)),
Expand Down

0 comments on commit 0a8dbfd

Please sign in to comment.