mirror of
https://github.com/immich-app/immich.git
synced 2025-06-23 15:30:51 -04:00
74 lines
1.3 KiB
SQL
74 lines
1.3 KiB
SQL
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
-- SessionRepository.get
|
|
select
|
|
"id",
|
|
"expiresAt",
|
|
"pinExpiresAt"
|
|
from
|
|
"sessions"
|
|
where
|
|
"id" = $1
|
|
|
|
-- SessionRepository.getByToken
|
|
select
|
|
"sessions"."id",
|
|
"sessions"."updatedAt",
|
|
"sessions"."pinExpiresAt",
|
|
(
|
|
select
|
|
to_json(obj)
|
|
from
|
|
(
|
|
select
|
|
"users"."id",
|
|
"users"."name",
|
|
"users"."email",
|
|
"users"."isAdmin",
|
|
"users"."quotaUsageInBytes",
|
|
"users"."quotaSizeInBytes"
|
|
from
|
|
"users"
|
|
where
|
|
"users"."id" = "sessions"."userId"
|
|
and "users"."deletedAt" is null
|
|
) as obj
|
|
) as "user"
|
|
from
|
|
"sessions"
|
|
where
|
|
"sessions"."token" = $1
|
|
and (
|
|
"sessions"."expiresAt" is null
|
|
or "sessions"."expiresAt" > $2
|
|
)
|
|
|
|
-- SessionRepository.getByUserId
|
|
select
|
|
"sessions".*
|
|
from
|
|
"sessions"
|
|
inner join "users" on "users"."id" = "sessions"."userId"
|
|
and "users"."deletedAt" is null
|
|
where
|
|
"sessions"."userId" = $1
|
|
and (
|
|
"sessions"."expiresAt" is null
|
|
or "sessions"."expiresAt" > $2
|
|
)
|
|
order by
|
|
"sessions"."updatedAt" desc,
|
|
"sessions"."createdAt" desc
|
|
|
|
-- SessionRepository.delete
|
|
delete from "sessions"
|
|
where
|
|
"id" = $1::uuid
|
|
|
|
-- SessionRepository.lockAll
|
|
update "sessions"
|
|
set
|
|
"pinExpiresAt" = $1
|
|
where
|
|
"userId" = $2
|