File tree Expand file tree Collapse file tree
apps/api/src/instrument-records Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,30 +339,6 @@ export class InstrumentRecordsService {
339339 }
340340 }
341341
342- private async createSubjectIfNotFound ( subjectId : string ) {
343- try {
344- return await this . subjectsService . findById ( subjectId ) ;
345- } catch ( exception ) {
346- if ( exception instanceof NotFoundException ) {
347- const addedSubject : CreateSubjectDto = {
348- id : subjectId
349- } ;
350- try {
351- return await this . subjectsService . create ( addedSubject ) ;
352- } catch ( prismaError ) {
353- if ( prismaError instanceof Prisma . PrismaClientKnownRequestError && prismaError . code === 'P2002' ) {
354- console . error ( prismaError ) ;
355- return await this . subjectsService . findById ( subjectId ) ;
356- } else {
357- throw prismaError ;
358- }
359- }
360- } else {
361- throw exception ;
362- }
363- }
364- }
365-
366342 private parseJson ( data : unknown ) {
367343 return JSON . parse ( JSON . stringify ( data ) , reviver ) as unknown ;
368344 }
You can’t perform that action at this time.
0 commit comments