mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor: more database types (#17490)
This commit is contained in:
parent
04b03f2924
commit
8943ec23ba
12 changed files with 123 additions and 148 deletions
|
|
@ -38,42 +38,11 @@ where
|
|||
|
||||
-- SessionRepository.getByUserId
|
||||
select
|
||||
"sessions".*,
|
||||
to_json("user") as "user"
|
||||
"sessions".*
|
||||
from
|
||||
"sessions"
|
||||
inner join lateral (
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"deletedAt",
|
||||
"isAdmin",
|
||||
"status",
|
||||
"oauthId",
|
||||
"profileImagePath",
|
||||
"shouldChangePassword",
|
||||
"storageLabel",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
(
|
||||
select
|
||||
array_agg("user_metadata") as "metadata"
|
||||
from
|
||||
"user_metadata"
|
||||
where
|
||||
"users"."id" = "user_metadata"."userId"
|
||||
) as "metadata"
|
||||
from
|
||||
"users"
|
||||
where
|
||||
"users"."id" = "sessions"."userId"
|
||||
and "users"."deletedAt" is null
|
||||
) as "user" on true
|
||||
inner join "users" on "users"."id" = "sessions"."userId"
|
||||
and "users"."deletedAt" is null
|
||||
where
|
||||
"sessions"."userId" = $1
|
||||
order by
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue