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,
|
name: dto.name,
|
||||||
type: dto.type,
|
type: dto.type,
|
||||||
scac: dto.scac,
|
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),
|
address: OrganizationMapper.mapDtoToAddress(dto.address),
|
||||||
logoUrl: dto.logoUrl,
|
logoUrl: dto.logoUrl,
|
||||||
documents: [],
|
documents: [],
|
||||||
|
|||||||
@ -104,16 +104,21 @@ export class CreateOrganizationDto {
|
|||||||
@ApiPropertyOptional({
|
@ApiPropertyOptional({
|
||||||
example: '123456789',
|
example: '123456789',
|
||||||
description: 'French SIREN number (9 digits)',
|
description: 'French SIREN number (9 digits)',
|
||||||
minLength: 9,
|
|
||||||
maxLength: 9,
|
|
||||||
})
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@MinLength(9)
|
|
||||||
@MaxLength(9)
|
|
||||||
@Matches(/^[0-9]{9}$/, { message: 'SIREN must be 9 digits' })
|
@Matches(/^[0-9]{9}$/, { message: 'SIREN must be 9 digits' })
|
||||||
siren?: string;
|
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({
|
@ApiPropertyOptional({
|
||||||
example: 'FR123456789',
|
example: 'FR123456789',
|
||||||
description: 'EU EORI number',
|
description: 'EU EORI number',
|
||||||
@ -174,26 +179,18 @@ export class UpdateOrganizationDto {
|
|||||||
@ApiPropertyOptional({
|
@ApiPropertyOptional({
|
||||||
example: '123456789',
|
example: '123456789',
|
||||||
description: 'French SIREN number (9 digits)',
|
description: 'French SIREN number (9 digits)',
|
||||||
minLength: 9,
|
|
||||||
maxLength: 9,
|
|
||||||
})
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@MinLength(9)
|
|
||||||
@MaxLength(9)
|
|
||||||
@Matches(/^[0-9]{9}$/, { message: 'SIREN must be 9 digits' })
|
@Matches(/^[0-9]{9}$/, { message: 'SIREN must be 9 digits' })
|
||||||
siren?: string;
|
siren?: string;
|
||||||
|
|
||||||
@ApiPropertyOptional({
|
@ApiPropertyOptional({
|
||||||
example: '12345678901234',
|
example: '12345678901234',
|
||||||
description: 'French SIRET number (14 digits)',
|
description: 'French SIRET number (14 digits)',
|
||||||
minLength: 14,
|
|
||||||
maxLength: 14,
|
|
||||||
})
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@MinLength(14)
|
|
||||||
@MaxLength(14)
|
|
||||||
@Matches(/^[0-9]{14}$/, { message: 'SIRET must be 14 digits' })
|
@Matches(/^[0-9]{14}$/, { message: 'SIRET must be 14 digits' })
|
||||||
siret?: string;
|
siret?: string;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user