diff --git a/backend/src/entities/users.entity.ts b/backend/src/entities/users.entity.ts index 3f74dc5..649ddda 100644 --- a/backend/src/entities/users.entity.ts +++ b/backend/src/entities/users.entity.ts @@ -81,7 +81,7 @@ export class Users { type: 'enum', enum: StatutUtilisateurType, enumName: 'statut_utilisateur_type', // correspond à l'enum de la db psql - default: StatutUtilisateurType.EN_ATTENTE, + default: StatutUtilisateurType.ACTIF, name: 'statut' }) statut: StatutUtilisateurType; diff --git a/backend/src/routes/user/dto/create_gestionnaire.dto.ts b/backend/src/routes/user/dto/create_gestionnaire.dto.ts index cea3687..0796c1e 100644 --- a/backend/src/routes/user/dto/create_gestionnaire.dto.ts +++ b/backend/src/routes/user/dto/create_gestionnaire.dto.ts @@ -2,7 +2,7 @@ import { ApiProperty, OmitType } from "@nestjs/swagger"; import { CreateUserDto } from "./create_user.dto"; import { IsOptional, IsUUID } from "class-validator"; -export class CreateGestionnaireDto extends OmitType(CreateUserDto, ['role', 'adresse'] as const) { +export class CreateGestionnaireDto extends OmitType(CreateUserDto, ['role', 'adresse', 'genre', 'statut', 'situation_familiale', 'ville', 'code_postal', 'photo_url', 'consentement_photo', 'date_consentement_photo', 'changement_mdp_obligatoire'] as const) { @ApiProperty({ required: false, description: 'ID du relais de rattachement' }) @IsOptional() @IsUUID() diff --git a/backend/src/routes/user/gestionnaires/gestionnaires.service.ts b/backend/src/routes/user/gestionnaires/gestionnaires.service.ts index a8fa5a9..45ccaf0 100644 --- a/backend/src/routes/user/gestionnaires/gestionnaires.service.ts +++ b/backend/src/routes/user/gestionnaires/gestionnaires.service.ts @@ -5,7 +5,7 @@ import { } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; -import { RoleType, Users } from 'src/entities/users.entity'; +import { RoleType, StatutUtilisateurType, Users } from 'src/entities/users.entity'; import { CreateGestionnaireDto } from '../dto/create_gestionnaire.dto'; import { UpdateGestionnaireDto } from '../dto/update_gestionnaire.dto'; import * as bcrypt from 'bcrypt'; @@ -32,16 +32,17 @@ export class GestionnairesService { password: hashedPassword, prenom: dto.prenom, nom: dto.nom, - genre: dto.genre, - statut: dto.statut, + // genre: dto.genre, // Retiré + // statut: dto.statut, // Retiré + statut: StatutUtilisateurType.ACTIF, telephone: dto.telephone, - // adresse: dto.adresse, // Adresse retirée du formulaire de création - photo_url: dto.photo_url, - consentement_photo: dto.consentement_photo ?? false, - date_consentement_photo: dto.date_consentement_photo - ? new Date(dto.date_consentement_photo) - : undefined, - changement_mdp_obligatoire: true, // Forcé à true pour les nouveaux gestionnaires + // adresse: dto.adresse, // Retiré + // photo_url: dto.photo_url, // Retiré + // consentement_photo: dto.consentement_photo ?? false, // Retiré + // date_consentement_photo: dto.date_consentement_photo // Retiré + // ? new Date(dto.date_consentement_photo) + // : undefined, + changement_mdp_obligatoire: true, role: RoleType.GESTIONNAIRE, relaisId: dto.relaisId, });