2023-11-30 10:10:30 -05:00
|
|
|
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
|
|
|
|
|
|
-- ApiKeyRepository.getKey
|
2025-01-10 14:02:12 -05:00
|
|
|
select
|
2025-07-14 10:13:06 -04:00
|
|
|
"api_key"."id",
|
|
|
|
|
"api_key"."permissions",
|
2025-02-12 15:23:08 -05:00
|
|
|
(
|
2025-01-10 14:02:12 -05:00
|
|
|
select
|
2025-02-12 15:23:08 -05:00
|
|
|
to_json(obj)
|
|
|
|
|
from
|
2025-01-10 14:02:12 -05:00
|
|
|
(
|
|
|
|
|
select
|
2025-07-14 10:13:06 -04:00
|
|
|
"user"."id",
|
|
|
|
|
"user"."name",
|
|
|
|
|
"user"."email",
|
|
|
|
|
"user"."isAdmin",
|
|
|
|
|
"user"."quotaUsageInBytes",
|
|
|
|
|
"user"."quotaSizeInBytes"
|
2025-01-10 14:02:12 -05:00
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"user"
|
2025-01-10 14:02:12 -05:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"user"."id" = "api_key"."userId"
|
|
|
|
|
and "user"."deletedAt" is null
|
2025-02-12 15:23:08 -05:00
|
|
|
) as obj
|
|
|
|
|
) as "user"
|
|
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"api_key"
|
2025-01-10 14:02:12 -05:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"api_key"."key" = $1
|
2023-11-30 10:10:30 -05:00
|
|
|
|
|
|
|
|
-- ApiKeyRepository.getById
|
2025-01-10 14:02:12 -05:00
|
|
|
select
|
|
|
|
|
"id",
|
|
|
|
|
"name",
|
|
|
|
|
"userId",
|
|
|
|
|
"createdAt",
|
|
|
|
|
"updatedAt",
|
|
|
|
|
"permissions"
|
|
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"api_key"
|
2025-01-10 14:02:12 -05:00
|
|
|
where
|
|
|
|
|
"id" = $1::uuid
|
|
|
|
|
and "userId" = $2
|
2023-11-30 10:10:30 -05:00
|
|
|
|
|
|
|
|
-- ApiKeyRepository.getByUserId
|
2025-01-10 14:02:12 -05:00
|
|
|
select
|
|
|
|
|
"id",
|
|
|
|
|
"name",
|
|
|
|
|
"userId",
|
|
|
|
|
"createdAt",
|
|
|
|
|
"updatedAt",
|
|
|
|
|
"permissions"
|
|
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"api_key"
|
2025-01-10 14:02:12 -05:00
|
|
|
where
|
|
|
|
|
"userId" = $1
|
|
|
|
|
order by
|
|
|
|
|
"createdAt" desc
|