delete removed from services for global reasons

This commit is contained in:
sdraris 2025-09-19 11:57:40 +02:00
parent 4f4ca28682
commit 7d47fbd8de
3 changed files with 8 additions and 21 deletions

View File

@ -71,9 +71,4 @@ export class AssistantesMaternellesService {
await this.assistantesMaternelleRepository.update(id, dto); await this.assistantesMaternelleRepository.update(id, dto);
return this.findOne(id); return this.findOne(id);
} }
// Suppression
async remove(id: string): Promise<void> {
await this.assistantesMaternelleRepository.delete(id);
}
} }

View File

@ -60,31 +60,28 @@ export class GestionnairesService {
} }
// Mise à jour dun gestionnaire // Mise à jour dun gestionnaire
async update(id: string, dto: UpdateGestionnaireDto): Promise<Users | null> { async update(id: string, dto: UpdateGestionnaireDto): Promise<Users> {
const gestionnaire = await this.findOne(id); const gestionnaire = await this.findOne(id);
if (!gestionnaire) throw new NotFoundException('Gestionnaire introuvable');
if (dto.password) { if (dto.password) {
const salt = await bcrypt.genSalt(); const salt = await bcrypt.genSalt();
gestionnaire.password = await bcrypt.hash(dto.password, salt); gestionnaire.password = await bcrypt.hash(dto.password, salt);
delete (dto as any).password;
} }
if (dto.date_consentement_photo !== undefined) { if (dto.date_consentement_photo !== undefined) {
gestionnaire.date_consentement_photo = dto.date_consentement_photo gestionnaire.date_consentement_photo = dto.date_consentement_photo
? new Date(dto.date_consentement_photo) ? new Date(dto.date_consentement_photo)
: undefined; : 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); return this.gestionnaireRepository.save(gestionnaire);
} }
// Suppression dun 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);
}
} }

View File

@ -71,9 +71,4 @@ export class ParentsService {
await this.parentsRepository.update(id, dto); await this.parentsRepository.update(id, dto);
return this.findOne(id); return this.findOne(id);
} }
// Suppression
async remove(id: string): Promise<void> {
await this.parentsRepository.delete(id);
}
} }