Skip to content

Commit a8553b6

Browse files
committed
Update identities-crud.service.ts
1 parent e1c1281 commit a8553b6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/management/identities/identities-crud.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ export class IdentitiesCrudService extends AbstractIdentitiesService {
1313
): Promise<Document<T, any, T>> {
1414
data = this.transformNullsToString(data);
1515
await this.checkInetOrgPersonJpegPhoto(data);
16+
//recherche si email oy uid deja present
17+
const f:any = { $or: [{ 'inetOrgPerson.uid' : data.inetOrgPerson.uid}, {'inetOrgPerson.mail': data.inetOrgPerson.mail }]};
18+
let dataDup = await this._model.countDocuments(f).exec()
19+
if (dataDup > 0){
20+
this.logger.error('Identité existante');
21+
throw new HttpException("Uid ou mail déjà présent dans une autre identité", 400);
22+
}
1623
const created: Document<T, any, T> = await super.create(data, options);
1724
return created;
1825
}

0 commit comments

Comments
 (0)