fix: allow org creation without SIRET/SIREN and pass all DTO fields to entity
This commit is contained in:
parent
0e6383693c
commit
aa301eb447
@ -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: [],
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user