From aa301eb4479ef5eb503fa9df8af7688043e3194e Mon Sep 17 00:00:00 2001 From: David Date: Sun, 7 Jun 2026 18:02:51 +0200 Subject: [PATCH] fix: allow org creation without SIRET/SIREN and pass all DTO fields to entity --- .../controllers/organizations.controller.ts | 5 +++++ .../src/application/dto/organization.dto.ts | 21 ++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/backend/src/application/controllers/organizations.controller.ts b/apps/backend/src/application/controllers/organizations.controller.ts index d9ec42f..cb4d752 100644 --- a/apps/backend/src/application/controllers/organizations.controller.ts +++ b/apps/backend/src/application/controllers/organizations.controller.ts @@ -123,6 +123,11 @@ export class OrganizationsController { name: dto.name, type: dto.type, scac: dto.scac, + siren: dto.siren, + siret: dto.siret, + eori: dto.eori, + contact_phone: dto.contact_phone, + contact_email: dto.contact_email, address: OrganizationMapper.mapDtoToAddress(dto.address), logoUrl: dto.logoUrl, documents: [], diff --git a/apps/backend/src/application/dto/organization.dto.ts b/apps/backend/src/application/dto/organization.dto.ts index 130a53b..2dfe143 100644 --- a/apps/backend/src/application/dto/organization.dto.ts +++ b/apps/backend/src/application/dto/organization.dto.ts @@ -104,16 +104,21 @@ export class CreateOrganizationDto { @ApiPropertyOptional({ example: '123456789', description: 'French SIREN number (9 digits)', - minLength: 9, - maxLength: 9, }) @IsString() @IsOptional() - @MinLength(9) - @MaxLength(9) @Matches(/^[0-9]{9}$/, { message: 'SIREN must be 9 digits' }) siren?: string; + @ApiPropertyOptional({ + example: '12345678901234', + description: 'French SIRET number (14 digits)', + }) + @IsString() + @IsOptional() + @Matches(/^[0-9]{14}$/, { message: 'SIRET must be 14 digits' }) + siret?: string; + @ApiPropertyOptional({ example: 'FR123456789', description: 'EU EORI number', @@ -174,26 +179,18 @@ export class UpdateOrganizationDto { @ApiPropertyOptional({ example: '123456789', description: 'French SIREN number (9 digits)', - minLength: 9, - maxLength: 9, }) @IsString() @IsOptional() - @MinLength(9) - @MaxLength(9) @Matches(/^[0-9]{9}$/, { message: 'SIREN must be 9 digits' }) siren?: string; @ApiPropertyOptional({ example: '12345678901234', description: 'French SIRET number (14 digits)', - minLength: 14, - maxLength: 14, }) @IsString() @IsOptional() - @MinLength(14) - @MaxLength(14) @Matches(/^[0-9]{14}$/, { message: 'SIRET must be 14 digits' }) siret?: string;