Skip to content

Commit 212efc8

Browse files
authored
Fix mutable arrays in DTOs (#3103)
1 parent c7a9b1e commit 212efc8

15 files changed

+18
-18
lines changed

src/common/resource.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export abstract class Resource extends DataObject {
5555

5656
// A list of non-global roles the requesting user has available for this object.
5757
// This is used by the authorization module to determine permissions.
58-
readonly scope?: ScopedRole[];
58+
readonly scope?: readonly ScopedRole[];
5959
}
6060

6161
type Thunk<T> = T | (() => T);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export abstract class CreateInternshipEngagement extends CreateEngagement {
8989
readonly position?: InternshipPosition;
9090

9191
@Field(() => [ProductMethodology], { nullable: true })
92-
readonly methodologies?: ProductMethodology[];
92+
readonly methodologies?: readonly ProductMethodology[];
9393

9494
@Field({ nullable: true })
9595
@Type(() => CreateDefinedFileVersionInput)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export abstract class UpdateInternshipEngagement extends UpdateEngagement {
9090
readonly position?: InternshipPosition;
9191

9292
@Field(() => [ProductMethodology], { nullable: true })
93-
readonly methodologies?: ProductMethodology[];
93+
readonly methodologies?: readonly ProductMethodology[];
9494

9595
@Field({ nullable: true })
9696
@Type(() => CreateDefinedFileVersionInput)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export abstract class UpdatePartner {
2828

2929
@Field(() => [PartnerType], { nullable: true })
3030
@Transform(({ value }) => uniq(value))
31-
readonly types?: PartnerType[];
31+
readonly types?: readonly PartnerType[];
3232

3333
@Field(() => [FinancialReportingType], { nullable: true })
3434
@Transform(({ value }) => uniq(value))
35-
readonly financialReportingTypes?: FinancialReportingType[];
35+
readonly financialReportingTypes?: readonly FinancialReportingType[];
3636

3737
@Field({ nullable: true })
3838
@Matches(/^[A-Z]{3}$/, {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export abstract class UpdatePartnership {
3939

4040
@Field(() => [PartnerType], { nullable: true })
4141
@Transform(({ value }) => uniq(value))
42-
readonly types?: PartnerType[];
42+
readonly types?: readonly PartnerType[];
4343

4444
@Field(() => FinancialReportingType, { nullable: true })
4545
readonly financialReportingType?: FinancialReportingType | null;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export abstract class CreateProject {
4040
nullable: true,
4141
})
4242
@IsId({ each: true })
43-
readonly otherLocationIds?: ID[];
43+
readonly otherLocationIds?: ReadonlyArray<ID<'Location'>>;
4444

4545
@IdField({
4646
description: 'A marketing primary location ID',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export abstract class UpdateProject {
7474

7575
@Field(() => [String], { nullable: true })
7676
@Transform(({ value }) => uniq(value))
77-
readonly tags?: string[];
77+
readonly tags?: readonly string[];
7878

7979
@DateTimeField({ nullable: true })
8080
readonly financialReportReceivedAt?: DateTime;

src/components/project/project-member/dto/create-project-member.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class CreateProjectMember {
1919
readonly projectId: ID | UnsecuredDto<Project>;
2020

2121
@Field(() => [Role], { nullable: true })
22-
readonly roles?: Role[];
22+
readonly roles?: readonly Role[];
2323
}
2424

2525
@InputType()

src/components/project/project-member/dto/update-project-member.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export abstract class UpdateProjectMember {
1111
readonly id: ID;
1212

1313
@Field(() => [Role], { nullable: true })
14-
readonly roles?: Role[];
14+
readonly roles?: readonly Role[];
1515
}
1616

1717
@InputType()

src/components/project/project-member/project-member.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class ProjectMemberService {
192192
}
193193

194194
private async assertValidRoles(
195-
roles: Role[] | undefined,
195+
roles: readonly Role[] | undefined,
196196
forUser: () => MaybeAsync<User>,
197197
) {
198198
if (!roles || roles.length === 0) {

0 commit comments

Comments
 (0)