refactor(server): narrow auth types (#16066)

This commit is contained in:
Jason Rasmussen
2025-02-12 15:23:08 -05:00
committed by GitHub
parent 7c821dd205
commit 2d7c333c8c
25 changed files with 265 additions and 239 deletions

View File

@@ -10,41 +10,29 @@ where
-- SessionRepository.getByToken
select
"sessions".*,
to_json("user") as "user"
from
"sessions"
inner join lateral (
"sessions"."id",
"sessions"."updatedAt",
(
select
"id",
"email",
"createdAt",
"profileImagePath",
"isAdmin",
"shouldChangePassword",
"deletedAt",
"oauthId",
"updatedAt",
"storageLabel",
"name",
"quotaSizeInBytes",
"quotaUsageInBytes",
"status",
"profileChangedAt",
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" = "sessions"."userId"
and "users"."deletedAt" is null
) as "user" on true
"users"."id" = "sessions"."userId"
and "users"."deletedAt" is null
) as obj
) as "user"
from
"sessions"
where
"sessions"."token" = $1