diff --git a/.circleci/config.yml b/.circleci/config.yml index 47eef83..5692065 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,7 +76,7 @@ workflows: - develop - feat/ai-workflows - feat/scorecards - - filters-fix + - pm-1503 - 'build-prod': context: org-global filters: diff --git a/src/api/scorecard/scorecard.controller.ts b/src/api/scorecard/scorecard.controller.ts index c7a4b46..1eb06ba 100644 --- a/src/api/scorecard/scorecard.controller.ts +++ b/src/api/scorecard/scorecard.controller.ts @@ -110,7 +110,6 @@ export class ScorecardController { } @Get('/:id') - @Scopes(Scope.ReadScorecard) @ApiOperation({ summary: 'View a scorecard', description: 'Scopes: read:scorecard', diff --git a/src/api/scorecard/scorecard.service.ts b/src/api/scorecard/scorecard.service.ts index 934655d..a19ea41 100644 --- a/src/api/scorecard/scorecard.service.ts +++ b/src/api/scorecard/scorecard.service.ts @@ -6,13 +6,13 @@ import { import { Prisma } from '@prisma/client'; import { mapScorecardRequestToDto, - ScorecardGroupBaseDto, + // ScorecardGroupBaseDto, ScorecardPaginatedResponseDto, ScorecardQueryDto, - ScorecardQuestionBaseDto, + // ScorecardQuestionBaseDto, ScorecardRequestDto, ScorecardResponseDto, - ScorecardSectionBaseDto, + // ScorecardSectionBaseDto, ScorecardWithGroupResponseDto, } from 'src/dto/scorecard.dto'; import { PrismaService } from 'src/shared/modules/global/prisma.service'; @@ -202,76 +202,79 @@ export class ScoreCardService { }; } - async cloneScorecard( - id: string - ): Promise { - const original = await this.prisma.scorecard - .findUnique({ - where: { id }, - include: { - scorecardGroups: { - include: { - sections: { - include: { - questions: true, - }, - }, - }, - }, - }, - }); + // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/require-await + async cloneScorecard(id: string): Promise { + // const original = await this.prisma.scorecard.findUnique({ + // where: { id }, + // include: { + // scorecardGroups: { + // include: { + // sections: { + // include: { + // questions: true, + // }, + // }, + // }, + // }, + // }, + // }); - if (!original) { - throw new NotFoundException({ message: `Scorecard not found.` }); - } + // if (!original) { + // throw new NotFoundException({ message: `Scorecard not found.` }); + // } - // Remove id fields from nested objects for cloning - const cloneGroups = original.scorecardGroups.map((group: ScorecardGroupBaseDto) => ({ - ...group, - id: undefined, - createdAt: undefined, - updatedAt: undefined, - scorecardId: undefined, - sections: group.sections.map((section: ScorecardSectionBaseDto) => ({ - ...section, - id: undefined, - createdAt: undefined, - updatedAt: undefined, - scorecardGroupId: undefined, - questions: section.questions.map((question: ScorecardQuestionBaseDto) => ({ - ...question, - id: undefined, - createdAt: undefined, - updatedAt: undefined, - sectionId: undefined, - scorecardSectionId: undefined, - })), - })), - })); + // // Remove id fields from nested objects for cloning + // const cloneGroups = original.scorecardGroups.map( + // (group: ScorecardGroupBaseDto) => ({ + // ...group, + // id: undefined, + // createdAt: undefined, + // updatedAt: undefined, + // scorecardId: undefined, + // sections: group.sections.map((section: ScorecardSectionBaseDto) => ({ + // ...section, + // id: undefined, + // createdAt: undefined, + // updatedAt: undefined, + // scorecardGroupId: undefined, + // questions: section.questions.map( + // (question: ScorecardQuestionBaseDto) => ({ + // ...question, + // id: undefined, + // createdAt: undefined, + // updatedAt: undefined, + // sectionId: undefined, + // scorecardSectionId: undefined, + // }), + // ), + // })), + // }), + // ); - const clonedScorecard = await this.prisma.scorecard.create({ - data: { - ...original, - id: undefined, - name: `${original.name} (Clone)`, - createdAt: undefined, - updatedAt: undefined, - scorecardGroups: { - create: cloneGroups, - }, - }, - include: { - scorecardGroups: { - include: { - sections: { - include: { - questions: true, - }, - }, - }, - }, - }, - }); + // const clonedScorecard = await this.prisma.scorecard.create({ + // data: { + // ...original, + // id: undefined, + // name: `${original.name} (Clone)`, + // createdAt: undefined, + // updatedAt: undefined, + // scorecardGroups: { + // create: cloneGroups, + // }, + // }, + // include: { + // scorecardGroups: { + // include: { + // sections: { + // include: { + // questions: true, + // }, + // }, + // }, + // }, + // }, + // }); + const clonedScorecard = {}; return clonedScorecard as ScorecardResponseDto; }