je veux juste eviter les erreurs 500

This commit is contained in:
sdraris 2025-10-01 20:33:05 +02:00
parent ae75a79c2f
commit 80bc815d20

View File

@ -77,9 +77,7 @@ export class EnfantsService {
async findOne(id: string): Promise<Children> { async findOne(id: string): Promise<Children> {
const child = await this.childrenRepository.findOne({ const child = await this.childrenRepository.findOne({
where: { id }, where: { id },
relations: [ relations: ['parentLinks', 'parentLinks.parent'], // charge aussi le parent
'parentLinks',
],
}); });
if (!child) { if (!child) {
throw new NotFoundException(`Id d'enfant : ${id} introuvable`); throw new NotFoundException(`Id d'enfant : ${id} introuvable`);
@ -88,7 +86,6 @@ export class EnfantsService {
return child; return child;
} }
// Mettre à jour un enfant
// Mettre à jour un enfant // Mettre à jour un enfant
async update(id: string, dto: Partial<CreateEnfantsDto>): Promise<Children> { async update(id: string, dto: Partial<CreateEnfantsDto>): Promise<Children> {
const child = await this.childrenRepository.findOne({ where: { id } }); const child = await this.childrenRepository.findOne({ where: { id } });