Skip to content

Conversation

@frano-m
Copy link
Contributor

@frano-m frano-m commented Oct 28, 2025

Closes #4575.

This pull request updates how file download URLs are handled in both the Anvil-CMG and HCA-DCP entities and view model builders. The main change is replacing the previous url property with a new azul_url property to standardize access to file download links.

Entity interface updates:

  • Replaced the url property with azul_url in the FileEntity interface in app/apis/azul/anvil-cmg/common/entities.ts to reflect the new naming convention. [1] [2]
  • Replaced the url property with azul_url in the FileResponse interface in app/apis/azul/hca-dcp/common/entities.ts for consistency across APIs. [1] [2]

View model builder updates:

  • Updated buildFileDownload in app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts to use the new azul_url property instead of url when constructing file download objects.
  • Updated buildFileDownload in app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts to use azul_url instead of url, ensuring the view models reference the correct property.

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 pull request standardizes file download URL handling across the codebase by replacing the url property with azul_url in both Anvil-CMG and HCA-DCP implementations. This change ensures consistent naming conventions for accessing file download links throughout the application.

Key changes:

  • Updated entity interface definitions to use azul_url instead of url
  • Modified view model builders to reference the new azul_url property when constructing file download objects

Reviewed Changes

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

File Description
app/apis/azul/anvil-cmg/common/entities.ts Updated FileEntity interface to replace url with azul_url property
app/apis/azul/hca-dcp/common/entities.ts Updated FileResponse interface to replace url with azul_url property
app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts Modified buildFileDownload function to reference azul_url instead of url
app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts Modified buildFileDownload function to reference azul_url instead of url

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

*/
export interface FileResponse {
accessible: boolean;
azul_url: string;
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The new azul_url property is defined as non-nullable string, while the removed url property was string | null. If the API can return null values for this field, this type definition could cause runtime errors. Verify the API response guarantees a non-null value, or update the type to string | null to maintain backward compatibility.

Suggested change
azul_url: string;
azul_url: string | null;

Copilot uses AI. Check for mistakes.
*/
export interface FileEntity {
accessible: boolean;
azul_url: string;
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The new azul_url property is defined as non-nullable string, while the removed url property was also string. Consider whether this field should allow null values for consistency with the HCA-DCP implementation, especially if the underlying API might not always provide a URL.

Suggested change
azul_url: string;
azul_url: string | null;

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

Choose a reason for hiding this comment

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

@MillenniumFalconMechanic HCA had a TODO comment regarding the url property (whether null was a possible value). I'm happy to type azule_url as string | null if you think it is appropriate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting; there must be downstream handling (i.e. type narrowing) on the possible null values? Let's keep it as it was (string | null) but remove the TODO comments.

file_name: string;
file_size: number;
file_type: string;
url: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed url to ensure it isn't used accidentally (generates TS error if it is).

Copy link
Contributor

@MillenniumFalconMechanic MillenniumFalconMechanic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks F! Two follow-ups before we merge:

  1. See my comment regarding string | null.
  2. I've eyeballed the code but can you confirm LungMAP inherits these updates from HCA?

@MillenniumFalconMechanic MillenniumFalconMechanic merged commit dbaa7a1 into main Nov 3, 2025
3 checks passed
@MillenniumFalconMechanic MillenniumFalconMechanic deleted the fran/4575-files branch November 3, 2025 20:25
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.

Switch from files.url to files.azul_url

3 participants