feat: Add rerouting to AssignmentReasonRecorder (#19252)
* Add `rerouting` to `AssignmentReasonRecorder` * Pass session email as `rescheduledBy` * Write reassign reason * Edit message * Use `routingFormRoute` when rerouting * Pass isRerouting & reroutedByEmail to `routingFormRoute` method * Type fix * Fix test * Fix test * Fix test * Type fix * Refactor to use UserRepository * Show rerouted by email * Replace isReroutingCase * Fix rescheduledBy for new tab reschduling --------- Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Hariom <[email protected]>
This commit is contained in:
4 files changed
+42
-12
No files matched your search
@@ -1396,6 +1396,8 @@ async function handler(
|
||||
routingFormResponseId,
|
||||
organizerId: organizerUser.id,
|
||||
teamId,
|
||||
isRerouting: !!reroutingFormResponses,
|
||||
reroutedByEmail: reqBody.rescheduledBy,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,15 @@ export default class AssignmentReasonRecorder {
|
||||
routingFormResponseId,
|
||||
organizerId,
|
||||
teamId,
|
||||
isRerouting,
|
||||
reroutedByEmail,
|
||||
}: {
|
||||
bookingId: number;
|
||||
routingFormResponseId: number;
|
||||
organizerId: number;
|
||||
teamId: number;
|
||||
isRerouting: boolean;
|
||||
reroutedByEmail?: string | null;
|
||||
}) {
|
||||
// Get the routing form data
|
||||
const routingFormResponse = await prisma.app_RoutingForms_FormResponse.findUnique({
|
||||
@@ -113,8 +117,12 @@ export default class AssignmentReasonRecorder {
|
||||
}
|
||||
}
|
||||
|
||||
const reasonEnum = AssignmentReasonEnum.ROUTING_FORM_ROUTING;
|
||||
const reasonString = attributeValues.join(", ");
|
||||
const reasonEnum = isRerouting
|
||||
? AssignmentReasonEnum.REROUTED
|
||||
: AssignmentReasonEnum.ROUTING_FORM_ROUTING;
|
||||
const reasonString = `${
|
||||
isRerouting && reroutedByEmail ? `Rerouted by ${reroutedByEmail}` : ""
|
||||
} ${attributeValues.join(", ")}`;
|
||||
|
||||
await prisma.assignmentReason.create({
|
||||
data: {
|
||||
|
||||
Reference in new issue
Block a user