mirror of
https://github.com/immich-app/immich.git
synced 2025-02-12 19:16:53 +02:00
fix(server): for individual shares not showing thumbnails (#15895)
* Fix for individual shares not showing thumbnails * synced sql * chore: add e2e test --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
parent
b730aa60ed
commit
0bb1219b5f
@ -89,7 +89,7 @@ describe('/shared-links', () => {
|
|||||||
await deleteUserAdmin({ id: user2.userId, userAdminDeleteDto: {} }, { headers: asBearerAuth(admin.accessToken) });
|
await deleteUserAdmin({ id: user2.userId, userAdminDeleteDto: {} }, { headers: asBearerAuth(admin.accessToken) });
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('GET /share/${key}', () => {
|
describe('GET /share/:key', () => {
|
||||||
it('should have correct asset count in meta tag for non-empty album', async () => {
|
it('should have correct asset count in meta tag for non-empty album', async () => {
|
||||||
const resp = await request(shareUrl).get(`/${linkWithMetadata.key}`);
|
const resp = await request(shareUrl).get(`/${linkWithMetadata.key}`);
|
||||||
expect(resp.status).toBe(200);
|
expect(resp.status).toBe(200);
|
||||||
@ -139,7 +139,10 @@ describe('/shared-links', () => {
|
|||||||
expect(body).toEqual(
|
expect(body).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
expect.objectContaining({ id: linkWithAlbum.id }),
|
expect.objectContaining({ id: linkWithAlbum.id }),
|
||||||
expect.objectContaining({ id: linkWithAssets.id }),
|
expect.objectContaining({
|
||||||
|
id: linkWithAssets.id,
|
||||||
|
assets: expect.arrayContaining([expect.objectContaining({ id: asset1.id })]),
|
||||||
|
}),
|
||||||
expect.objectContaining({ id: linkWithPassword.id }),
|
expect.objectContaining({ id: linkWithPassword.id }),
|
||||||
expect.objectContaining({ id: linkWithMetadata.id }),
|
expect.objectContaining({ id: linkWithMetadata.id }),
|
||||||
expect.objectContaining({ id: linkWithoutMetadata.id }),
|
expect.objectContaining({ id: linkWithoutMetadata.id }),
|
||||||
|
@ -100,13 +100,14 @@ order by
|
|||||||
-- SharedLinkRepository.getAll
|
-- SharedLinkRepository.getAll
|
||||||
select distinct
|
select distinct
|
||||||
on ("shared_links"."createdAt") "shared_links".*,
|
on ("shared_links"."createdAt") "shared_links".*,
|
||||||
|
to_json("assets") as "assets",
|
||||||
to_json("album") as "album"
|
to_json("album") as "album"
|
||||||
from
|
from
|
||||||
"shared_links"
|
"shared_links"
|
||||||
left join "shared_link__asset" on "shared_link__asset"."sharedLinksId" = "shared_links"."id"
|
left join "shared_link__asset" on "shared_link__asset"."sharedLinksId" = "shared_links"."id"
|
||||||
left join lateral (
|
left join lateral (
|
||||||
select
|
select
|
||||||
"assets".*
|
json_agg("assets") as "assets"
|
||||||
from
|
from
|
||||||
"assets"
|
"assets"
|
||||||
where
|
where
|
||||||
|
@ -103,12 +103,13 @@ export class SharedLinkRepository implements ISharedLinkRepository {
|
|||||||
(eb) =>
|
(eb) =>
|
||||||
eb
|
eb
|
||||||
.selectFrom('assets')
|
.selectFrom('assets')
|
||||||
|
.select((eb) => eb.fn.jsonAgg('assets').as('assets'))
|
||||||
.whereRef('assets.id', '=', 'shared_link__asset.assetsId')
|
.whereRef('assets.id', '=', 'shared_link__asset.assetsId')
|
||||||
.where('assets.deletedAt', 'is', null)
|
.where('assets.deletedAt', 'is', null)
|
||||||
.selectAll('assets')
|
|
||||||
.as('assets'),
|
.as('assets'),
|
||||||
(join) => join.onTrue(),
|
(join) => join.onTrue(),
|
||||||
)
|
)
|
||||||
|
.select((eb) => eb.fn.toJson('assets').as('assets'))
|
||||||
.leftJoinLateral(
|
.leftJoinLateral(
|
||||||
(eb) =>
|
(eb) =>
|
||||||
eb
|
eb
|
||||||
|
Loading…
x
Reference in New Issue
Block a user