Skip to content

CHI-3585: Add Deactivated -> deletedAt mapping for USCH resources#992

Merged
stephenhand merged 7 commits intomasterfrom
CHI-3672-resources_deactivated_usch_flag
Jan 28, 2026
Merged

CHI-3585: Add Deactivated -> deletedAt mapping for USCH resources#992
stephenhand merged 7 commits intomasterfrom
CHI-3672-resources_deactivated_usch_flag

Conversation

@stephenhand
Copy link
Collaborator

Description

Add Deactivated -> deletedAt mapping for USCH resources

This should be all that's required to support deactivating resources for USCH so long as the input CSVs are updated to have a Deactivated column with a true / false value

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags / configuration added

Other Related Issues

None

Verification steps

AFTER YOU MERGE

  1. Cut a release tag using the GitHub workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

Copy link
Contributor

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 adds support for deactivating USCH resources by mapping a CSV Deactivated column to the deletedAt field in the resource model.

Changes:

  • Added Deactivated field (boolean) to the resource type definitions
  • Implemented CSV parsing logic to convert string 'true'/'false' values to boolean
  • Added mapping from Deactivated boolean to deletedAt timestamp field
  • Updated test fixtures and added test coverage for the new field

Reviewed changes

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

File Description
resources-domain/lambdas/s3-importer/src/uschMappings.ts Added Deactivated field to type definitions, implemented CSV-to-boolean parsing logic, and added mapping to deletedAt field
resources-domain/lambdas/s3-importer/tests/fixtures/sampleResources.ts Added Deactivated: '' to the empty CSV line fixture
resources-domain/lambdas/s3-importer/tests/unit/uschMappings.test.ts Added comprehensive tests for parsing Deactivated field and updated existing tests to include the new field

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

Comment on lines +221 to +223
Deactivated: resourceFieldMapping('deletedAt', context =>
context.currentValue ? new Date().toISOString() : '',
),
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Using new Date().toISOString() for the deletedAt timestamp means that every time a deactivated resource is re-imported from the CSV, it will get a new deletedAt timestamp. This could be problematic if the system expects deletedAt to represent the original deactivation time. Consider whether the mapping should preserve an existing deletedAt value, or if the CSV should include an actual DeactivatedDate field that can be mapped similar to how UpdatedOn is mapped from the CSV.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The deletedOn date is purely informational and doesn't drive any internal logic. The last time the resource was explicitly specified as deleted is fine for now

Comment on lines +221 to +223
Inactive: resourceFieldMapping('deletedAt', context =>
context.currentValue ? new Date().toISOString() : '',
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't get why if Inactive is a boolean above, here's is a "current timestamp"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the target field is deletedAt - but USCH want a simple flag, so we set deletedAt to the current time if inactive = true, or blank it out if false

@stephenhand stephenhand changed the title CHI-3672: Add Deactivated -> deletedAt mapping for USCH resources CHI-3585: Add Deactivated -> deletedAt mapping for USCH resources Jan 28, 2026
@stephenhand stephenhand merged commit 63937a4 into master Jan 28, 2026
18 checks passed
@stephenhand stephenhand deleted the CHI-3672-resources_deactivated_usch_flag branch January 28, 2026 15:48
@stephenhand stephenhand restored the CHI-3672-resources_deactivated_usch_flag branch February 5, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants