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