Skip to content

Commit

Permalink
🐛 fix: unable to self-add merged units onto a call
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Apr 9, 2022
1 parent 0f96be4 commit 0280639
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,16 @@ export class Calls911Controller {
throw new NotFound("callNotFound");
}

const types = {
combined: "combinedLeoId",
leo: "officerId",
"ems-fd": "emsFdDeputyId",
};

const existing = await prisma.assignedUnit.findFirst({
where: {
call911Id: callId,
[type === "leo" ? "officerId" : "emsFdDeputyId"]: unit.id,
[types[type]]: unit.id,
},
});

Expand All @@ -371,7 +377,7 @@ export class Calls911Controller {
await prisma.assignedUnit.create({
data: {
call911Id: callId,
[type === "leo" ? "officerId" : "emsFdDeputyId"]: unit.id,
[types[type]]: unit.id,
},
});
} else {
Expand Down

0 comments on commit 0280639

Please sign in to comment.