Skip to content

Commit 80a60a4

Browse files
authored
Add Partner.startDate (#2991)
1 parent 6743b08 commit 80a60a4

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

src/components/partner/dto/create-partner.dto.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ import { Field, ID as IDType, InputType, ObjectType } from '@nestjs/graphql';
22
import { Transform, Type } from 'class-transformer';
33
import { Matches, ValidateNested } from 'class-validator';
44
import { uniq } from 'lodash';
5-
import { ID, IdField, IdOf, IsId, NameField } from '../../../common';
5+
import {
6+
CalendarDate,
7+
DateField,
8+
ID,
9+
IdField,
10+
IdOf,
11+
IsId,
12+
NameField,
13+
} from '../../../common';
614
import { Location } from '../../../components/location';
715
import { FieldRegion } from '../../field-region';
816
import type { Language } from '../../language';
@@ -57,6 +65,9 @@ export abstract class CreatePartner {
5765
@Field(() => [IDType], { name: 'languagesOfConsulting', nullable: true })
5866
@Transform(({ value }) => uniq(value))
5967
readonly languagesOfConsulting?: ReadonlyArray<IdOf<Language>> = [];
68+
69+
@DateField({ nullable: true })
70+
readonly startDate?: CalendarDate;
6071
}
6172

6273
@InputType()

src/components/partner/dto/partner.dto.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ResourceRelationsShape,
1414
Secured,
1515
SecuredBoolean,
16+
SecuredDateNullable,
1617
SecuredEnumList,
1718
SecuredProperty,
1819
SecuredProps,
@@ -88,6 +89,9 @@ export class Partner extends Interfaces {
8889
Secured<ReadonlyArray<IdOf<Language>>>
8990
>;
9091

92+
@Field()
93+
readonly startDate: SecuredDateNullable;
94+
9195
@DateTimeField()
9296
readonly modifiedAt: DateTime;
9397

src/components/partner/dto/update-partner.dto.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ import { Field, ID as IDType, InputType, ObjectType } from '@nestjs/graphql';
22
import { Transform, Type } from 'class-transformer';
33
import { Matches, ValidateNested } from 'class-validator';
44
import { uniq } from 'lodash';
5-
import { ID, IdField, IdOf, IsId, NameField } from '../../../common';
5+
import {
6+
CalendarDate,
7+
DateField,
8+
ID,
9+
IdField,
10+
IdOf,
11+
IsId,
12+
NameField,
13+
} from '../../../common';
614
import { Location } from '../../../components/location';
715
import { FieldRegion } from '../../field-region';
816
import type { Language } from '../../language';
@@ -57,6 +65,9 @@ export abstract class UpdatePartner {
5765
@Field(() => [IDType], { name: 'languagesOfConsulting', nullable: true })
5866
@Transform(({ value }) => (value ? uniq(value) : undefined))
5967
readonly languagesOfConsulting?: ReadonlyArray<IdOf<Language>>;
68+
69+
@DateField({ nullable: true })
70+
readonly startDate?: CalendarDate | null;
6071
}
6172

6273
@InputType()

src/components/partner/partner.repository.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { node, Query, relation } from 'cypher-query-builder';
33
import { DateTime } from 'luxon';
44
import { ChangesOf } from '~/core/database/changes';
55
import {
6+
CalendarDate,
67
ID,
78
InputException,
89
ServerException,
@@ -54,6 +55,7 @@ export class PartnerRepository extends DtoRepository<
5455
pmcEntityCode: input.pmcEntityCode,
5556
globalInnovationsClient: input.globalInnovationsClient,
5657
active: input.active,
58+
startDate: input.startDate ?? CalendarDate.local(),
5759
address: input.address,
5860
modifiedAt: DateTime.local(),
5961
canDelete: true,

0 commit comments

Comments
 (0)