mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: tests
This commit is contained in:
@@ -19,6 +19,7 @@ select
|
|||||||
(
|
(
|
||||||
select
|
select
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
to_json(obj)
|
to_json(obj)
|
||||||
@@ -98,6 +99,7 @@ select
|
|||||||
(
|
(
|
||||||
select
|
select
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
to_json(obj)
|
to_json(obj)
|
||||||
@@ -195,6 +197,7 @@ select
|
|||||||
(
|
(
|
||||||
select
|
select
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
to_json(obj)
|
to_json(obj)
|
||||||
@@ -258,6 +261,7 @@ select
|
|||||||
(
|
(
|
||||||
select
|
select
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
to_json(obj)
|
to_json(obj)
|
||||||
@@ -334,6 +338,70 @@ where
|
|||||||
order by
|
order by
|
||||||
"album"."createdAt" desc
|
"album"."createdAt" desc
|
||||||
|
|
||||||
|
-- AlbumRepository.getFavorites
|
||||||
|
select
|
||||||
|
"album".*,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
coalesce(json_agg(agg), '[]')
|
||||||
|
from
|
||||||
|
(
|
||||||
|
select
|
||||||
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
|
(
|
||||||
|
select
|
||||||
|
to_json(obj)
|
||||||
|
from
|
||||||
|
(
|
||||||
|
select
|
||||||
|
"id",
|
||||||
|
"name",
|
||||||
|
"email",
|
||||||
|
"avatarColor",
|
||||||
|
"profileImagePath",
|
||||||
|
"profileChangedAt"
|
||||||
|
from
|
||||||
|
(
|
||||||
|
select
|
||||||
|
1
|
||||||
|
) as "dummy"
|
||||||
|
) as obj
|
||||||
|
) as "user"
|
||||||
|
from
|
||||||
|
"album_user"
|
||||||
|
inner join "user" on "user"."id" = "album_user"."userId"
|
||||||
|
where
|
||||||
|
"album_user"."albumId" = "album"."id"
|
||||||
|
order by
|
||||||
|
"album_user"."role",
|
||||||
|
"album_user"."userId" = $1 desc,
|
||||||
|
"user"."name" asc
|
||||||
|
) as agg
|
||||||
|
) as "albumUsers",
|
||||||
|
(
|
||||||
|
select
|
||||||
|
coalesce(json_agg(agg), '[]')
|
||||||
|
from
|
||||||
|
(
|
||||||
|
select
|
||||||
|
"shared_link".*
|
||||||
|
from
|
||||||
|
"shared_link"
|
||||||
|
where
|
||||||
|
"shared_link"."albumId" = "album"."id"
|
||||||
|
) as agg
|
||||||
|
) as "sharedLinks"
|
||||||
|
from
|
||||||
|
"album"
|
||||||
|
inner join "album_user" on "album_user"."albumId" = "album"."id"
|
||||||
|
and "album_user"."userId" = $2
|
||||||
|
and "album_user"."isFavorite" = true
|
||||||
|
where
|
||||||
|
"album"."deletedAt" is null
|
||||||
|
order by
|
||||||
|
"album"."createdAt" desc
|
||||||
|
|
||||||
-- AlbumRepository.getNotShared
|
-- AlbumRepository.getNotShared
|
||||||
select
|
select
|
||||||
"album".*,
|
"album".*,
|
||||||
@@ -357,6 +425,7 @@ select
|
|||||||
(
|
(
|
||||||
select
|
select
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
to_json(obj)
|
to_json(obj)
|
||||||
@@ -461,7 +530,8 @@ with
|
|||||||
returning
|
returning
|
||||||
"album_user"."albumId",
|
"album_user"."albumId",
|
||||||
"album_user"."userId",
|
"album_user"."userId",
|
||||||
"album_user"."role"
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite"
|
||||||
),
|
),
|
||||||
"album_asset" as (
|
"album_asset" as (
|
||||||
insert into
|
insert into
|
||||||
@@ -485,6 +555,7 @@ select
|
|||||||
(
|
(
|
||||||
select
|
select
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
to_json(obj)
|
to_json(obj)
|
||||||
|
|||||||
@@ -331,6 +331,7 @@ select
|
|||||||
"album_user"."albumId" as "albumId",
|
"album_user"."albumId" as "albumId",
|
||||||
"album_user"."userId" as "userId",
|
"album_user"."userId" as "userId",
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
"album_user"."updateId"
|
"album_user"."updateId"
|
||||||
from
|
from
|
||||||
"album_user" as "album_user"
|
"album_user" as "album_user"
|
||||||
@@ -368,6 +369,7 @@ select
|
|||||||
"album_user"."albumId" as "albumId",
|
"album_user"."albumId" as "albumId",
|
||||||
"album_user"."userId" as "userId",
|
"album_user"."userId" as "userId",
|
||||||
"album_user"."role",
|
"album_user"."role",
|
||||||
|
"album_user"."isFavorite",
|
||||||
"album_user"."updateId"
|
"album_user"."updateId"
|
||||||
from
|
from
|
||||||
"album_user" as "album_user"
|
"album_user" as "album_user"
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ export class AlbumRepository {
|
|||||||
sql`unnest(${roles}::album_user_role_enum[])`.as('role'),
|
sql`unnest(${roles}::album_user_role_enum[])`.as('role'),
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
.returning(['album_user.albumId', 'album_user.userId', 'album_user.role']),
|
.returning(['album_user.albumId', 'album_user.userId', 'album_user.role', 'album_user.isFavorite']),
|
||||||
)
|
)
|
||||||
.with('album_asset', (db) =>
|
.with('album_asset', (db) =>
|
||||||
db
|
db
|
||||||
|
|||||||
Reference in New Issue
Block a user