Skip to content

Commit

Permalink
Merge pull request #9 from tekdi/v0.1.4
Browse files Browse the repository at this point in the history
Merge V0.1.4 to main
  • Loading branch information
sudeeppr1998 authored Nov 26, 2024
2 parents 84ed599 + 6256a48 commit 70a990b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/modules/user-docs/user-docs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ export class UserDocsService {
errorMessage: `Document with doc_id ${createUserDocDto.doc_id} already exists`,
});
}
const checkAadhaarExist = await this.userDocsRepository.findOne({
where: { sso_id: ssoId , doc_subtype:'aadhaar' },
});
if(checkAadhaarExist && createUserDocDto.doc_subtype==="aadhaar" ) {
return new ErrorResponse({
statusCode: 409,
errorMessage: `Aadhaar already added to wallet`,
});
}
if (!checkAadhaarExist && createUserDocDto.doc_subtype!=="aadhaar") {
return new ErrorResponse({
statusCode: 400,
errorMessage: `Please add Aadhaar first before adding any other document to wallet`,
});
}

const userDoc = this.userDocsRepository.create({...createUserDocDto,sso_id:ssoId});
await this.userDocsRepository.save(userDoc);
Expand Down

0 comments on commit 70a990b

Please sign in to comment.