Skip to content

Commit

Permalink
🎉 set status to ASSIGNED (closes #156)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Nov 17, 2021
1 parent 6d4e8b2 commit 6d5ca51
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/api/src/controllers/dispatch/Calls911Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@ export class Calls911Controller {
throw new BadRequest("unitOffDuty");
}

const status = await prisma.statusValue.findFirst({
where: { shouldDo: "SET_ASSIGNED" },
});

if (status) {
const t = type === "leo" ? "officer" : "emsFdDeputy";
// @ts-expect-error ignore
await prisma[t].update({
where: { id: unit.id },
data: { statusId: status.id },
});

this.socket.emitUpdateOfficerStatus();
this.socket.emitUpdateDeputyStatus();
}

const assignedUnit = await prisma.assignedUnit.create({
data: {
call911Id: callId,
Expand Down

0 comments on commit 6d5ca51

Please sign in to comment.