Skip to content

Commit

Permalink
fix: πŸ› unasync map func
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed May 7, 2024
1 parent cb4a6de commit bc77537
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/routes/availability/[slug]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ async function save({ request, locals }: { request: Request; locals: App.Locals
user?.id ??
(await getExistingGuest(formData.get("username") as string, await _getMeeting(meetingId))).id;

const insertDates: AvailabilityInsertSchema[] = await Promise.all(
availabilityDates.map(async (date, index) => ({
day: new Date(date.day).toISOString(),
member_id: memberId,
meeting_day: dbMeetingDates[index].id as string, // Type-cast since id is guaranteed if a meetingDate exists
availability_string: date.availability.toString(),
})),
);
const insertDates: AvailabilityInsertSchema[] = availabilityDates.map((date, index) => ({
day: new Date(date.day).toISOString(),
member_id: memberId,
meeting_day: dbMeetingDates[index].id as string, // Type-cast since id is guaranteed if a meetingDate exists
availability_string: date.availability.toString(),
}));

await db.transaction(async (tx) => {
await tx
Expand Down

0 comments on commit bc77537

Please sign in to comment.