Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/dto/reviewOpportunity.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,20 @@ export class QueryReviewOpportunityDto {
@IsOptional()
numSubmissionsTo: number | undefined;

@Transform(({ value }): string[] | undefined => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the transformation logic into a separate utility function to avoid code duplication, as the same logic is used for both tracks and skills fields.

if (Array.isArray(value)) return value as string[];
if (typeof value === 'string') return [value];
return value as string[] | undefined;
})
@IsArray()
@IsOptional()
tracks: string[] | undefined;

@Transform(({ value }): string[] | undefined => {
if (Array.isArray(value)) return value as string[];
if (typeof value === 'string') return [value];
return value as string[] | undefined;
})
@IsArray()
@IsOptional()
skills: string[] | undefined;
Expand Down