mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor: selected columns in queries (#17589)
This commit is contained in:
parent
5a51ad3622
commit
0b69d1c147
9 changed files with 50 additions and 144 deletions
|
|
@ -10,19 +10,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -36,7 +26,7 @@ select
|
|||
from
|
||||
(
|
||||
select
|
||||
"album_users".*,
|
||||
"album_users"."role",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
|
|
@ -44,19 +34,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -118,19 +98,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -144,7 +114,7 @@ select
|
|||
from
|
||||
(
|
||||
select
|
||||
"album_users".*,
|
||||
"album_users"."role",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
|
|
@ -152,19 +122,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -229,19 +189,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -255,7 +205,7 @@ select
|
|||
from
|
||||
(
|
||||
select
|
||||
"album_users".*,
|
||||
"album_users"."role",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
|
|
@ -263,19 +213,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -319,7 +259,7 @@ select
|
|||
from
|
||||
(
|
||||
select
|
||||
"album_users".*,
|
||||
"album_users"."role",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
|
|
@ -327,19 +267,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -360,19 +290,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
@ -431,19 +351,9 @@ select
|
|||
(
|
||||
select
|
||||
"id",
|
||||
"email",
|
||||
"createdAt",
|
||||
"profileImagePath",
|
||||
"isAdmin",
|
||||
"shouldChangePassword",
|
||||
"deletedAt",
|
||||
"oauthId",
|
||||
"updatedAt",
|
||||
"storageLabel",
|
||||
"name",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"status",
|
||||
"email",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"users"
|
||||
|
|
|
|||
|
|
@ -110,7 +110,12 @@ select
|
|||
from
|
||||
(
|
||||
select
|
||||
"tags".*
|
||||
"tags"."id",
|
||||
"tags"."value",
|
||||
"tags"."createdAt",
|
||||
"tags"."updatedAt",
|
||||
"tags"."color",
|
||||
"tags"."parentId"
|
||||
from
|
||||
"tags"
|
||||
inner join "tag_asset" on "tags"."id" = "tag_asset"."tagsId"
|
||||
|
|
@ -194,7 +199,9 @@ select
|
|||
from
|
||||
(
|
||||
select
|
||||
"asset_files".*
|
||||
"asset_files"."id",
|
||||
"asset_files"."path",
|
||||
"asset_files"."type"
|
||||
from
|
||||
"asset_files"
|
||||
where
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ order by
|
|||
-- SharedLinkRepository.getAll
|
||||
select distinct
|
||||
on ("shared_links"."createdAt") "shared_links".*,
|
||||
to_json("assets") as "assets",
|
||||
"assets"."assets",
|
||||
to_json("album") as "album"
|
||||
from
|
||||
"shared_links"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,12 @@ on conflict ("userId", "value") do update
|
|||
set
|
||||
"parentId" = $4
|
||||
returning
|
||||
*
|
||||
"tags"."id",
|
||||
"tags"."value",
|
||||
"tags"."createdAt",
|
||||
"tags"."updatedAt",
|
||||
"tags"."color",
|
||||
"tags"."parentId"
|
||||
rollback
|
||||
|
||||
-- TagRepository.getAll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue