Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Verification statement upload part 2 #2196

Closed
6 tasks done
dleard opened this issue Apr 17, 2023 · 5 comments
Closed
6 tasks done

Verification statement upload part 2 #2196

dleard opened this issue Apr 17, 2023 · 5 comments

Comments

@dleard
Copy link
Contributor

dleard commented Apr 17, 2023

This card is a continuation of #2126. The initial work of allowing uploads was completed, but there were some outstanding issues that needed solving before it could be considered complete. The incomplete work was merged to unblock #2181.

Issues to be resolved by this card:

  • hard delete should also delete the file from GCS. We should be able to use this package to handle that
  • attachments that were created in a previous revision should not be deleted, only shown for history
  • uploads should have constraints on the type / size of files allowed

For the constraints, we should have some info text that tells the user the format and size requirements. We also have a react-toastify package that can show some pop-up errors with messages about type/size if they attempt to upload something that doesn't satisfy our constraints.

Acceptance Criteria:

  • when hard-deleting a file, it is removed from the GCS bucket as well as the database. The file should be deleted first from GCS, and on success deleted from the database
  • attachments that were created in previous revisions should not be deletable
  • attachments that were created in previous revisions should be shown in a table on the production tab with the filename, upload date & version number
  • the latest uploaded verification attachment in the table should stand out in the table (perhaps a different row background colour)
  • uploaded files can only be of type application/pdf
  • uploaded files can not exceed 50mb
@dleard dleard added Backlog Refinement Issues to look at during backlog refinement. User Story A User Story issue type Tech Debt and removed User Story A User Story issue type Backlog Refinement Issues to look at during backlog refinement. labels Apr 17, 2023
@pbastia pbastia added the Backlog Refinement Issues to look at during backlog refinement. label Apr 18, 2023
@BCerki
Copy link
Contributor

BCerki commented Apr 20, 2023

There's a bug right now where you can't upload more than one attachment. It's because of the unique index on the attachment table:

{"errors":[{"errcode":"23505","extensions":{"exception":{"errcode":"23505"}},"message":"duplicate key value violates unique constraint \"attachment_application_id_version_number_key\"","locations":[{"line":4,"column":3}],"path":["createAttachment"],"stack":["error: duplicate key value violates unique constraint \"attachment_application_id_version_number_key\"","    at Parser.parseErrorMessage (/home/briannacerkiewicz/cas-ciip-portal/app/node_modules/pg-protocol/dist/parser.js:278:15)","    at Parser.handlePacket (/home/briannacerkiewicz/cas-ciip-portal/app/node_modules/pg-protocol/dist/parser.js:126:29)","    at Parser.parse (/home/briannacerkiewicz/cas-ciip-portal/app/node_modules/pg-protocol/dist/parser.js:39:38)","    at Socket.<anonymous> (/home/briannacerkiewicz/cas-ciip-portal/app/node_modules/pg-protocol/dist/index.js:10:42)","    at Socket.emit (events.js:400:28)","    at Socket.emit (domain.js:475:12)","    at addChunk (internal/streams/readable.js:293:12)","    at readableAddChunk (internal/streams/readable.js:267:9)","    at Socket.Readable.push (internal/streams/readable.js:206:10)","    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)"]}],"data":{"createAttachment":null}}

Could be fixed as part of this PR

@pbastia
Copy link
Contributor

pbastia commented May 10, 2023

@BCerki I'm getting an "Internal Server Error" message when deleting an attachment - would you mind walking me through this?

@BCerki
Copy link
Contributor

BCerki commented May 10, 2023

@pbastia , seems to be at least partly an nginx thing, will look at it tomorrow with dleard

@pbastia
Copy link
Contributor

pbastia commented May 10, 2023

Thank you @BCerki ! We might want to put this card back in the development column then

@pbastia
Copy link
Contributor

pbastia commented May 15, 2023

Everything works very smoothly @BCerki ! Thanks so much for the hard work.

@dleard dleard closed this as completed May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants