feat(backend): implement Relais module and relation with Gestionnaire (Ticket #94)
- Create Relais entity - Create Relais module, controller, service with CRUD - Update Users entity with ManyToOne relation to Relais - Update GestionnairesService to handle relaisId Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -41,19 +41,24 @@ export class GestionnairesService {
|
||||
: undefined,
|
||||
changement_mdp_obligatoire: dto.changement_mdp_obligatoire ?? false,
|
||||
role: RoleType.GESTIONNAIRE,
|
||||
relaisId: dto.relaisId,
|
||||
});
|
||||
return this.gestionnaireRepository.save(entity);
|
||||
}
|
||||
|
||||
// Liste des gestionnaires
|
||||
async findAll(): Promise<Users[]> {
|
||||
return this.gestionnaireRepository.find({ where: { role: RoleType.GESTIONNAIRE } });
|
||||
return this.gestionnaireRepository.find({
|
||||
where: { role: RoleType.GESTIONNAIRE },
|
||||
relations: ['relais'],
|
||||
});
|
||||
}
|
||||
|
||||
// Récupérer un gestionnaire par ID
|
||||
async findOne(id: string): Promise<Users> {
|
||||
const gestionnaire = await this.gestionnaireRepository.findOne({
|
||||
where: { id, role: RoleType.GESTIONNAIRE },
|
||||
relations: ['relais'],
|
||||
});
|
||||
if (!gestionnaire) throw new NotFoundException('Gestionnaire introuvable');
|
||||
return gestionnaire;
|
||||
|
||||
Reference in New Issue
Block a user