mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
parent
25c9b779e4
commit
4b39d37cae
19 changed files with 494 additions and 275 deletions
54
server/src/queries/activity.repository.sql
Normal file
54
server/src/queries/activity.repository.sql
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- ActivityRepository.search
|
||||
SELECT
|
||||
"ActivityEntity"."id" AS "ActivityEntity_id",
|
||||
"ActivityEntity"."createdAt" AS "ActivityEntity_createdAt",
|
||||
"ActivityEntity"."updatedAt" AS "ActivityEntity_updatedAt",
|
||||
"ActivityEntity"."albumId" AS "ActivityEntity_albumId",
|
||||
"ActivityEntity"."userId" AS "ActivityEntity_userId",
|
||||
"ActivityEntity"."assetId" AS "ActivityEntity_assetId",
|
||||
"ActivityEntity"."comment" AS "ActivityEntity_comment",
|
||||
"ActivityEntity"."isLiked" AS "ActivityEntity_isLiked",
|
||||
"ActivityEntity__ActivityEntity_user"."id" AS "ActivityEntity__ActivityEntity_user_id",
|
||||
"ActivityEntity__ActivityEntity_user"."name" AS "ActivityEntity__ActivityEntity_user_name",
|
||||
"ActivityEntity__ActivityEntity_user"."avatarColor" AS "ActivityEntity__ActivityEntity_user_avatarColor",
|
||||
"ActivityEntity__ActivityEntity_user"."isAdmin" AS "ActivityEntity__ActivityEntity_user_isAdmin",
|
||||
"ActivityEntity__ActivityEntity_user"."email" AS "ActivityEntity__ActivityEntity_user_email",
|
||||
"ActivityEntity__ActivityEntity_user"."storageLabel" AS "ActivityEntity__ActivityEntity_user_storageLabel",
|
||||
"ActivityEntity__ActivityEntity_user"."oauthId" AS "ActivityEntity__ActivityEntity_user_oauthId",
|
||||
"ActivityEntity__ActivityEntity_user"."profileImagePath" AS "ActivityEntity__ActivityEntity_user_profileImagePath",
|
||||
"ActivityEntity__ActivityEntity_user"."shouldChangePassword" AS "ActivityEntity__ActivityEntity_user_shouldChangePassword",
|
||||
"ActivityEntity__ActivityEntity_user"."createdAt" AS "ActivityEntity__ActivityEntity_user_createdAt",
|
||||
"ActivityEntity__ActivityEntity_user"."deletedAt" AS "ActivityEntity__ActivityEntity_user_deletedAt",
|
||||
"ActivityEntity__ActivityEntity_user"."status" AS "ActivityEntity__ActivityEntity_user_status",
|
||||
"ActivityEntity__ActivityEntity_user"."updatedAt" AS "ActivityEntity__ActivityEntity_user_updatedAt",
|
||||
"ActivityEntity__ActivityEntity_user"."memoriesEnabled" AS "ActivityEntity__ActivityEntity_user_memoriesEnabled",
|
||||
"ActivityEntity__ActivityEntity_user"."quotaSizeInBytes" AS "ActivityEntity__ActivityEntity_user_quotaSizeInBytes",
|
||||
"ActivityEntity__ActivityEntity_user"."quotaUsageInBytes" AS "ActivityEntity__ActivityEntity_user_quotaUsageInBytes"
|
||||
FROM
|
||||
"activity" "ActivityEntity"
|
||||
LEFT JOIN "users" "ActivityEntity__ActivityEntity_user" ON "ActivityEntity__ActivityEntity_user"."id" = "ActivityEntity"."userId"
|
||||
AND (
|
||||
"ActivityEntity__ActivityEntity_user"."deletedAt" IS NULL
|
||||
)
|
||||
WHERE
|
||||
(("ActivityEntity"."albumId" = $1))
|
||||
ORDER BY
|
||||
"ActivityEntity"."createdAt" ASC
|
||||
|
||||
-- ActivityRepository.getStatistics
|
||||
SELECT
|
||||
COUNT(DISTINCT ("ActivityEntity"."id")) AS "cnt"
|
||||
FROM
|
||||
"activity" "ActivityEntity"
|
||||
LEFT JOIN "users" "ActivityEntity__ActivityEntity_user" ON "ActivityEntity__ActivityEntity_user"."id" = "ActivityEntity"."userId"
|
||||
AND (
|
||||
"ActivityEntity__ActivityEntity_user"."deletedAt" IS NULL
|
||||
)
|
||||
WHERE
|
||||
(
|
||||
("ActivityEntity"."assetId" = $1)
|
||||
AND ("ActivityEntity"."albumId" = $2)
|
||||
AND ("ActivityEntity"."isLiked" = $3)
|
||||
)
|
||||
|
|
@ -1,5 +1,88 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- AssetRepository.getByDayOfYear
|
||||
SELECT
|
||||
"entity"."id" AS "entity_id",
|
||||
"entity"."deviceAssetId" AS "entity_deviceAssetId",
|
||||
"entity"."ownerId" AS "entity_ownerId",
|
||||
"entity"."libraryId" AS "entity_libraryId",
|
||||
"entity"."deviceId" AS "entity_deviceId",
|
||||
"entity"."type" AS "entity_type",
|
||||
"entity"."originalPath" AS "entity_originalPath",
|
||||
"entity"."resizePath" AS "entity_resizePath",
|
||||
"entity"."webpPath" AS "entity_webpPath",
|
||||
"entity"."thumbhash" AS "entity_thumbhash",
|
||||
"entity"."encodedVideoPath" AS "entity_encodedVideoPath",
|
||||
"entity"."createdAt" AS "entity_createdAt",
|
||||
"entity"."updatedAt" AS "entity_updatedAt",
|
||||
"entity"."deletedAt" AS "entity_deletedAt",
|
||||
"entity"."fileCreatedAt" AS "entity_fileCreatedAt",
|
||||
"entity"."localDateTime" AS "entity_localDateTime",
|
||||
"entity"."fileModifiedAt" AS "entity_fileModifiedAt",
|
||||
"entity"."isFavorite" AS "entity_isFavorite",
|
||||
"entity"."isArchived" AS "entity_isArchived",
|
||||
"entity"."isExternal" AS "entity_isExternal",
|
||||
"entity"."isReadOnly" AS "entity_isReadOnly",
|
||||
"entity"."isOffline" AS "entity_isOffline",
|
||||
"entity"."checksum" AS "entity_checksum",
|
||||
"entity"."duration" AS "entity_duration",
|
||||
"entity"."isVisible" AS "entity_isVisible",
|
||||
"entity"."livePhotoVideoId" AS "entity_livePhotoVideoId",
|
||||
"entity"."originalFileName" AS "entity_originalFileName",
|
||||
"entity"."sidecarPath" AS "entity_sidecarPath",
|
||||
"entity"."stackId" AS "entity_stackId",
|
||||
"exifInfo"."assetId" AS "exifInfo_assetId",
|
||||
"exifInfo"."description" AS "exifInfo_description",
|
||||
"exifInfo"."exifImageWidth" AS "exifInfo_exifImageWidth",
|
||||
"exifInfo"."exifImageHeight" AS "exifInfo_exifImageHeight",
|
||||
"exifInfo"."fileSizeInByte" AS "exifInfo_fileSizeInByte",
|
||||
"exifInfo"."orientation" AS "exifInfo_orientation",
|
||||
"exifInfo"."dateTimeOriginal" AS "exifInfo_dateTimeOriginal",
|
||||
"exifInfo"."modifyDate" AS "exifInfo_modifyDate",
|
||||
"exifInfo"."timeZone" AS "exifInfo_timeZone",
|
||||
"exifInfo"."latitude" AS "exifInfo_latitude",
|
||||
"exifInfo"."longitude" AS "exifInfo_longitude",
|
||||
"exifInfo"."projectionType" AS "exifInfo_projectionType",
|
||||
"exifInfo"."city" AS "exifInfo_city",
|
||||
"exifInfo"."livePhotoCID" AS "exifInfo_livePhotoCID",
|
||||
"exifInfo"."autoStackId" AS "exifInfo_autoStackId",
|
||||
"exifInfo"."state" AS "exifInfo_state",
|
||||
"exifInfo"."country" AS "exifInfo_country",
|
||||
"exifInfo"."make" AS "exifInfo_make",
|
||||
"exifInfo"."model" AS "exifInfo_model",
|
||||
"exifInfo"."lensModel" AS "exifInfo_lensModel",
|
||||
"exifInfo"."fNumber" AS "exifInfo_fNumber",
|
||||
"exifInfo"."focalLength" AS "exifInfo_focalLength",
|
||||
"exifInfo"."iso" AS "exifInfo_iso",
|
||||
"exifInfo"."exposureTime" AS "exifInfo_exposureTime",
|
||||
"exifInfo"."profileDescription" AS "exifInfo_profileDescription",
|
||||
"exifInfo"."colorspace" AS "exifInfo_colorspace",
|
||||
"exifInfo"."bitsPerSample" AS "exifInfo_bitsPerSample",
|
||||
"exifInfo"."fps" AS "exifInfo_fps"
|
||||
FROM
|
||||
"assets" "entity"
|
||||
LEFT JOIN "exif" "exifInfo" ON "exifInfo"."assetId" = "entity"."id"
|
||||
WHERE
|
||||
(
|
||||
"entity"."ownerId" IN ($1)
|
||||
AND "entity"."isVisible" = true
|
||||
AND "entity"."isArchived" = false
|
||||
AND "entity"."resizePath" IS NOT NULL
|
||||
AND EXTRACT(
|
||||
DAY
|
||||
FROM
|
||||
"entity"."localDateTime" AT TIME ZONE 'UTC'
|
||||
) = $2
|
||||
AND EXTRACT(
|
||||
MONTH
|
||||
FROM
|
||||
"entity"."localDateTime" AT TIME ZONE 'UTC'
|
||||
) = $3
|
||||
)
|
||||
AND ("entity"."deletedAt" IS NULL)
|
||||
ORDER BY
|
||||
"entity"."localDateTime" ASC
|
||||
|
||||
-- AssetRepository.getByIds
|
||||
SELECT
|
||||
"AssetEntity"."id" AS "AssetEntity_id",
|
||||
|
|
@ -170,6 +253,34 @@ DELETE FROM "assets"
|
|||
WHERE
|
||||
"ownerId" = $1
|
||||
|
||||
-- AssetRepository.getLibraryAssetPaths
|
||||
SELECT DISTINCT
|
||||
"distinctAlias"."AssetEntity_id" AS "ids_AssetEntity_id"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
"AssetEntity"."id" AS "AssetEntity_id",
|
||||
"AssetEntity"."originalPath" AS "AssetEntity_originalPath",
|
||||
"AssetEntity"."isOffline" AS "AssetEntity_isOffline"
|
||||
FROM
|
||||
"assets" "AssetEntity"
|
||||
LEFT JOIN "libraries" "AssetEntity__AssetEntity_library" ON "AssetEntity__AssetEntity_library"."id" = "AssetEntity"."libraryId"
|
||||
AND (
|
||||
"AssetEntity__AssetEntity_library"."deletedAt" IS NULL
|
||||
)
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
((("AssetEntity__AssetEntity_library"."id" = $1)))
|
||||
)
|
||||
)
|
||||
AND ("AssetEntity"."deletedAt" IS NULL)
|
||||
) "distinctAlias"
|
||||
ORDER BY
|
||||
"AssetEntity_id" ASC
|
||||
LIMIT
|
||||
2
|
||||
|
||||
-- AssetRepository.getByLibraryIdAndOriginalPath
|
||||
SELECT DISTINCT
|
||||
"distinctAlias"."AssetEntity_id" AS "ids_AssetEntity_id"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
66
server/src/queries/metadata.repository.sql
Normal file
66
server/src/queries/metadata.repository.sql
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- MetadataRepository.getCountries
|
||||
SELECT DISTINCT
|
||||
ON ("exif"."country") "exif"."country" AS "exif_country",
|
||||
"exif"."assetId" AS "exif_assetId"
|
||||
FROM
|
||||
"exif" "exif"
|
||||
LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
WHERE
|
||||
"asset"."ownerId" = $1
|
||||
AND "exif"."country" IS NOT NULL
|
||||
|
||||
-- MetadataRepository.getStates
|
||||
SELECT DISTINCT
|
||||
ON ("exif"."state") "exif"."state" AS "exif_state",
|
||||
"exif"."assetId" AS "exif_assetId"
|
||||
FROM
|
||||
"exif" "exif"
|
||||
LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
WHERE
|
||||
"asset"."ownerId" = $1
|
||||
AND "exif"."state" IS NOT NULL
|
||||
AND "exif"."country" = $2
|
||||
|
||||
-- MetadataRepository.getCities
|
||||
SELECT DISTINCT
|
||||
ON ("exif"."city") "exif"."city" AS "exif_city",
|
||||
"exif"."assetId" AS "exif_assetId"
|
||||
FROM
|
||||
"exif" "exif"
|
||||
LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
WHERE
|
||||
"asset"."ownerId" = $1
|
||||
AND "exif"."city" IS NOT NULL
|
||||
AND "exif"."country" = $2
|
||||
AND "exif"."state" = $3
|
||||
|
||||
-- MetadataRepository.getCameraMakes
|
||||
SELECT DISTINCT
|
||||
ON ("exif"."make") "exif"."make" AS "exif_make",
|
||||
"exif"."assetId" AS "exif_assetId"
|
||||
FROM
|
||||
"exif" "exif"
|
||||
LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
WHERE
|
||||
"asset"."ownerId" = $1
|
||||
AND "exif"."make" IS NOT NULL
|
||||
AND "exif"."model" = $2
|
||||
|
||||
-- MetadataRepository.getCameraModels
|
||||
SELECT DISTINCT
|
||||
ON ("exif"."model") "exif"."model" AS "exif_model",
|
||||
"exif"."assetId" AS "exif_assetId"
|
||||
FROM
|
||||
"exif" "exif"
|
||||
LEFT JOIN "assets" "asset" ON "asset"."id" = "exif"."assetId"
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
WHERE
|
||||
"asset"."ownerId" = $1
|
||||
AND "exif"."model" IS NOT NULL
|
||||
AND "exif"."make" = $2
|
||||
|
|
@ -1 +0,0 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
|
@ -278,7 +278,7 @@ WITH RECURSIVE
|
|||
exif
|
||||
INNER JOIN assets ON exif."assetId" = assets.id
|
||||
WHERE
|
||||
"ownerId" = ANY ('$1'::uuid [])
|
||||
"ownerId" = ANY ($1::uuid [])
|
||||
AND "isVisible" = $2
|
||||
AND "isArchived" = $3
|
||||
AND type = $4
|
||||
|
|
@ -302,7 +302,7 @@ WITH RECURSIVE
|
|||
INNER JOIN assets ON exif."assetId" = assets.id
|
||||
WHERE
|
||||
city > c.city
|
||||
AND "ownerId" = ANY ('$1'::uuid [])
|
||||
AND "ownerId" = ANY ($1::uuid [])
|
||||
AND "isVisible" = $2
|
||||
AND "isArchived" = $3
|
||||
AND type = $4
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
|
@ -1 +0,0 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
Loading…
Add table
Add a link
Reference in a new issue