diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILES index 2fd4fba057..e7cbd570dc 100644 --- a/mobile/openapi/.openapi-generator/FILES +++ b/mobile/openapi/.openapi-generator/FILES @@ -60,8 +60,6 @@ doc/CreateLibraryDto.md doc/CreateProfileImageResponseDto.md doc/CreateTagDto.md doc/CreateUserDto.md -doc/CuratedLocationsResponseDto.md -doc/CuratedObjectsResponseDto.md doc/DeleteUserDto.md doc/DownloadApi.md doc/DownloadArchiveInfo.md @@ -297,8 +295,6 @@ lib/model/create_library_dto.dart lib/model/create_profile_image_response_dto.dart lib/model/create_tag_dto.dart lib/model/create_user_dto.dart -lib/model/curated_locations_response_dto.dart -lib/model/curated_objects_response_dto.dart lib/model/delete_user_dto.dart lib/model/download_archive_info.dart lib/model/download_info_dto.dart @@ -485,8 +481,6 @@ test/create_library_dto_test.dart test/create_profile_image_response_dto_test.dart test/create_tag_dto_test.dart test/create_user_dto_test.dart -test/curated_locations_response_dto_test.dart -test/curated_objects_response_dto_test.dart test/delete_user_dto_test.dart test/download_api_test.dart test/download_archive_info_test.dart diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 3059e3dbef..187d8e8fa9 100644 Binary files a/mobile/openapi/README.md and b/mobile/openapi/README.md differ diff --git a/mobile/openapi/doc/AssetApi.md b/mobile/openapi/doc/AssetApi.md index 297a4cdba6..826e91a690 100644 Binary files a/mobile/openapi/doc/AssetApi.md and b/mobile/openapi/doc/AssetApi.md differ diff --git a/mobile/openapi/doc/CuratedLocationsResponseDto.md b/mobile/openapi/doc/CuratedLocationsResponseDto.md deleted file mode 100644 index 627bcbf854..0000000000 Binary files a/mobile/openapi/doc/CuratedLocationsResponseDto.md and /dev/null differ diff --git a/mobile/openapi/doc/CuratedObjectsResponseDto.md b/mobile/openapi/doc/CuratedObjectsResponseDto.md deleted file mode 100644 index ee041a8215..0000000000 Binary files a/mobile/openapi/doc/CuratedObjectsResponseDto.md and /dev/null differ diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 78f2e9ed5a..3e2f23024e 100644 Binary files a/mobile/openapi/lib/api.dart and b/mobile/openapi/lib/api.dart differ diff --git a/mobile/openapi/lib/api/asset_api.dart b/mobile/openapi/lib/api/asset_api.dart index 10f1c0c10e..c6031f6bda 100644 Binary files a/mobile/openapi/lib/api/asset_api.dart and b/mobile/openapi/lib/api/asset_api.dart differ diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index ae3b9dadf1..5db7b8fbef 100644 Binary files a/mobile/openapi/lib/api_client.dart and b/mobile/openapi/lib/api_client.dart differ diff --git a/mobile/openapi/lib/model/curated_locations_response_dto.dart b/mobile/openapi/lib/model/curated_locations_response_dto.dart deleted file mode 100644 index 0b54c4807f..0000000000 Binary files a/mobile/openapi/lib/model/curated_locations_response_dto.dart and /dev/null differ diff --git a/mobile/openapi/lib/model/curated_objects_response_dto.dart b/mobile/openapi/lib/model/curated_objects_response_dto.dart deleted file mode 100644 index 40b6e1789b..0000000000 Binary files a/mobile/openapi/lib/model/curated_objects_response_dto.dart and /dev/null differ diff --git a/mobile/openapi/test/asset_api_test.dart b/mobile/openapi/test/asset_api_test.dart index 0c1729e95f..e64d3acf5e 100644 Binary files a/mobile/openapi/test/asset_api_test.dart and b/mobile/openapi/test/asset_api_test.dart differ diff --git a/mobile/openapi/test/curated_locations_response_dto_test.dart b/mobile/openapi/test/curated_locations_response_dto_test.dart deleted file mode 100644 index 7529aaf7c8..0000000000 Binary files a/mobile/openapi/test/curated_locations_response_dto_test.dart and /dev/null differ diff --git a/mobile/openapi/test/curated_objects_response_dto_test.dart b/mobile/openapi/test/curated_objects_response_dto_test.dart deleted file mode 100644 index f71723ab27..0000000000 Binary files a/mobile/openapi/test/curated_objects_response_dto_test.dart and /dev/null differ diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 5905f2ccfc..d1e0b6aace 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -1149,76 +1149,6 @@ ] } }, - "/asset/curated-locations": { - "get": { - "operationId": "getCuratedLocations", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/CuratedLocationsResponseDto" - }, - "type": "array" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Asset" - ] - } - }, - "/asset/curated-objects": { - "get": { - "operationId": "getCuratedObjects", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/CuratedObjectsResponseDto" - }, - "type": "array" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Asset" - ] - } - }, "/asset/device/{deviceId}": { "get": { "description": "Get all asset of a device that are in the database, ID only.", @@ -1590,41 +1520,6 @@ ] } }, - "/asset/search-terms": { - "get": { - "operationId": "getAssetSearchTerms", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "type": "string" - }, - "type": "array" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Asset" - ] - } - }, "/asset/stack/parent": { "put": { "operationId": "updateStackParent", @@ -8423,60 +8318,6 @@ ], "type": "object" }, - "CuratedLocationsResponseDto": { - "properties": { - "city": { - "type": "string" - }, - "deviceAssetId": { - "type": "string" - }, - "deviceId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "resizePath": { - "type": "string" - } - }, - "required": [ - "city", - "deviceAssetId", - "deviceId", - "id", - "resizePath" - ], - "type": "object" - }, - "CuratedObjectsResponseDto": { - "properties": { - "deviceAssetId": { - "type": "string" - }, - "deviceId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "object": { - "type": "string" - }, - "resizePath": { - "type": "string" - } - }, - "required": [ - "deviceAssetId", - "deviceId", - "id", - "object", - "resizePath" - ], - "type": "object" - }, "DeleteUserDto": { "properties": { "force": { diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index a517cb6602..2536afe598 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -252,20 +252,6 @@ export type AssetBulkUploadCheckResult = { export type AssetBulkUploadCheckResponseDto = { results: AssetBulkUploadCheckResult[]; }; -export type CuratedLocationsResponseDto = { - city: string; - deviceAssetId: string; - deviceId: string; - id: string; - resizePath: string; -}; -export type CuratedObjectsResponseDto = { - deviceAssetId: string; - deviceId: string; - id: string; - "object": string; - resizePath: string; -}; export type CheckExistingAssetsDto = { deviceAssetIds: string[]; deviceId: string; @@ -1363,22 +1349,6 @@ export function checkBulkUpload({ assetBulkUploadCheckDto }: { body: assetBulkUploadCheckDto }))); } -export function getCuratedLocations(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: CuratedLocationsResponseDto[]; - }>("/asset/curated-locations", { - ...opts - })); -} -export function getCuratedObjects(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: CuratedObjectsResponseDto[]; - }>("/asset/curated-objects", { - ...opts - })); -} /** * Get all asset of a device that are in the database, ID only. */ @@ -1479,14 +1449,6 @@ export function getRandom({ count }: { ...opts })); } -export function getAssetSearchTerms(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: string[]; - }>("/asset/search-terms", { - ...opts - })); -} export function updateStackParent({ updateStackParentDto }: { updateStackParentDto: UpdateStackParentDto; }, opts?: Oazapfts.RequestOpts) { diff --git a/server/src/controllers/asset-v1.controller.ts b/server/src/controllers/asset-v1.controller.ts index 2ba9aa7a03..e83df8d0d1 100644 --- a/server/src/controllers/asset-v1.controller.ts +++ b/server/src/controllers/asset-v1.controller.ts @@ -20,8 +20,6 @@ import { AssetBulkUploadCheckResponseDto, AssetFileUploadResponseDto, CheckExistingAssetsResponseDto, - CuratedLocationsResponseDto, - CuratedObjectsResponseDto, } from 'src/dtos/asset-v1-response.dto'; import { AssetBulkUploadCheckDto, @@ -111,21 +109,6 @@ export class AssetControllerV1 { await sendFile(res, next, () => this.service.serveThumbnail(auth, id, dto)); } - @Get('/curated-objects') - getCuratedObjects(@Auth() auth: AuthDto): Promise { - return this.service.getCuratedObject(auth); - } - - @Get('/curated-locations') - getCuratedLocations(@Auth() auth: AuthDto): Promise { - return this.service.getCuratedLocation(auth); - } - - @Get('/search-terms') - getAssetSearchTerms(@Auth() auth: AuthDto): Promise { - return this.service.getAssetSearchTerm(auth); - } - /** * Get all AssetEntity belong to the user */ diff --git a/server/src/dtos/asset-v1-response.dto.ts b/server/src/dtos/asset-v1-response.dto.ts index 4b1e97b478..687b336428 100644 --- a/server/src/dtos/asset-v1-response.dto.ts +++ b/server/src/dtos/asset-v1-response.dto.ts @@ -27,19 +27,3 @@ export class AssetFileUploadResponseDto { export class CheckExistingAssetsResponseDto { existingIds!: string[]; } - -export class CuratedLocationsResponseDto { - id!: string; - city!: string; - resizePath!: string; - deviceAssetId!: string; - deviceId!: string; -} - -export class CuratedObjectsResponseDto { - id!: string; - object!: string; - resizePath!: string; - deviceAssetId!: string; - deviceId!: string; -} diff --git a/server/src/dtos/asset-v1.dto.ts b/server/src/dtos/asset-v1.dto.ts index 50ff3d18b1..5cac6fbe65 100644 --- a/server/src/dtos/asset-v1.dto.ts +++ b/server/src/dtos/asset-v1.dto.ts @@ -130,19 +130,6 @@ export class GetAssetThumbnailDto { format: GetAssetThumbnailFormatEnum = GetAssetThumbnailFormatEnum.WEBP; } -export class SearchPropertiesDto { - tags?: string[]; - objects?: string[]; - assetType?: string; - orientation?: string; - lensModel?: string; - make?: string; - model?: string; - city?: string; - state?: string; - country?: string; -} - export class ServeFileDto { @ValidateBoolean({ optional: true }) @ApiProperty({ title: 'Is serve thumbnail (resize) file' }) diff --git a/server/src/interfaces/asset-v1.interface.ts b/server/src/interfaces/asset-v1.interface.ts index 8348bfaeea..799a303ba6 100644 --- a/server/src/interfaces/asset-v1.interface.ts +++ b/server/src/interfaces/asset-v1.interface.ts @@ -1,5 +1,4 @@ -import { CuratedLocationsResponseDto, CuratedObjectsResponseDto } from 'src/dtos/asset-v1-response.dto'; -import { AssetSearchDto, CheckExistingAssetsDto, SearchPropertiesDto } from 'src/dtos/asset-v1.dto'; +import { AssetSearchDto, CheckExistingAssetsDto } from 'src/dtos/asset-v1.dto'; import { AssetEntity } from 'src/entities/asset.entity'; export interface AssetCheck { @@ -13,10 +12,7 @@ export interface AssetOwnerCheck extends AssetCheck { export interface IAssetRepositoryV1 { get(id: string): Promise; - getLocationsByUserId(userId: string): Promise; - getDetectedObjectsByUserId(userId: string): Promise; getAllByUserId(userId: string, dto: AssetSearchDto): Promise; - getSearchPropertiesByUserId(userId: string): Promise; getAssetsByChecksums(userId: string, checksums: Buffer[]): Promise; getExistingAssets(userId: string, checkDuplicateAssetDto: CheckExistingAssetsDto): Promise; getByOriginalPath(originalPath: string): Promise; diff --git a/server/src/repositories/asset-v1.repository.ts b/server/src/repositories/asset-v1.repository.ts index 229e700fd5..4e346d5fdf 100644 --- a/server/src/repositories/asset-v1.repository.ts +++ b/server/src/repositories/asset-v1.repository.ts @@ -1,7 +1,6 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { CuratedLocationsResponseDto, CuratedObjectsResponseDto } from 'src/dtos/asset-v1-response.dto'; -import { AssetSearchDto, CheckExistingAssetsDto, SearchPropertiesDto } from 'src/dtos/asset-v1.dto'; +import { AssetSearchDto, CheckExistingAssetsDto } from 'src/dtos/asset-v1.dto'; import { AssetEntity } from 'src/entities/asset.entity'; import { AssetCheck, AssetOwnerCheck, IAssetRepositoryV1 } from 'src/interfaces/asset-v1.interface'; import { OptionalBetween } from 'src/utils/database'; @@ -42,56 +41,6 @@ export class AssetRepositoryV1 implements IAssetRepositoryV1 { }); } - getSearchPropertiesByUserId(userId: string): Promise { - return this.assetRepository - .createQueryBuilder('asset') - .where('asset.ownerId = :userId', { userId: userId }) - .andWhere('asset.isVisible = true') - .leftJoin('asset.exifInfo', 'ei') - .leftJoin('asset.smartInfo', 'si') - .select('si.tags', 'tags') - .addSelect('si.objects', 'objects') - .addSelect('asset.type', 'assetType') - .addSelect('ei.orientation', 'orientation') - .addSelect('ei."lensModel"', 'lensModel') - .addSelect('ei.make', 'make') - .addSelect('ei.model', 'model') - .addSelect('ei.city', 'city') - .addSelect('ei.state', 'state') - .addSelect('ei.country', 'country') - .distinctOn(['si.tags']) - .getRawMany(); - } - - getDetectedObjectsByUserId(userId: string): Promise { - return this.assetRepository.query( - ` - SELECT DISTINCT ON (unnest(si.objects)) a.id, unnest(si.objects) as "object", a."previewPath" AS "resizePath", a."deviceAssetId", a."deviceId" - FROM assets a - LEFT JOIN smart_info si ON a.id = si."assetId" - WHERE a."ownerId" = $1 - AND a."isVisible" = true - AND si.objects IS NOT NULL - `, - [userId], - ); - } - - getLocationsByUserId(userId: string): Promise { - return this.assetRepository.query( - ` - SELECT DISTINCT ON (e.city) a.id, e.city, a."previewPath" AS "resizePath", a."deviceAssetId", a."deviceId" - FROM assets a - LEFT JOIN exif e ON a.id = e."assetId" - WHERE a."ownerId" = $1 - AND a."isVisible" = true - AND e.city IS NOT NULL - AND a.type = 'IMAGE'; - `, - [userId], - ); - } - get(id: string): Promise { return this.assetRepository.findOne({ where: { id }, diff --git a/server/src/services/asset-v1.service.spec.ts b/server/src/services/asset-v1.service.spec.ts index bc088cb30b..40211ee40a 100644 --- a/server/src/services/asset-v1.service.spec.ts +++ b/server/src/services/asset-v1.service.spec.ts @@ -76,9 +76,6 @@ describe('AssetService', () => { assetRepositoryMockV1 = { get: vitest.fn(), getAllByUserId: vitest.fn(), - getDetectedObjectsByUserId: vitest.fn(), - getLocationsByUserId: vitest.fn(), - getSearchPropertiesByUserId: vitest.fn(), getAssetsByChecksums: vitest.fn(), getExistingAssets: vitest.fn(), getByOriginalPath: vitest.fn(), diff --git a/server/src/services/asset-v1.service.ts b/server/src/services/asset-v1.service.ts index 61fe5bd80b..e7affe1073 100644 --- a/server/src/services/asset-v1.service.ts +++ b/server/src/services/asset-v1.service.ts @@ -13,8 +13,6 @@ import { AssetRejectReason, AssetUploadAction, CheckExistingAssetsResponseDto, - CuratedLocationsResponseDto, - CuratedObjectsResponseDto, } from 'src/dtos/asset-v1-response.dto'; import { AssetBulkUploadCheckDto, @@ -156,48 +154,6 @@ export class AssetServiceV1 { }); } - async getAssetSearchTerm(auth: AuthDto): Promise { - const possibleSearchTerm = new Set(); - - const rows = await this.assetRepositoryV1.getSearchPropertiesByUserId(auth.user.id); - - for (const row of rows) { - // tags - row.tags?.map((tag: string) => possibleSearchTerm.add(tag?.toLowerCase())); - - // objects - row.objects?.map((object: string) => possibleSearchTerm.add(object?.toLowerCase())); - - // asset's tyoe - possibleSearchTerm.add(row.assetType?.toLowerCase() || ''); - - // image orientation - possibleSearchTerm.add(row.orientation?.toLowerCase() || ''); - - // Lens model - possibleSearchTerm.add(row.lensModel?.toLowerCase() || ''); - - // Make and model - possibleSearchTerm.add(row.make?.toLowerCase() || ''); - possibleSearchTerm.add(row.model?.toLowerCase() || ''); - - // Location - possibleSearchTerm.add(row.city?.toLowerCase() || ''); - possibleSearchTerm.add(row.state?.toLowerCase() || ''); - possibleSearchTerm.add(row.country?.toLowerCase() || ''); - } - - return [...possibleSearchTerm].filter((x) => x != null && x != ''); - } - - async getCuratedLocation(auth: AuthDto): Promise { - return this.assetRepositoryV1.getLocationsByUserId(auth.user.id); - } - - async getCuratedObject(auth: AuthDto): Promise { - return this.assetRepositoryV1.getDetectedObjectsByUserId(auth.user.id); - } - async checkExistingAssets( auth: AuthDto, checkExistingAssetsDto: CheckExistingAssetsDto,