File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ COPY ./src/shared src/shared
1414RUN yarn prisma:generate
1515
1616EXPOSE 3001
17- CMD [ "sh", "-c", "yarn workspace backend dev" ]
17+ CMD [ "sh", "-c", "yarn workspace backend dev" ]
Original file line number Diff line number Diff line change @@ -699,20 +699,20 @@ export default class ReimbursementRequestService {
699699 if ( reimbursementRequest . organizationId !== organization . organizationId )
700700 throw new InvalidOrganizationException ( 'Reimbursement Request' ) ;
701701
702- try {
703- const reimbursementRequestWithSaboNumber = await prisma . reimbursement_Request . update ( {
704- where : { reimbursementRequestId } ,
705- data : {
706- saboId : saboNumber
707- }
708- } ) ;
709- return reimbursementRequestWithSaboNumber ;
710- } catch ( error : unknown ) {
711- if ( error instanceof Prisma . PrismaClientKnownRequestError && error . code === 'P2002' ) {
712- throw new HttpException ( 400 , 'This SABO number is already assigned to another reimbursement request.' ) ;
713- }
714- throw error ;
702+ const existingWithSaboNumber = await prisma . reimbursement_Request . findFirst ( {
703+ where : { saboId : saboNumber , organizationId : organization . organizationId }
704+ } ) ;
705+ if ( existingWithSaboNumber ) {
706+ throw new HttpException ( 400 , 'This SABO number is already assigned to another reimbursement request.' ) ;
715707 }
708+
709+ const reimbursementRequestWithSaboNumber = await prisma . reimbursement_Request . update ( {
710+ where : { reimbursementRequestId } ,
711+ data : {
712+ saboId : saboNumber
713+ }
714+ } ) ;
715+ return reimbursementRequestWithSaboNumber ;
716716 }
717717
718718 /**
You can’t perform that action at this time.
0 commit comments