mirror of
https://github.com/immich-app/immich.git
synced 2025-11-10 08:36:52 -05:00
59 lines
953 B
SQL
59 lines
953 B
SQL
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
-- ApiKeyRepository.getKey
|
|
select
|
|
"api_keys"."id",
|
|
"api_keys"."permissions",
|
|
(
|
|
select
|
|
to_json(obj)
|
|
from
|
|
(
|
|
select
|
|
"users"."id",
|
|
"users"."name",
|
|
"users"."email",
|
|
"users"."isAdmin",
|
|
"users"."quotaUsageInBytes",
|
|
"users"."quotaSizeInBytes"
|
|
from
|
|
"users"
|
|
where
|
|
"users"."id" = "api_keys"."userId"
|
|
and "users"."deletedAt" is null
|
|
) as obj
|
|
) as "user"
|
|
from
|
|
"api_keys"
|
|
where
|
|
"api_keys"."key" = $1
|
|
|
|
-- ApiKeyRepository.getById
|
|
select
|
|
"id",
|
|
"name",
|
|
"userId",
|
|
"createdAt",
|
|
"updatedAt",
|
|
"permissions"
|
|
from
|
|
"api_keys"
|
|
where
|
|
"id" = $1::uuid
|
|
and "userId" = $2
|
|
|
|
-- ApiKeyRepository.getByUserId
|
|
select
|
|
"id",
|
|
"name",
|
|
"userId",
|
|
"createdAt",
|
|
"updatedAt",
|
|
"permissions"
|
|
from
|
|
"api_keys"
|
|
where
|
|
"userId" = $1
|
|
order by
|
|
"createdAt" desc
|