Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore(APIM-612): companies house - isactive field #1182

Merged
merged 2 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/constants/companies.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ export const COMPANIES = {
// This Companies House registration number regex was copied from the DTFS codebase.
COMPANIES_HOUSE_REGISTRATION_NUMBER: /^(([A-Z]{2}|[A-Z]\d|\d{2})(\d{6}|\d{5}[A-Z]))$/,
},
STATUS: {
ACTIVE: 'active',
},
};
2 changes: 2 additions & 0 deletions src/modules/companies/companies.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable, NotFoundException, UnprocessableEntityException } from '@nestjs/common';
import { COMPANIES } from '@ukef/constants';
import { CompaniesHouseService } from '@ukef/helper-modules/companies-house/companies-house.service';
import { GetCompanyCompaniesHouseResponse } from '@ukef/helper-modules/companies-house/dto/get-company-companies-house-response.dto';
import { CompaniesHouseNotFoundException } from '@ukef/helper-modules/companies-house/exception/companies-house-not-found.exception';
Expand Down Expand Up @@ -84,6 +85,7 @@ export class CompaniesService {
region: address?.region,
},
industries: this.mapSicCodes(company.sic_codes, industryClasses),
isActive: company?.company_status === COMPANIES.STATUS.ACTIVE,
};
}

Expand Down
1 change: 1 addition & 0 deletions src/modules/companies/dto/get-company-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class GetCompanyResponse {
dateOfCreation: string;
registeredAddress: RegisteredAddress;
industries: Industry[];
isActive: boolean;
}

export class Industry {
Expand Down
3 changes: 3 additions & 0 deletions test/support/generator/get-company-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
],
industrySectorCode: this.valueGenerator.integer({ min: 1001, max: 1020 }),
industrySectorName: this.valueGenerator.sentence({ words: 4 }),
isActive: this.valueGenerator.boolean(),
};
}

Expand All @@ -78,7 +79,7 @@
const shuffleArray = <T>(array: Array<T>) => {
for (const i of [...Array(array.length).keys()].reverse().slice(0, -1)) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];

Check warning on line 82 in test/support/generator/get-company-generator.ts

View workflow job for this annotation

GitHub Actions / Scanning 🎨

Generic Object Injection Sink

Check warning on line 82 in test/support/generator/get-company-generator.ts

View workflow job for this annotation

GitHub Actions / Scanning 🎨

Generic Object Injection Sink

Check warning on line 82 in test/support/generator/get-company-generator.ts

View workflow job for this annotation

GitHub Actions / Scanning 🎨

Generic Object Injection Sink

Check warning on line 82 in test/support/generator/get-company-generator.ts

View workflow job for this annotation

GitHub Actions / Scanning 🎨

Generic Object Injection Sink
}
};

Expand Down Expand Up @@ -150,7 +151,7 @@
ukefSectorName: v.industrySectorName,
internalNo: null,
ukefIndustryId: sicCode,
ukefIndustryName: v.industryClassNames[index],

Check warning on line 154 in test/support/generator/get-company-generator.ts

View workflow job for this annotation

GitHub Actions / Scanning 🎨

Generic Object Injection Sink
acbsSectorId: this.valueGenerator.stringOfNumericCharacters({ length: 2 }),
acbsSectorName: this.valueGenerator.sentence({ words: 5 }),
acbsIndustryId: this.valueGenerator.stringOfNumericCharacters({ length: 2 }),
Expand Down Expand Up @@ -228,6 +229,7 @@
country: v.country,
},
industries,
isActive: v.isActive,
};

const getCompanyCompaniesHouseOverseasCompanyResponse = structuredClone(getCompanyCompaniesHouseResponse);
Expand Down Expand Up @@ -297,6 +299,7 @@
industryClassNames: string[];
industrySectorCode: number;
industrySectorName: string;
isActive: boolean;
}

interface GenerateOptions {
Expand Down
Loading