diff --git a/services/EventService.ts b/services/EventService.ts index 6d4c7bc8..0778d424 100644 --- a/services/EventService.ts +++ b/services/EventService.ts @@ -24,7 +24,7 @@ export default class EventService { public async create(event: Event): Promise { const eventCreated = await this.transactions.readWrite(async (txn) => { const eventRepository = Repositories.event(txn); - const isUnusedAttendanceCode = eventRepository.isUnusedAttendanceCode(event.attendanceCode); + const isUnusedAttendanceCode = await eventRepository.isUnusedAttendanceCode(event.attendanceCode); if (!isUnusedAttendanceCode) throw new UserError('Attendance code has already been used'); if (event.start > event.end) throw new UserError('Start date after end date'); return eventRepository.upsertEvent(EventModel.create(event));