diff --git a/api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts b/api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts index 33bc714cf..f82a6f1f7 100644 --- a/api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts +++ b/api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts @@ -430,22 +430,22 @@ export class CreateScenarioInterventionDtoV2 { newIndicatorCoefficients?: IndicatorCoefficientsDtoV2; @IsUUID() - @IsOptional() - @ApiPropertyOptional({ + @IsNotEmpty() + @ApiProperty({ description: `Id of the New Supplier`, type: String, example: 'bc5e4933-cd9a-4afc-bd53-56941b8adc111', }) - newT1SupplierId?: string; + newT1SupplierId!: string; @IsUUID() - @IsOptional() - @ApiPropertyOptional({ + @IsNotEmpty() + @ApiProperty({ description: `Id of the New Producer`, type: String, example: 'bc5e4933-cd9a-4afc-bd53-56941b8adc222', }) - newProducerId?: string; + newProducerId!: string; @ValidateIf( (dto: CreateScenarioInterventionDto) => diff --git a/api/src/modules/sourcing-locations/dto/sourcing-location-with-record.interface.ts b/api/src/modules/sourcing-locations/dto/sourcing-location-with-record.interface.ts deleted file mode 100644 index a04f4aaa7..000000000 --- a/api/src/modules/sourcing-locations/dto/sourcing-location-with-record.interface.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { SourcingLocation } from 'modules/sourcing-locations/sourcing-location.entity'; - -export interface SourcingLocationWithRecord extends SourcingLocation { - year: number; - tonnage: number; -} diff --git a/api/src/modules/sourcing-locations/sourcing-location.entity.ts b/api/src/modules/sourcing-locations/sourcing-location.entity.ts index 79a3b0cca..f489adc0b 100644 --- a/api/src/modules/sourcing-locations/sourcing-location.entity.ts +++ b/api/src/modules/sourcing-locations/sourcing-location.entity.ts @@ -170,7 +170,7 @@ export class SourcingLocation extends TimestampedBaseEntity { t1Supplier: Supplier; @Index() - @Column({ nullable: true }) + @Column() t1SupplierId?: string; @ManyToOne( @@ -185,7 +185,7 @@ export class SourcingLocation extends TimestampedBaseEntity { producer: Supplier; @Index() - @Column({ nullable: true }) + @Column() producerId?: string; @ManyToOne( diff --git a/api/test/entity-mocks.ts b/api/test/entity-mocks.ts index c9ac136e0..27f195e5d 100644 --- a/api/test/entity-mocks.ts +++ b/api/test/entity-mocks.ts @@ -366,6 +366,7 @@ async function createSourcingLocation( additionalData: Partial = {}, ): Promise { const material: Material = await createMaterial(); + const defaultData: DeepPartial = { title: 'test sourcing location', locationAddressInput: 'pqrst', diff --git a/api/test/integration/import-data/xlsx-uploads/files/test-base-dataset.xlsx b/api/test/integration/import-data/xlsx-uploads/files/test-base-dataset.xlsx index d4514bc36..631872351 100644 Binary files a/api/test/integration/import-data/xlsx-uploads/files/test-base-dataset.xlsx and b/api/test/integration/import-data/xlsx-uploads/files/test-base-dataset.xlsx differ diff --git a/api/test/integration/import-data/xlsx-uploads/sourcing-data-import.spec.ts b/api/test/integration/import-data/xlsx-uploads/sourcing-data-import.spec.ts index 688ee8569..65899beef 100644 --- a/api/test/integration/import-data/xlsx-uploads/sourcing-data-import.spec.ts +++ b/api/test/integration/import-data/xlsx-uploads/sourcing-data-import.spec.ts @@ -324,9 +324,9 @@ describe('Sourcing Data import', () => { expect(businessUnitsRoots).toHaveLength(1); const suppliers: Supplier[] = await supplierRepository.find(); - expect(suppliers).toHaveLength(5); + expect(suppliers).toHaveLength(6); const suppliersRoots: Supplier[] = await supplierRepository.findRoots(); - expect(suppliersRoots).toHaveLength(4); + expect(suppliersRoots).toHaveLength(5); const sourcingRecords: SourcingRecord[] = await sourcingRecordRepository.find();