Files
calendar/apps/web/lib/daily-webhook/getBookingReference.ts
T
884ccc9b48 feat: RECORDING_TRANSCRIPTION_GENERATED webhook (#15589)
* feat: RECORDING_TRANSCRIPTION_READY webhook

* refactor: split into diff files and restructuring

* feat: finish batch processor finished

* chore: types

* fix: type error

* chore: change name of triggger

* test: add unit test

* fix: type

* fix: type err

* chore: test

* feat: add booking reference repository and other imp

* chore: log

* fix: import

* chore: type error

* fix: update test

* fix: test

* fix: test

* fix: add timeout

* chore: move beforeEach

* Mock missing env variables to test. These vars are not set in CI

---------

Co-authored-by: Hariom <hariombalhara@gmail.com>
2024-07-05 07:39:23 +00:00

25 lines
820 B
TypeScript

import { HttpError } from "@calcom/lib/http-error";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
import { BookingReferenceRepository } from "@calcom/lib/server/repository/bookingReference";
const log = logger.getSubLogger({ prefix: ["daily-video-webhook-handler"] });
export const getBookingReference = async (roomName: string) => {
const bookingReference = await BookingReferenceRepository.findDailyVideoReferenceByRoomName({ roomName });
if (!bookingReference || !bookingReference.bookingId) {
log.error(
"bookingReference not found error:",
safeStringify({
bookingReference,
roomName,
})
);
throw new HttpError({ message: "Booking reference not found", statusCode: 200 });
}
return bookingReference;
};