Skip to content

Commit 0a6a003

Browse files
committed
Moved secured enum wrappers to their enum file
1 parent 73eb669 commit 0a6a003

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
Secured,
1111
SecuredBoolean,
1212
SecuredDateNullable,
13-
SecuredEnumList,
1413
SecuredProperty,
1514
SecuredProps,
1615
SecuredStringNullable,
@@ -19,7 +18,7 @@ import {
1918
} from '~/common';
2019
import { e } from '~/core/edgedb';
2120
import { LinkTo, RegisterResource } from '~/core/resources';
22-
import { FinancialReportingType } from '../../partnership/dto';
21+
import { SecuredFinancialReportingTypes } from '../../partnership/dto';
2322
import { Pinnable } from '../../pin/dto';
2423
import { Postable } from '../../post/dto';
2524
import { IProject } from '../../project/dto';
@@ -30,13 +29,6 @@ const Interfaces: Type<Resource & Pinnable & Postable> = IntersectionType(
3029
IntersectionType(Pinnable, Postable),
3130
);
3231

33-
@ObjectType({
34-
description: SecuredEnumList.descriptionFor('financial reporting types'),
35-
})
36-
export abstract class SecuredFinancialReportingTypes extends SecuredEnumList(
37-
FinancialReportingType,
38-
) {}
39-
4032
@RegisterResource({ db: e.Partner })
4133
@ObjectType({
4234
implements: [Resource, Pinnable, Postable],
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
import { EnumType, makeEnum } from '~/common';
1+
import { ObjectType } from '@nestjs/graphql';
2+
import { EnumType, makeEnum, SecuredEnum, SecuredEnumList } from '~/common';
23

34
export type FinancialReportingType = EnumType<typeof FinancialReportingType>;
45
export const FinancialReportingType = makeEnum({
56
name: 'FinancialReportingType',
67
values: ['Funded', 'FieldEngaged', 'Hybrid'],
78
});
9+
10+
@ObjectType({
11+
description: SecuredEnumList.descriptionFor('financial reporting types'),
12+
})
13+
export abstract class SecuredFinancialReportingTypes extends SecuredEnumList(
14+
FinancialReportingType,
15+
) {}
16+
17+
@ObjectType({
18+
description: SecuredEnum.descriptionFor('financial reporting type'),
19+
})
20+
export abstract class SecuredFinancialReportingType extends SecuredEnum(
21+
FinancialReportingType,
22+
{ nullable: true },
23+
) {}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { EnumType, makeEnum } from '~/common';
1+
import { ObjectType } from '@nestjs/graphql';
2+
import { EnumType, makeEnum, SecuredEnum } from '~/common';
23

34
export type PartnershipAgreementStatus = EnumType<
45
typeof PartnershipAgreementStatus
@@ -7,3 +8,10 @@ export const PartnershipAgreementStatus = makeEnum({
78
name: 'PartnershipAgreementStatus',
89
values: ['NotAttached', 'AwaitingSignature', 'Signed'],
910
});
11+
12+
@ObjectType({
13+
description: SecuredEnum.descriptionFor('a partnership agreement status'),
14+
})
15+
export abstract class SecuredPartnershipAgreementStatus extends SecuredEnum(
16+
PartnershipAgreementStatus,
17+
) {}

src/components/partnership/dto/partnership.dto.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
Secured,
99
SecuredBoolean,
1010
SecuredDateNullable,
11-
SecuredEnum,
1211
SecuredProps,
1312
Sensitivity,
1413
SensitivityField,
@@ -20,23 +19,8 @@ import { ChangesetAware } from '../../changeset/dto';
2019
import { Organization } from '../../organization/dto';
2120
import { SecuredPartnerTypes } from '../../partner/dto';
2221
import { IProject } from '../../project/dto';
23-
import { FinancialReportingType } from './financial-reporting-type.enum';
24-
import { PartnershipAgreementStatus } from './partnership-agreement-status.enum';
25-
26-
@ObjectType({
27-
description: SecuredEnum.descriptionFor('a partnership agreement status'),
28-
})
29-
export abstract class SecuredPartnershipAgreementStatus extends SecuredEnum(
30-
PartnershipAgreementStatus,
31-
) {}
32-
33-
@ObjectType({
34-
description: SecuredEnum.descriptionFor('partnership funding type'),
35-
})
36-
export abstract class SecuredFinancialReportingType extends SecuredEnum(
37-
FinancialReportingType,
38-
{ nullable: true },
39-
) {}
22+
import { SecuredFinancialReportingType } from './financial-reporting-type.enum';
23+
import { SecuredPartnershipAgreementStatus } from './partnership-agreement-status.enum';
4024

4125
@RegisterResource({ db: e.Partnership })
4226
@ObjectType({
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import { EnumType, makeEnum } from '~/common';
1+
import { ObjectType } from '@nestjs/graphql';
2+
import { EnumType, makeEnum, SecuredEnum, SecuredProperty } from '~/common';
23

34
export type UserStatus = EnumType<typeof UserStatus>;
45
export const UserStatus = makeEnum({
56
name: 'UserStatus',
67
values: ['Active', 'Disabled'],
78
});
9+
10+
@ObjectType({
11+
description: SecuredProperty.descriptionFor('a user status'),
12+
})
13+
export abstract class SecuredUserStatus extends SecuredEnum(UserStatus) {}

src/components/user/dto/user.dto.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
NameField,
88
Resource,
99
ResourceRelationsShape,
10-
SecuredEnum,
1110
SecuredProperty,
1211
SecuredProps,
1312
SecuredRoles,
@@ -24,18 +23,13 @@ import { IProject as Project } from '../../project/dto';
2423
import { Education } from '../education/dto';
2524
import { Unavailability } from '../unavailability/dto';
2625
import { KnownLanguage } from './known-language.dto';
27-
import { UserStatus } from './user-status.enum';
26+
import { SecuredUserStatus } from './user-status.enum';
2827

2928
const PinnableResource: Type<Resource & Pinnable> = IntersectionType(
3029
Resource,
3130
Pinnable,
3231
);
3332

34-
@ObjectType({
35-
description: SecuredProperty.descriptionFor('a user status'),
36-
})
37-
export abstract class SecuredUserStatus extends SecuredEnum(UserStatus) {}
38-
3933
@RegisterResource({ db: e.User })
4034
@ObjectType({
4135
implements: [Resource, Pinnable],

0 commit comments

Comments
 (0)