1
1
import { Field , ID as IDType , InputType , ObjectType } from '@nestjs/graphql' ;
2
- import { Transform , Type } from 'class-transformer' ;
2
+ import { Type } from 'class-transformer' ;
3
3
import { Matches , ValidateNested } from 'class-validator' ;
4
- import { uniq } from 'lodash' ;
5
4
import {
6
5
CalendarDate ,
7
6
DateField ,
8
7
ID ,
9
8
IdField ,
10
9
IsId ,
10
+ ListField ,
11
11
NameField ,
12
12
} from '~/common' ;
13
13
import { FinanceDepartmentIdBlockInput } from '../../finance/department/dto/id-blocks.input' ;
@@ -24,12 +24,10 @@ export abstract class UpdatePartner {
24
24
@IdField ( { nullable : true } )
25
25
readonly pointOfContactId ?: ID < 'User' > | null ;
26
26
27
- @Field ( ( ) => [ PartnerType ] , { nullable : true } )
28
- @Transform ( ( { value } ) => uniq ( value ) )
27
+ @ListField ( ( ) => PartnerType , { optional : true } )
29
28
readonly types ?: readonly PartnerType [ ] ;
30
29
31
- @Field ( ( ) => [ FinancialReportingType ] , { nullable : true } )
32
- @Transform ( ( { value } ) => uniq ( value ) )
30
+ @ListField ( ( ) => FinancialReportingType , { optional : true } )
33
31
readonly financialReportingTypes ?: readonly FinancialReportingType [ ] ;
34
32
35
33
@Field ( ( ) => String , { nullable : true } )
@@ -50,26 +48,23 @@ export abstract class UpdatePartner {
50
48
@IdField ( { nullable : true } )
51
49
readonly languageOfWiderCommunicationId ?: ID < 'Language' > | null ;
52
50
53
- @Field ( ( ) => [ IDType ] , { nullable : true } )
51
+ @ListField ( ( ) => IDType , { optional : true } )
54
52
@IsId ( { each : true } )
55
- @Transform ( ( { value } ) => ( value ? uniq ( value ) : undefined ) )
56
53
readonly countries ?: ReadonlyArray < ID < 'Location' > > ;
57
54
58
- @Field ( ( ) => [ IDType ] , { nullable : true } )
55
+ @ListField ( ( ) => IDType , { optional : true } )
59
56
@IsId ( { each : true } )
60
- @Transform ( ( { value } ) => ( value ? uniq ( value ) : undefined ) )
61
57
readonly fieldRegions ?: ReadonlyArray < ID < 'FieldRegion' > > ;
62
58
63
- @Field ( ( ) => [ IDType ] , { name : 'languagesOfConsulting' , nullable : true } )
64
- @Transform ( ( { value } ) => ( value ? uniq ( value ) : undefined ) )
59
+ @ListField ( ( ) => IDType , { optional : true } )
60
+ @IsId ( { each : true } )
65
61
readonly languagesOfConsulting ?: ReadonlyArray < ID < 'Language' > > ;
66
62
67
63
@DateField ( { nullable : true } )
68
64
readonly startDate ?: CalendarDate | null ;
69
65
70
- @Field ( ( ) => [ ProjectType ] , { nullable : true } )
71
- @Transform ( ( { value } ) => uniq ( value ) )
72
- readonly approvedPrograms ?: ProjectType [ ] ;
66
+ @ListField ( ( ) => ProjectType , { optional : true } )
67
+ readonly approvedPrograms ?: readonly ProjectType [ ] ;
73
68
74
69
@Field ( ( ) => FinanceDepartmentIdBlockInput , { nullable : true } )
75
70
@ValidateNested ( )
0 commit comments