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

add offlines and s3 integration #683

Merged
merged 33 commits into from
Nov 10, 2023

Conversation

henrikskog
Copy link
Contributor

@henrikskog henrikskog commented Oct 30, 2023

What's in this PR

  • Use s3 to store offline pdfs and front page images.
  • Use our postgres database for storing:
    • Title
    • Publish date
    • Url to pdf in s3
    • Url to image in s3
  • Let's users upload/edit the database records from the dashboard
  • Handles uploading of pdfs/images straight from the dashboard
  • Does not do vaildation on file types

Use https://www.npmjs.com/package/@aws-sdk/s3-presigned-post for generating presigned values that lets users upload to s3 without credentials.

  • It needs a s3 client from @aws-sdk/client-s3, so that is also installed

Other stuff

  • Fixed a bug in user-repository where method signature for update was set to | undefined

Notes

  • A new env variable for the bucket to used is created S3_BUCKET_MONOWEB.
  • All existing offlines are migrated from Sanity to dev.cdn.online.ntnu.no
  • I just created the most basic UI for file uploading, but it's kinda lacking in UX. I'm willing to work on this on suggestions on to how to improve it. All the functionality is there now though.

For the future

  • Sanity had a really nice UI for cropping the images which was used for the front page image. Right now, we just let users upload files directly. Prokom/us/whoever uploads new offlines can just edit the image on their computer to the correct dimensions for now, so this is not a big problem.

image
image

@linear
Copy link

linear bot commented Oct 30, 2023

@vercel
Copy link

vercel bot commented Oct 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 4:02pm
rif ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 4:02pm
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 4:02pm

@@ -0,0 +1,44 @@
"use client"

Check warning

Code scanning / CodeQL

Unknown directive Warning

Unknown directive: 'use client'.
@@ -0,0 +1,35 @@
"use client"

Check warning

Code scanning / CodeQL

Unknown directive Warning

Unknown directive: 'use client'.
Copy link
Member

@junlarsen junlarsen left a comment

Choose a reason for hiding this comment

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

I have a few questions with the DB schema, but otherwise LGTM

packages/db/src/migrations/0019_create_offline.ts Outdated Show resolved Hide resolved
packages/db/src/migrations/0019_create_offline.ts Outdated Show resolved Hide resolved
packages/db/src/migrations/0019_create_offline.ts Outdated Show resolved Hide resolved
packages/db/src/migrations/0019_create_offline.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,17 @@
"use client"

Check warning

Code scanning / CodeQL

Unknown directive Warning

Unknown directive: 'use client'.
apps/dashboard/src/app/(dashboard)/offline/[id]/layout.tsx Dismissed Show dismissed Hide dismissed
@@ -0,0 +1,44 @@
"use client"

Check warning

Code scanning / CodeQL

Unknown directive Warning

Unknown directive: 'use client'.
Copy link
Member

@junlarsen junlarsen left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

sonarcloud bot commented Nov 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
1.6% 1.6% Duplication

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