fix: Improve wrong assignment report (#27162)
* Pass already fetched booking * Fetch the assignment reason * Update tests * Label as first assignment reason * Pass single booking object * Remove unused repository method * Only pass bookingUid to handler * Rename booking `assignmentReason` to `assignmentReasonSortedByCreatedAt` * fix: use renamed assignmentReasonSortedByCreatedAt property Co-Authored-By: [email protected] <[email protected]> * Remove take statement * fix: address Udit's review comments - Restore BookingAccessService for access control checks - Rename repository method from findByUidForWrongAssignmentReport to findByUidIncludeUserAndEventTypeTeamAndAttendeesAndAssignmentReason Co-Authored-By: [email protected] <[email protected]> * test: update tests to use BookingAccessService mock Co-Authored-By: [email protected] <[email protected]> * fix: use latest assignment reason in BookingDetailsSheet for consistency Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
11 files changed
+277
-232
No files matched your search
@@ -2123,54 +2123,6 @@ export class BookingRepository implements IBookingRepository {
|
||||
});
|
||||
}
|
||||
|
||||
async findByUidIncludeEventTypeAndTeamAndAssignmentReason({ bookingUid }: { bookingUid: string }) {
|
||||
return await this.prismaClient.booking.findUnique({
|
||||
where: {
|
||||
uid: bookingUid,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
uid: true,
|
||||
title: true,
|
||||
startTime: true,
|
||||
endTime: true,
|
||||
status: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
email: true,
|
||||
},
|
||||
},
|
||||
attendees: {
|
||||
select: {
|
||||
email: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
eventType: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
slug: true,
|
||||
teamId: true,
|
||||
},
|
||||
},
|
||||
assignmentReason: {
|
||||
select: {
|
||||
reasonString: true,
|
||||
reasonEnum: true,
|
||||
},
|
||||
},
|
||||
routedFromRoutingFormReponse: {
|
||||
select: {
|
||||
formId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async updateRecordedStatus({
|
||||
bookingUid,
|
||||
isRecorded,
|
||||
@@ -2183,4 +2135,58 @@ export class BookingRepository implements IBookingRepository {
|
||||
data: { isRecorded },
|
||||
});
|
||||
}
|
||||
|
||||
async findByUidIncludeUserAndEventTypeTeamAndAttendeesAndAssignmentReason({ bookingUid }: { bookingUid: string }) {
|
||||
return await this.prismaClient.booking.findUnique({
|
||||
where: { uid: bookingUid },
|
||||
select: {
|
||||
id: true,
|
||||
uid: true,
|
||||
title: true,
|
||||
startTime: true,
|
||||
endTime: true,
|
||||
status: true,
|
||||
userId: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
email: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
eventType: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
slug: true,
|
||||
team: {
|
||||
select: {
|
||||
id: true,
|
||||
parentId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
attendees: {
|
||||
select: {
|
||||
email: true,
|
||||
},
|
||||
},
|
||||
assignmentReason: {
|
||||
select: {
|
||||
reasonString: true,
|
||||
},
|
||||
take: 1,
|
||||
orderBy: {
|
||||
createdAt: "asc" as const,
|
||||
},
|
||||
},
|
||||
routedFromRoutingFormReponse: {
|
||||
select: {
|
||||
formId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user