Skip to content

refactor(server): use helpers for shared link queries#27088

Open
michelheusschen wants to merge 6 commits intomainfrom
fix/server-get-album-shared-link
Open

refactor(server): use helpers for shared link queries#27088
michelheusschen wants to merge 6 commits intomainfrom
fix/server-get-album-shared-link

Conversation

@michelheusschen
Copy link
Collaborator

@michelheusschen michelheusschen commented Mar 20, 2026

@danieldietzler
Copy link
Member

It's fixed in #27063, right? So this shouldn't be necessary anymore?

@michelheusschen
Copy link
Collaborator Author

michelheusschen commented Mar 20, 2026

Ah yeah you're right. The changes + migration in that PR also solve the issue. I still think this change is worth keeping. It makes get() a bit more robust, keeps things consistent with getAll() and adds a regression test. That said, if you feel Jason’s PR is good enough I’m totally fine closing this one.

@danieldietzler
Copy link
Member

I can't tell if this has any performance implications, if it doesn't I'm happy to get this in too though :) (cc @mertalev)

@jrasm91 jrasm91 requested a review from alextran1502 March 20, 2026 20:53
@michelheusschen michelheusschen changed the title fix(server): prevent album shared link from breaking after uploads refactor(web): use helpers for shared link queries Mar 21, 2026
@michelheusschen michelheusschen changed the title refactor(web): use helpers for shared link queries refactor(server): use helpers for shared link queries Mar 21, 2026
.whereRef('user.id', '=', 'album.ownerId')
.where('user.deletedAt', 'is', null)
.as('owner'),
(eb) => withAlbumOwner(eb).selectAll('user').as('owner'),
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we select all columns here? It seems like it should select columns explicitly like the other one (we also have constants for selected columns in database.ts)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The owner gets serialized by mapUser which only reads public user fields, so I changed the query to .select(columns.user)

export const withExifInfo = (eb: ExpressionBuilder<DB, 'asset'>) => {
return eb
.selectFrom('asset_exif')
.selectAll('asset_exif')
Copy link
Member

Choose a reason for hiding this comment

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

Similarly here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if there's much benefit for this one, but I've changed it as well

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.

4 participants