Verification statement upload part 2
Closed this issue · 5 comments
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
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
@BCerki I'm getting an "Internal Server Error" message when deleting an attachment - would you mind walking me through this?
@pbastia , seems to be at least partly an nginx thing, will look at it tomorrow with dleard