Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sql/reports/challenges/submission-links.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LEFT JOIN
LEFT JOIN
resources."ResourceRole" rr on res."roleId" = rr.id
LEFT JOIN
resources."MemberProfile" mp on res."memberId" = mp."userId"::text
members."member" mp on res."memberId" = mp."userId"::text
LEFT JOIN
reviews."submission" sub on sub."memberId"=res."memberId" AND sub."challengeId"=c.id
WHERE rr.name = 'Submitter'
Expand Down
3 changes: 2 additions & 1 deletion src/app-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export const Scopes = {
TopgearCancelledChallenge: "reports:topgear-cancelled-challenge",
AllReports: "reports:all",
TopgearChallengeTechnology: "reports:topgear-challenge-technology",
TopgearChallengeRegistrantDetails: "reports:topgear-challenge-registrant-details",
TopgearChallengeRegistrantDetails:
"reports:topgear-challenge-registrant-details",
SFDC: {
PaymentsReport: "reports:sfdc-payments",
BA: "reports:sfdc-ba",
Expand Down
5 changes: 4 additions & 1 deletion src/reports/challenges/challenges-reports.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { Scopes as AppScopes } from "../../app-constants";
import { ChallengesReportsService } from "./challenges-reports.service";
import { ChallengeRegistrantsQueryDto } from "./dtos/registrants.dto";
import { ChallengesReportQueryDto } from "./dtos/challenge.dto";
import { SubmissionLinksDto, SubmissionLinksQueryDto } from "./dtos/submission-links.dto";
import {
SubmissionLinksDto,
SubmissionLinksQueryDto,
} from "./dtos/submission-links.dto";

@ApiTags("Challenges Reports")
@Controller("/challenges")
Expand Down
57 changes: 31 additions & 26 deletions src/reports/challenges/dtos/submission-links.dto.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { ChallengeStatus } from './challenge-status.enum';
import { Transform } from 'class-transformer';
import { transformArray } from 'src/common/validation.util';

import { ApiProperty } from "@nestjs/swagger";
import {
IsDateString,
IsNotEmpty,
IsOptional,
IsString,
} from "class-validator";
import { ChallengeStatus } from "./challenge-status.enum";
import { Transform } from "class-transformer";
import { transformArray } from "src/common/validation.util";

export class SubmissionLinksQueryDto {

@ApiProperty({
required: true,
description: "Filter by challenge completion date (from)",
Expand All @@ -24,17 +27,17 @@ export class SubmissionLinksQueryDto {
@IsDateString()
completionDateTo?: Date;

@ApiProperty({
required: false,
enum: ChallengeStatus,
example: [ChallengeStatus.COMPLETED],
isArray: true,
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
challengeStatus?: ChallengeStatus[];
@ApiProperty({
required: false,
enum: ChallengeStatus,
example: [ChallengeStatus.COMPLETED],
isArray: true,
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
challengeStatus?: ChallengeStatus[];
}

export class SubmissionLinksDto {
Expand All @@ -44,42 +47,44 @@ export class SubmissionLinksDto {
challengeId: number;

@ApiProperty({
description: "Status of the challenge"
description: "Status of the challenge",
})
challengeStatus: ChallengeStatus;

@ApiProperty({
description: "The date at which the challenge is completed"
description: "The date at which the challenge is completed",
})
challengeCompletedDate: string | null;

@ApiProperty({
description: "The registration handle of the submitter"
description: "The registration handle of the submitter",
})
registrantHandle: string;

@ApiProperty({
description: "The final score received by the registrant on that submission"
description:
"The final score received by the registrant on that submission",
})
registrantFinalScore: number;

@ApiProperty({
description: "This denotes if the submission has passed. If the final score is greater than 98 then its considered pass"
description:
"This denotes if the submission has passed. If the final score is greater than 98 then its considered pass",
})
didSubmissionPass: boolean;

@ApiProperty({
description: "The link to the submission url"
description: "The link to the submission url",
})
submissionUrl: string;

@ApiProperty({
description: "Submission ID"
description: "Submission ID",
})
submissionId: number;

@ApiProperty({
description: "Submission creation date"
description: "Submission creation date",
})
submissionCreatedDate: string;
}