Skip to content

Commit 74189c7

Browse files
authored
Merge pull request #17 from topcoder-platform/pm-1503
fix(PM-1503): Open view score card as public API
2 parents 704bb4c + 86e0d71 commit 74189c7

File tree

3 files changed

+74
-72
lines changed

3 files changed

+74
-72
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ workflows:
7676
- develop
7777
- feat/ai-workflows
7878
- feat/scorecards
79-
- filters-fix
79+
- pm-1503
8080
- 'build-prod':
8181
context: org-global
8282
filters:

src/api/scorecard/scorecard.controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ export class ScorecardController {
110110
}
111111

112112
@Get('/:id')
113-
@Scopes(Scope.ReadScorecard)
114113
@ApiOperation({
115114
summary: 'View a scorecard',
116115
description: 'Scopes: read:scorecard',

src/api/scorecard/scorecard.service.ts

Lines changed: 73 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
import { Prisma } from '@prisma/client';
77
import {
88
mapScorecardRequestToDto,
9-
ScorecardGroupBaseDto,
9+
// ScorecardGroupBaseDto,
1010
ScorecardPaginatedResponseDto,
1111
ScorecardQueryDto,
12-
ScorecardQuestionBaseDto,
12+
// ScorecardQuestionBaseDto,
1313
ScorecardRequestDto,
1414
ScorecardResponseDto,
15-
ScorecardSectionBaseDto,
15+
// ScorecardSectionBaseDto,
1616
ScorecardWithGroupResponseDto,
1717
} from 'src/dto/scorecard.dto';
1818
import { PrismaService } from 'src/shared/modules/global/prisma.service';
@@ -202,76 +202,79 @@ export class ScoreCardService {
202202
};
203203
}
204204

205-
async cloneScorecard(
206-
id: string
207-
): Promise<ScorecardResponseDto> {
208-
const original = await this.prisma.scorecard
209-
.findUnique({
210-
where: { id },
211-
include: {
212-
scorecardGroups: {
213-
include: {
214-
sections: {
215-
include: {
216-
questions: true,
217-
},
218-
},
219-
},
220-
},
221-
},
222-
});
205+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/require-await
206+
async cloneScorecard(id: string): Promise<ScorecardResponseDto> {
207+
// const original = await this.prisma.scorecard.findUnique({
208+
// where: { id },
209+
// include: {
210+
// scorecardGroups: {
211+
// include: {
212+
// sections: {
213+
// include: {
214+
// questions: true,
215+
// },
216+
// },
217+
// },
218+
// },
219+
// },
220+
// });
223221

224-
if (!original) {
225-
throw new NotFoundException({ message: `Scorecard not found.` });
226-
}
222+
// if (!original) {
223+
// throw new NotFoundException({ message: `Scorecard not found.` });
224+
// }
227225

228-
// Remove id fields from nested objects for cloning
229-
const cloneGroups = original.scorecardGroups.map((group: ScorecardGroupBaseDto) => ({
230-
...group,
231-
id: undefined,
232-
createdAt: undefined,
233-
updatedAt: undefined,
234-
scorecardId: undefined,
235-
sections: group.sections.map((section: ScorecardSectionBaseDto) => ({
236-
...section,
237-
id: undefined,
238-
createdAt: undefined,
239-
updatedAt: undefined,
240-
scorecardGroupId: undefined,
241-
questions: section.questions.map((question: ScorecardQuestionBaseDto) => ({
242-
...question,
243-
id: undefined,
244-
createdAt: undefined,
245-
updatedAt: undefined,
246-
sectionId: undefined,
247-
scorecardSectionId: undefined,
248-
})),
249-
})),
250-
}));
226+
// // Remove id fields from nested objects for cloning
227+
// const cloneGroups = original.scorecardGroups.map(
228+
// (group: ScorecardGroupBaseDto) => ({
229+
// ...group,
230+
// id: undefined,
231+
// createdAt: undefined,
232+
// updatedAt: undefined,
233+
// scorecardId: undefined,
234+
// sections: group.sections.map((section: ScorecardSectionBaseDto) => ({
235+
// ...section,
236+
// id: undefined,
237+
// createdAt: undefined,
238+
// updatedAt: undefined,
239+
// scorecardGroupId: undefined,
240+
// questions: section.questions.map(
241+
// (question: ScorecardQuestionBaseDto) => ({
242+
// ...question,
243+
// id: undefined,
244+
// createdAt: undefined,
245+
// updatedAt: undefined,
246+
// sectionId: undefined,
247+
// scorecardSectionId: undefined,
248+
// }),
249+
// ),
250+
// })),
251+
// }),
252+
// );
251253

252-
const clonedScorecard = await this.prisma.scorecard.create({
253-
data: {
254-
...original,
255-
id: undefined,
256-
name: `${original.name} (Clone)`,
257-
createdAt: undefined,
258-
updatedAt: undefined,
259-
scorecardGroups: {
260-
create: cloneGroups,
261-
},
262-
},
263-
include: {
264-
scorecardGroups: {
265-
include: {
266-
sections: {
267-
include: {
268-
questions: true,
269-
},
270-
},
271-
},
272-
},
273-
},
274-
});
254+
// const clonedScorecard = await this.prisma.scorecard.create({
255+
// data: {
256+
// ...original,
257+
// id: undefined,
258+
// name: `${original.name} (Clone)`,
259+
// createdAt: undefined,
260+
// updatedAt: undefined,
261+
// scorecardGroups: {
262+
// create: cloneGroups,
263+
// },
264+
// },
265+
// include: {
266+
// scorecardGroups: {
267+
// include: {
268+
// sections: {
269+
// include: {
270+
// questions: true,
271+
// },
272+
// },
273+
// },
274+
// },
275+
// },
276+
// });
277+
const clonedScorecard = {};
275278

276279
return clonedScorecard as ScorecardResponseDto;
277280
}

0 commit comments

Comments
 (0)