drod1107 / next-fresh-crm

The fastest, easiest, lightest weight CRM in Next JS 14, built on lessons working with NextCRM
https://next-fresh-crm.vercel.app
0 stars 0 forks source link

BUG - Docs once uploaded cannot be viewed or downloaded #6

Open drod1107 opened 6 days ago

drod1107 commented 6 days ago

Currently docs has an upload route that allows a POST request - we need to add api routes and logic to allow the frontend user to click a link that is the name of the file and view the file in a new browser window, and another that allows the user to click a "Download" button and save the file to user local machine.

drod1107 commented 6 days ago

Docs view also displays no documents - likely due to no api route for GET requests to get ALL records or to sort or query.

drod1107 commented 6 days ago

Updated code to successfully upload docs, display the list of docs correctly.

Currently, attempting to view still only launches a new browser tab and displays nothing. Cause appears to be that the value of "url" being assigned to the data object in the DB is essentially the file name as it is assigned in S3, not the full S3 url.

The good news is that the standardized access path for public display documents is S3://{{BUCKET_NAME}}/{{FILENAME}}, so we can correct this easily but need to avoid shortcutting and just using the s3 as a link on the frontend because these docs have to be auth protected in some way due to the sensitive nature of potential docs in storage.