diff --git a/src/shelter-supply/shelter-supply.controller.ts b/src/shelter-supply/shelter-supply.controller.ts index 20ef1ab..1b3615c 100644 --- a/src/shelter-supply/shelter-supply.controller.ts +++ b/src/shelter-supply/shelter-supply.controller.ts @@ -99,7 +99,10 @@ export class ShelterSupplyController { data, ); } catch (err: any) { - this.logger.error(`Failed to update many shelter supplies: ${err}`,err.stack); + this.logger.error( + `Failed to update many shelter supplies: ${err}`, + err.stack, + ); throw new HttpException(err?.code ?? err?.name ?? `${err}`, 400); } } diff --git a/src/shelter-supply/shelter-supply.service.ts b/src/shelter-supply/shelter-supply.service.ts index 4321c02..658e28d 100644 --- a/src/shelter-supply/shelter-supply.service.ts +++ b/src/shelter-supply/shelter-supply.service.ts @@ -9,7 +9,6 @@ import { UpdateManyShelterSupplySchema, UpdateShelterSupplySchema, } from './types'; -import { Prisma } from '@prisma/client'; @Injectable() export class ShelterSupplyService { @@ -108,19 +107,19 @@ export class ShelterSupplyService { 0, ); - await this.prismaService.$transaction(async tx => { + await this.prismaService.$transaction(async (tx) => { await tx.shelter.update({ - where: { - id: shelterId, - }, - data: { - prioritySum: { - decrement: prioritySum, - }, - updatedAt: new Date().toISOString(), + where: { + id: shelterId, + }, + data: { + prioritySum: { + decrement: prioritySum, }, - }), - await tx.shelterSupply.updateAndAuditMany({ + updatedAt: new Date().toISOString(), + }, + }), + await tx.shelterSupply.updateAndAuditMany({ ...audit, where: { shelterId, @@ -132,7 +131,7 @@ export class ShelterSupplyService { priority: SupplyPriority.UnderControl, updatedAt: new Date().toISOString(), }, - }) + }); }); }