Skip to content

BDMS-27: Asset upload for well inventory#76

Merged
jirhiker merged 9 commits into
pre-productionfrom
cm-asset-refactor
Aug 4, 2025
Merged

BDMS-27: Asset upload for well inventory#76
jirhiker merged 9 commits into
pre-productionfrom
cm-asset-refactor

Conversation

@chasetmartin

Copy link
Copy Markdown
Collaborator

Why

This PR addresses the following problem / context:

  • The asset step was a placeholder in the well inventory form
  • This PR makes a CreateEditAsset form component that can be reused
  • SEE IMPORTANT NOTE BELOW

How

Implementation summary - the following was changed / added / removed:

  • CreateEditAsset form component is reused on Create.tsx, Edit.tsx, and the well inventory form
  • The upload code is still the same has before - this should be refactored in the future to allow:
  1. uploads only on submit, not on file selection
  2. asset uploads linked directly to a thing_id - this is not currently handled in the api

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Since the asset upload occurs on file selection, there is the chance for a user to choose/upload a file, click remove asset, and then choose a different file that is also uploaded. The submit/save action will only send the POST /asset with the desired asset (the one that wasn't removed from the form). However - the initial asset upload that was "removed" from the form before submission still stays in the google cloud bucket, but is orphaned with no stored reference url in the database. This should be refactored before this app moves to beta!

@jirhiker

jirhiker commented Aug 4, 2025

Copy link
Copy Markdown
Member

WRT the note, and release before beta, what are the consequences of an orphaned file in the storage bucket?

@jirhiker jirhiker merged commit 23ed247 into pre-production Aug 4, 2025
1 check passed
@chasetmartin

Copy link
Copy Markdown
Collaborator Author

@jirhiker I don't think it's really an issue honestly. It's more important that the asset in the DB is updated properly, which it is. And if we change the forms to upload the asset on submission then it will basically become impossible to do.

@chasetmartin chasetmartin deleted the cm-asset-refactor branch September 16, 2025 18:20
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.

2 participants