@@ -6,13 +6,13 @@ import {
6
6
import { Prisma } from '@prisma/client' ;
7
7
import {
8
8
mapScorecardRequestToDto ,
9
- ScorecardGroupBaseDto ,
9
+ // ScorecardGroupBaseDto,
10
10
ScorecardPaginatedResponseDto ,
11
11
ScorecardQueryDto ,
12
- ScorecardQuestionBaseDto ,
12
+ // ScorecardQuestionBaseDto,
13
13
ScorecardRequestDto ,
14
14
ScorecardResponseDto ,
15
- ScorecardSectionBaseDto ,
15
+ // ScorecardSectionBaseDto,
16
16
ScorecardWithGroupResponseDto ,
17
17
} from 'src/dto/scorecard.dto' ;
18
18
import { PrismaService } from 'src/shared/modules/global/prisma.service' ;
@@ -202,76 +202,79 @@ export class ScoreCardService {
202
202
} ;
203
203
}
204
204
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
+ // });
223
221
224
- if ( ! original ) {
225
- throw new NotFoundException ( { message : `Scorecard not found.` } ) ;
226
- }
222
+ // if (!original) {
223
+ // throw new NotFoundException({ message: `Scorecard not found.` });
224
+ // }
227
225
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
+ // );
251
253
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 = { } ;
275
278
276
279
return clonedScorecard as ScorecardResponseDto ;
277
280
}
0 commit comments