File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Injectable } from '@nestjs/common';
3
3
4
4
import { PrismaService } from '../prisma/prisma.service' ;
5
5
import { CreateShelterSupplySchema , UpdateShelterSupplySchema } from './types' ;
6
+ import { SupplyPriority } from '../supply/types' ;
6
7
7
8
@Injectable ( )
8
9
export class ShelterSupplyService {
@@ -35,15 +36,15 @@ export class ShelterSupplyService {
35
36
shelterId,
36
37
priority,
37
38
supplyId,
38
- quantity,
39
+ quantity : priority !== SupplyPriority . UnderControl ? quantity : null ,
39
40
createdAt : new Date ( ) . toISOString ( ) ,
40
41
} ,
41
42
} ) ;
42
43
}
43
44
44
45
async update ( body : z . infer < typeof UpdateShelterSupplySchema > ) {
45
46
const { data, where } = UpdateShelterSupplySchema . parse ( body ) ;
46
- const { priority } = data ;
47
+ const { priority, quantity } = data ;
47
48
if ( priority !== null && priority !== undefined ) {
48
49
const shelterSupply = await this . prismaService . shelterSupply . findFirst ( {
49
50
where : {
@@ -68,6 +69,7 @@ export class ShelterSupplyService {
68
69
} ,
69
70
data : {
70
71
...data ,
72
+ quantity : priority !== SupplyPriority . UnderControl ? quantity : null ,
71
73
createdAt : new Date ( ) . toISOString ( ) ,
72
74
} ,
73
75
} ) ;
You can’t perform that action at this time.
0 commit comments