delete removed from services for global reasons
This commit is contained in:
parent
4f4ca28682
commit
7d47fbd8de
@ -71,9 +71,4 @@ export class AssistantesMaternellesService {
|
||||
await this.assistantesMaternelleRepository.update(id, dto);
|
||||
return this.findOne(id);
|
||||
}
|
||||
|
||||
// Suppression
|
||||
async remove(id: string): Promise<void> {
|
||||
await this.assistantesMaternelleRepository.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,31 +60,28 @@ export class GestionnairesService {
|
||||
}
|
||||
|
||||
// Mise à jour d’un gestionnaire
|
||||
async update(id: string, dto: UpdateGestionnaireDto): Promise<Users | null> {
|
||||
async update(id: string, dto: UpdateGestionnaireDto): Promise<Users> {
|
||||
const gestionnaire = await this.findOne(id);
|
||||
if (!gestionnaire) throw new NotFoundException('Gestionnaire introuvable');
|
||||
|
||||
if (dto.password) {
|
||||
const salt = await bcrypt.genSalt();
|
||||
gestionnaire.password = await bcrypt.hash(dto.password, salt);
|
||||
delete (dto as any).password;
|
||||
}
|
||||
|
||||
if (dto.date_consentement_photo !== undefined) {
|
||||
gestionnaire.date_consentement_photo = dto.date_consentement_photo
|
||||
? new Date(dto.date_consentement_photo)
|
||||
: undefined;
|
||||
delete (dto as any).date_consentement_photo;
|
||||
}
|
||||
|
||||
Object.assign(gestionnaire, dto);
|
||||
const { password, date_consentement_photo, ...rest } = dto;
|
||||
Object.entries(rest).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
(gestionnaire as any)[key] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return this.gestionnaireRepository.save(gestionnaire);
|
||||
}
|
||||
|
||||
// Suppression d’un gestionnaire
|
||||
async remove(id: string): Promise<void> {
|
||||
const gestionnaire = await this.findOne(id);
|
||||
if (!gestionnaire) throw new NotFoundException('Gestionnaire introuvable');
|
||||
await this.gestionnaireRepository.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,9 +71,4 @@ export class ParentsService {
|
||||
await this.parentsRepository.update(id, dto);
|
||||
return this.findOne(id);
|
||||
}
|
||||
|
||||
// Suppression
|
||||
async remove(id: string): Promise<void> {
|
||||
await this.parentsRepository.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user