mirror of
https://github.com/immich-app/immich.git
synced 2025-12-28 09:14:59 +03:00
refactor(server): narrow auth types (#16066)
This commit is contained in:
@@ -3,29 +3,28 @@
|
||||
-- ApiKeyRepository.getKey
|
||||
select
|
||||
"api_keys"."id",
|
||||
"api_keys"."key",
|
||||
"api_keys"."userId",
|
||||
"api_keys"."permissions",
|
||||
to_json("user") as "user"
|
||||
from
|
||||
"api_keys"
|
||||
inner join lateral (
|
||||
(
|
||||
select
|
||||
"users".*,
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
array_agg("user_metadata") as "metadata"
|
||||
"users"."id",
|
||||
"users"."name",
|
||||
"users"."email",
|
||||
"users"."isAdmin",
|
||||
"users"."quotaUsageInBytes",
|
||||
"users"."quotaSizeInBytes"
|
||||
from
|
||||
"user_metadata"
|
||||
"users"
|
||||
where
|
||||
"users"."id" = "user_metadata"."userId"
|
||||
) as "metadata"
|
||||
from
|
||||
"users"
|
||||
where
|
||||
"users"."id" = "api_keys"."userId"
|
||||
and "users"."deletedAt" is null
|
||||
) as "user" on true
|
||||
"users"."id" = "api_keys"."userId"
|
||||
and "users"."deletedAt" is null
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"api_keys"
|
||||
where
|
||||
"api_keys"."key" = $1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user