Skip to content

fix(GIFT-22117): get UKEF industry code - legacy codes support#1815

Merged
tony-barnes-ukef merged 3 commits intomainfrom
fix/GIFT-22117
Apr 15, 2026
Merged

fix(GIFT-22117): get UKEF industry code - legacy codes support#1815
tony-barnes-ukef merged 3 commits intomainfrom
fix/GIFT-22117

Conversation

@tony-barnes-ukef
Copy link
Copy Markdown
Contributor

Introduction ✏️

Legacy industry codes was not working as expected.

This PR updates the ODS call to send a sic_section_code query param if the provided industry code is not an exact length.

Resolution ✔️

  • Update constants and DTOs.
  • Update odsService.findUkefIndustryCodeByCompaniesHouseCode.
  • Add/update tests.

Miscellaneous ➕

List any additional fixes or improvements.

Request / response 👀

Show/hide
 

Screenshot(s) 📸

Show/hide

Add screenshots here.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 13, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 8 duplication

Metric Results
Complexity 8
Duplication 8

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes lookup of UKEF industry codes for legacy Companies House SIC codes by switching the ODS stored procedure query parameter based on the input code length.

Changes:

  • Add legacy/modern SIC length constants under COMPANIES.INDUSTRY_CODE and remove the old COMPANIES_HOUSE.INDUSTRY_CODE constants.
  • Update OdsService.findUkefIndustryCodeByCompaniesHouseCode to query ODS using sic_industry_code for modern (5-digit) codes, otherwise sic_section_code.
  • Update DTO validation bounds and adjust API/unit tests accordingly.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/ods/ods.ukef-industries.api-test.ts Updates API tests to cover modern vs legacy industry code lengths and adjusted validation errors.
src/modules/ods/ods.service.ts Switches ODS query parameter key based on industry code length.
src/modules/ods/ods.service-findUkefIndustryCodeByCompaniesHouseCode.test.ts Expands unit tests for modern/legacy (and other) lengths, but currently asserts the wrong query param key for legacy paths.
src/modules/ods/dto/ods-payloads.dto.ts Adds sic_section_code to the allowed stored procedure query params type.
src/modules/ods/dto/get-ods-ukef-industry-code-param.dto.ts Updates validation to enforce min legacy length and max modern length using COMPANIES.INDUSTRY_CODE.
src/constants/examples/examples.constant.ts Updates the 4-digit Companies House industry code example value used in tests.
src/constants/companies.constant.ts Introduces INDUSTRY_CODE.LEGACY_LENGTH and .MODERN_LENGTH.
src/constants/companies-house.constant.ts Removes INDUSTRY_CODE length constants from COMPANIES_HOUSE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tony-barnes-ukef tony-barnes-ukef merged commit 79136ea into main Apr 15, 2026
22 checks passed
@tony-barnes-ukef tony-barnes-ukef deleted the fix/GIFT-22117 branch April 15, 2026 12:44
tony-barnes-ukef pushed a commit that referenced this pull request Apr 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.49.1](v1.49.0...v1.49.1)
(2026-04-15)


### Bug Fixes

* **GIFT-22117:** get UKEF industry code - legacy codes support
([#1815](#1815))
([79136ea](79136ea))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants