Skip to content

Commit 2ffde02

Browse files
committed
refactor: remove unused creatSubjectIfNotFound function
1 parent dca4804 commit 2ffde02

1 file changed

Lines changed: 0 additions & 24 deletions

File tree

apps/api/src/instrument-records/instrument-records.service.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)