-
Notifications
You must be signed in to change notification settings - Fork 0
feat: update recording, transcript endpoint and add tests #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: coderabbit_full_base_feat_update_recording_transcript_endpoint_and_add_tests__pr16
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -212,10 +212,9 @@ export class BookingsController_2024_08_13 { | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Get("/:bookingUid/recordings") | ||||||||||||||||||
| // @Pbac(["booking.readRecordings"]) | ||||||||||||||||||
| @Permissions([BOOKING_READ]) | ||||||||||||||||||
| @UseGuards(BookingUidGuard) | ||||||||||||||||||
| // @UseGuards(ApiAuthGuard, BookingUidGuard, BookingPbacGuard) | ||||||||||||||||||
| @Pbac(["booking.readRecordings"]) | ||||||||||||||||||
| @Permissions([BOOKING_WRITE]) | ||||||||||||||||||
| @UseGuards(ApiAuthGuard, BookingUidGuard, BookingPbacGuard) | ||||||||||||||||||
| @ApiHeader(API_KEY_OR_ACCESS_TOKEN_HEADER) | ||||||||||||||||||
| @ApiOperation({ | ||||||||||||||||||
| summary: "Get all the recordings for the booking", | ||||||||||||||||||
|
|
@@ -225,21 +224,18 @@ export class BookingsController_2024_08_13 { | |||||||||||||||||
| `, | ||||||||||||||||||
| }) | ||||||||||||||||||
| async getBookingRecordings(@Param("bookingUid") bookingUid: string): Promise<GetBookingRecordingsOutput> { | ||||||||||||||||||
| const recordings = await this.calVideoService.getRecordings(bookingUid); | ||||||||||||||||||
| const recordings = this.calVideoService.getRecordings(bookingUid); | ||||||||||||||||||
|
|
||||||||||||||||||
| return { | ||||||||||||||||||
| status: SUCCESS_STATUS, | ||||||||||||||||||
| data: recordings, | ||||||||||||||||||
| message: | ||||||||||||||||||
| "This endpoint will require authentication in a future release. Please update your integration to include valid credentials. See https://cal.com/docs/api-reference/v2/introduction#authentication for details.", | ||||||||||||||||||
| }; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Get("/:bookingUid/transcripts") | ||||||||||||||||||
| // @Pbac(["booking.readRecordings"]) | ||||||||||||||||||
| @Pbac(["booking.readRecordings"]) | ||||||||||||||||||
| @Permissions([BOOKING_READ]) | ||||||||||||||||||
| @UseGuards(BookingUidGuard) | ||||||||||||||||||
| // @UseGuards(ApiAuthGuard, BookingUidGuard, BookingPbacGuard) | ||||||||||||||||||
| @UseGuards(BookingPbacGuard, ApiAuthGuard, BookingUidGuard) | ||||||||||||||||||
|
Comment on lines
+236
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent guard ordering may cause authorization issues. The guard order for transcripts (
Proposed fix - align with recordings/conferencing-sessions order `@Pbac`(["booking.readRecordings"])
`@Permissions`([BOOKING_READ])
- `@UseGuards`(BookingPbacGuard, ApiAuthGuard, BookingUidGuard)
+ `@UseGuards`(ApiAuthGuard, BookingUidGuard, BookingPbacGuard)
`@ApiHeader`(API_KEY_OR_ACCESS_TOKEN_HEADER)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| @ApiHeader(API_KEY_OR_ACCESS_TOKEN_HEADER) | ||||||||||||||||||
| @ApiOperation({ | ||||||||||||||||||
| summary: "Get Cal Video real time transcript download links for the booking", | ||||||||||||||||||
|
|
@@ -258,8 +254,6 @@ export class BookingsController_2024_08_13 { | |||||||||||||||||
| return { | ||||||||||||||||||
| status: SUCCESS_STATUS, | ||||||||||||||||||
| data: transcripts ?? [], | ||||||||||||||||||
| message: | ||||||||||||||||||
| "This endpoint will require authentication in a future release. Please update your integration to include valid credentials. See https://cal.com/docs/api-reference/v2/introduction#authentication for details.", | ||||||||||||||||||
| }; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -397,18 +391,18 @@ export class BookingsController_2024_08_13 { | |||||||||||||||||
| <Note>Please make sure to pass in the cal-api-version header value as mentioned in the Headers section. Not passing the correct value will default to an older version of this endpoint.</Note> | ||||||||||||||||||
| `, | ||||||||||||||||||
| }) | ||||||||||||||||||
| async markNoShow( | ||||||||||||||||||
| @Param("bookingUid") bookingUid: string, | ||||||||||||||||||
| @Body() body: MarkAbsentBookingInput_2024_08_13, | ||||||||||||||||||
| @GetUser() user: ApiAuthGuardUser | ||||||||||||||||||
| ): Promise<MarkAbsentBookingOutput_2024_08_13> { | ||||||||||||||||||
| const booking = await this.bookingsService.markAbsent(bookingUid, user.id, body, user.uuid); | ||||||||||||||||||
|
|
||||||||||||||||||
| return { | ||||||||||||||||||
| status: SUCCESS_STATUS, | ||||||||||||||||||
| data: booking, | ||||||||||||||||||
| }; | ||||||||||||||||||
| } | ||||||||||||||||||
| async markNoShow( | ||||||||||||||||||
| @Param("bookingUid") bookingUid: string, | ||||||||||||||||||
| @Body() body: MarkAbsentBookingInput_2024_08_13, | ||||||||||||||||||
| @GetUser() user: ApiAuthGuardUser | ||||||||||||||||||
| ): Promise<MarkAbsentBookingOutput_2024_08_13> { | ||||||||||||||||||
| const booking = await this.bookingsService.markAbsent(bookingUid, user.id, body, user.uuid); | ||||||||||||||||||
|
|
||||||||||||||||||
| return { | ||||||||||||||||||
| status: SUCCESS_STATUS, | ||||||||||||||||||
| data: booking, | ||||||||||||||||||
| }; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Post("/:bookingUid/reassign") | ||||||||||||||||||
| @HttpCode(HttpStatus.OK) | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
awaitcauses API to return Promise instead of recordings data.getRecordingsis an async method but is called withoutawait. This returns a Promise object todatainstead of the actual recordings array. When serialized to JSON, the Promise becomes{}, breaking the API response.Compare with line 252 where
getTranscriptscorrectly usesawait.Proposed fix
async getBookingRecordings(`@Param`("bookingUid") bookingUid: string): Promise<GetBookingRecordingsOutput> { - const recordings = this.calVideoService.getRecordings(bookingUid); + const recordings = await this.calVideoService.getRecordings(bookingUid); return { status: SUCCESS_STATUS, data: recordings, }; }📝 Committable suggestion
🤖 Prompt for AI Agents