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

refactor(server): auth route metadata #9344

Merged
merged 1 commit into from
May 9, 2024
Merged

Conversation

jrasm91
Copy link
Contributor

@jrasm91 jrasm91 commented May 8, 2024

  • Collapse SharedLinkRoute, PublicRoute, and AdminRoute into a single Authenticated decorator
  • Transition Authenticated to be applied per route in preparation for fine-grained permissions

Copy link

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2b186e8
Status: ✅  Deploy successful!
Preview URL: https://ddb00826.immich.pages.dev
Branch Preview URL: https://refactor-auth-route-metadata.immich.pages.dev

View logs

Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

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

Looks like you haven't missed a single one, nice!


if (options.isShared) {
decorators.push(SharedLinkRoute());
if ((options as SharedLinkRoute)?.sharedLink) {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't pretty lol. I feel like checking the type first would be cleaner

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could add an isSharedRoute method or something that basically has the type (options: AuthenticatedOptions) options is SharedLinkRoute => boolean? (and then a similar thing for AdminRoute)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only place it is used though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no way to check the type besides doing exactly this.

Copy link
Member

Choose a reason for hiding this comment

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

Oh because it's just a type, yeah you're right. It is used a couple of lines below as well though

@jrasm91 jrasm91 merged commit 8743e17 into main May 9, 2024
23 of 24 checks passed
@jrasm91 jrasm91 deleted the refactor/auth-route-metadata branch May 9, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants