refactor: more database types (#17490)

This commit is contained in:
Jason Rasmussen 2025-04-09 10:24:38 -04:00 committed by GitHub
parent 04b03f2924
commit 8943ec23ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 123 additions and 148 deletions

View file

@ -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