From 64831e2328c25ada45949b560eb6ad16397b9c1d Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Thu, 7 Nov 2024 11:25:10 -0500 Subject: [PATCH] refactor: remove smart info table (#13985) --- e2e/src/api/specs/search.e2e-spec.ts | 5 +- mobile/openapi/README.md | Bin 32130 -> 32074 bytes mobile/openapi/lib/api.dart | Bin 11663 -> 11620 bytes mobile/openapi/lib/api_client.dart | Bin 29911 -> 29819 bytes .../openapi/lib/model/asset_response_dto.dart | Bin 13888 -> 13172 bytes .../lib/model/smart_info_response_dto.dart | Bin 3540 -> 0 bytes open-api/immich-openapi-specs.json | 22 ------ open-api/typescript-sdk/src/fetch-client.ts | 5 -- server/src/dtos/asset-response.dto.ts | 15 ---- server/src/entities/asset.entity.ts | 4 -- server/src/entities/index.ts | 2 - server/src/entities/smart-info.entity.ts | 18 ----- server/src/interfaces/asset.interface.ts | 4 -- server/src/interfaces/search.interface.ts | 1 - .../1730989238718-DropSmartInfoTable.ts | 11 +++ server/src/queries/asset.repository.sql | 34 --------- server/src/repositories/asset.repository.ts | 65 ------------------ server/src/repositories/search.repository.ts | 4 +- server/src/services/asset.service.ts | 2 - server/src/services/search.service.spec.ts | 5 -- server/src/services/search.service.ts | 6 +- server/src/utils/database.ts | 5 -- server/test/fixtures/shared-link.stub.ts | 10 --- .../repositories/asset.repository.mock.ts | 1 - web/src/routes/(user)/explore/+page.svelte | 2 - 25 files changed, 15 insertions(+), 206 deletions(-) delete mode 100644 mobile/openapi/lib/model/smart_info_response_dto.dart delete mode 100644 server/src/entities/smart-info.entity.ts create mode 100644 server/src/migrations/1730989238718-DropSmartInfoTable.ts diff --git a/e2e/src/api/specs/search.e2e-spec.ts b/e2e/src/api/specs/search.e2e-spec.ts index 0e5d882f80..627fbb3e9e 100644 --- a/e2e/src/api/specs/search.e2e-spec.ts +++ b/e2e/src/api/specs/search.e2e-spec.ts @@ -473,10 +473,7 @@ describe('/search', () => { .get('/search/explore') .set('Authorization', `Bearer ${admin.accessToken}`); expect(status).toBe(200); - expect(body).toEqual([ - { fieldName: 'exifInfo.city', items: [] }, - { fieldName: 'smartInfo.tags', items: [] }, - ]); + expect(body).toEqual([{ fieldName: 'exifInfo.city', items: [] }]); }); }); diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index ebd8cd9bdcc8d6a8887dd062f15091fa0789c248..47bbc4be3c9256877f3959f615ba81e1bcf0e7af 100644 GIT binary patch delta 14 VcmZqr&3Nh;;|7-8%{IAi0su7Z1{VMT delta 35 ncmX^0i?Qi9;|7*o7SFu2{K<*g!W_AYMI~U)!*tP2xn2SQ2(u0t diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index b4c51c8e997e34570937d816dbef86db3aa9edad..e1c343ad50d1df8fdc0f4581e70d8e62053c4e6d 100644 GIT binary patch delta 12 TcmeB=eiF4|o&4sT^4oX;DsToA delta 21 dcmaD7)gQfKojglsURwTSL0P5EE9H0d0sv+22z&ql diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index b6ddf86e70dfc8c1545367e05625d7bb3536bbeb..b71e6f45f71cb801c37c735f213e2a0eb5cabee4 100644 GIT binary patch delta 14 VcmccqlJWNo#tp`SoBIPjlmR=x2G{@q delta 36 ocmezUg7NxG#tp`SES`C3`I8g<6gYAdi%P(piD}xK^#XmB0V13ZYXATM diff --git a/mobile/openapi/lib/model/asset_response_dto.dart b/mobile/openapi/lib/model/asset_response_dto.dart index c11dedcbfd230d102e1aaa66d0e4251be227ec22..5f01f84419e4e09c667ffe51d412bc01fe312019 100644 GIT binary patch delta 42 zcmV+_0M-A%Z1iTZ9t5*81kVVwf)3RLvwIVa1hYFBIs>zd8_ox_+#_HKvw|(Y2zMC} Ax&QzG delta 262 zcmey8b|7bi91BNoVo`}_URwTUA(q=5o7p(x80BC>L8-+B`FX{uE+zT)3dJzd%`bRv zv53NW3bwXLQkw;5vnU`-<(1~-DA+3)C|Dt>vJ&%S7KW*^RY92CDtVEe1tc+fg0!p* zTwFa?!B(LpBePf!E;RX}tQ;qTSD+v|87QzhR56iL7-q7SLNJUunO|RY@?A}KZnzfp L*v+f7PH_ML=vQ7Z diff --git a/mobile/openapi/lib/model/smart_info_response_dto.dart b/mobile/openapi/lib/model/smart_info_response_dto.dart deleted file mode 100644 index 4631eccf2cb1c20fe489eafd2b0e982123b9249e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3540 zcmb_fTW{Mo6n^)wI4O!o##Fi6Q{m1|i^UnzH8GH64})O{j6~b)WKkul8b<2>zH@ky zF({BEVW^!NkxtU#X@jpx9iSeg($gB3t2AF%&b_M zzJHfyE2ea>hv5v!1;~n*tP%R>jH_lt%t@2~9om?*#(q0O(? zMu~DcJ^}BfV}(4}*B|9~t`s&7H{VKGQ0a;psbDmUrZx$XX2n$>Mq_Xd&R7vql5tr1 z@xwiVc%)5l-q_^Robzh(t!9NV+XRtjg^sNEP%pZ4h4D6yC=a{`sp&=~swB#ArnyD@E45_o?T4-w)HT@q!Sr-MIz&jX*-mCJ9{3pYEl!Wf#_0RAmL+<2 z%vy+&74Q{bA+H`--|arwTEqe@ya5w9a%BZCU_H##u}|iBj^5g&b#8XR3(b9GYM{Mlxhf{WHZDQnMM-%j~rx{q8gA+Fm0!Q{cD{8J`q2${8 zo7q<=01GrYCY6{WT=Upb%MQRsXsZh?epZSvP@?Sot2)D()G1ACiehI(mZC1MWKMi_ zFFG~l#O7gH;924F3t-mOQn8%0EV4<)@T!Y}uW-Uhn}{3Mjz%482yOrlxMfX}j5T7k z=Vat&m7MwZcg2frG&1re8$P5DW^j%t1G_Cqy!JmQ5D~=>2+H=h{dQjCsGk@~su?Yn z+>oy!EKrts|G?+)o(xkoqE(ZY=h*W(dBgudA&=0`=IvV>2ydC~S>ld}j>BvW1@_?# zX?s8y>SYXf_HYP2!hyF)nEJ&VXKk%-bkt+((dLSITVSyyHo z{35aNEQ-8)xxqu!n(o&F^&Blnol}s|FxsjRWZx))a8Kt4T0_gOoP_1MBYkV9YcpvE z86Gs}bPaUJ>H(VgR&4{G34Ib=hl;4HuBw;eYMmw4wuRC&_+rCmZsXs4 zOQ)FK?>M@LHNblSGHz`h83Yi?y6u!xEZ7LM!dEm?bfxS<;+2vC-LJ_b zQp?ZmMeA^Xe10uYXt|RsFP&iw+-A`e;r mapTag(tag)), people: peopleWithFaces(entity.faces), @@ -161,15 +158,3 @@ export class MemoryLaneResponseDto { assets!: AssetResponseDto[]; } - -export class SmartInfoResponseDto { - tags?: string[] | null; - objects?: string[] | null; -} - -export function mapSmartInfo(entity: SmartInfoEntity): SmartInfoResponseDto { - return { - tags: entity.tags, - objects: entity.objects, - }; -} diff --git a/server/src/entities/asset.entity.ts b/server/src/entities/asset.entity.ts index 0b893134d0..f9e5c5e981 100644 --- a/server/src/entities/asset.entity.ts +++ b/server/src/entities/asset.entity.ts @@ -5,7 +5,6 @@ import { AssetJobStatusEntity } from 'src/entities/asset-job-status.entity'; import { ExifEntity } from 'src/entities/exif.entity'; import { LibraryEntity } from 'src/entities/library.entity'; import { SharedLinkEntity } from 'src/entities/shared-link.entity'; -import { SmartInfoEntity } from 'src/entities/smart-info.entity'; import { SmartSearchEntity } from 'src/entities/smart-search.entity'; import { StackEntity } from 'src/entities/stack.entity'; import { TagEntity } from 'src/entities/tag.entity'; @@ -143,9 +142,6 @@ export class AssetEntity { @OneToOne(() => ExifEntity, (exifEntity) => exifEntity.asset) exifInfo?: ExifEntity; - @OneToOne(() => SmartInfoEntity, (smartInfoEntity) => smartInfoEntity.asset) - smartInfo?: SmartInfoEntity; - @OneToOne(() => SmartSearchEntity, (smartSearchEntity) => smartSearchEntity.asset) smartSearch?: SmartSearchEntity; diff --git a/server/src/entities/index.ts b/server/src/entities/index.ts index 7425ee67d8..75e92038ac 100644 --- a/server/src/entities/index.ts +++ b/server/src/entities/index.ts @@ -18,7 +18,6 @@ import { PartnerEntity } from 'src/entities/partner.entity'; import { PersonEntity } from 'src/entities/person.entity'; import { SessionEntity } from 'src/entities/session.entity'; import { SharedLinkEntity } from 'src/entities/shared-link.entity'; -import { SmartInfoEntity } from 'src/entities/smart-info.entity'; import { SmartSearchEntity } from 'src/entities/smart-search.entity'; import { StackEntity } from 'src/entities/stack.entity'; import { SystemMetadataEntity } from 'src/entities/system-metadata.entity'; @@ -46,7 +45,6 @@ export const entities = [ PartnerEntity, PersonEntity, SharedLinkEntity, - SmartInfoEntity, SmartSearchEntity, StackEntity, SystemMetadataEntity, diff --git a/server/src/entities/smart-info.entity.ts b/server/src/entities/smart-info.entity.ts deleted file mode 100644 index 86190c174d..0000000000 --- a/server/src/entities/smart-info.entity.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { AssetEntity } from 'src/entities/asset.entity'; -import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm'; - -@Entity('smart_info', { synchronize: false }) -export class SmartInfoEntity { - @OneToOne(() => AssetEntity, { onDelete: 'CASCADE', nullable: true }) - @JoinColumn({ name: 'assetId', referencedColumnName: 'id' }) - asset?: AssetEntity; - - @PrimaryColumn() - assetId!: string; - - @Column({ type: 'text', array: true, nullable: true }) - tags!: string[] | null; - - @Column({ type: 'text', array: true, nullable: true }) - objects!: string[] | null; -} diff --git a/server/src/interfaces/asset.interface.ts b/server/src/interfaces/asset.interface.ts index 37d3326a8a..1b32c57d41 100644 --- a/server/src/interfaces/asset.interface.ts +++ b/server/src/interfaces/asset.interface.ts @@ -28,9 +28,7 @@ export enum WithoutProperty { EXIF = 'exif', SMART_SEARCH = 'smart-search', DUPLICATE = 'duplicate', - OBJECT_TAGS = 'object-tags', FACES = 'faces', - PERSON = 'person', SIDECAR = 'sidecar', } @@ -94,7 +92,6 @@ export type AssetWithoutRelations = Omit< | 'library' | 'exifInfo' | 'sharedLinks' - | 'smartInfo' | 'smartSearch' | 'tags' >; @@ -190,7 +187,6 @@ export interface IAssetRepository { upsertExif(exif: Partial): Promise; upsertJobStatus(...jobStatus: Partial[]): Promise; getAssetIdByCity(userId: string, options: AssetExploreFieldOptions): Promise>; - getAssetIdByTag(userId: string, options: AssetExploreFieldOptions): Promise>; getDuplicates(options: AssetBuilderOptions): Promise; getAllForUserFullSync(options: AssetFullSyncOptions): Promise; getChangedDeltaSync(options: AssetDeltaSyncOptions): Promise; diff --git a/server/src/interfaces/search.interface.ts b/server/src/interfaces/search.interface.ts index 63d74a35fb..87bf1bc4b1 100644 --- a/server/src/interfaces/search.interface.ts +++ b/server/src/interfaces/search.interface.ts @@ -68,7 +68,6 @@ export interface SearchStatusOptions { export interface SearchOneToOneRelationOptions { withExif?: boolean; - withSmartInfo?: boolean; withStacked?: boolean; } diff --git a/server/src/migrations/1730989238718-DropSmartInfoTable.ts b/server/src/migrations/1730989238718-DropSmartInfoTable.ts new file mode 100644 index 0000000000..a4de2652d6 --- /dev/null +++ b/server/src/migrations/1730989238718-DropSmartInfoTable.ts @@ -0,0 +1,11 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class DropSmartInfoTable1730989238718 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE smart_info`); + } + + public async down(): Promise { + // not implemented + } +} diff --git a/server/src/queries/asset.repository.sql b/server/src/queries/asset.repository.sql index 98edc8da1d..e7f5b558b0 100644 --- a/server/src/queries/asset.repository.sql +++ b/server/src/queries/asset.repository.sql @@ -183,9 +183,6 @@ SELECT "AssetEntity__AssetEntity_exifInfo"."bitsPerSample" AS "AssetEntity__AssetEntity_exifInfo_bitsPerSample", "AssetEntity__AssetEntity_exifInfo"."rating" AS "AssetEntity__AssetEntity_exifInfo_rating", "AssetEntity__AssetEntity_exifInfo"."fps" AS "AssetEntity__AssetEntity_exifInfo_fps", - "AssetEntity__AssetEntity_smartInfo"."assetId" AS "AssetEntity__AssetEntity_smartInfo_assetId", - "AssetEntity__AssetEntity_smartInfo"."tags" AS "AssetEntity__AssetEntity_smartInfo_tags", - "AssetEntity__AssetEntity_smartInfo"."objects" AS "AssetEntity__AssetEntity_smartInfo_objects", "AssetEntity__AssetEntity_tags"."id" AS "AssetEntity__AssetEntity_tags_id", "AssetEntity__AssetEntity_tags"."value" AS "AssetEntity__AssetEntity_tags_value", "AssetEntity__AssetEntity_tags"."createdAt" AS "AssetEntity__AssetEntity_tags_createdAt", @@ -252,7 +249,6 @@ SELECT FROM "assets" "AssetEntity" LEFT JOIN "exif" "AssetEntity__AssetEntity_exifInfo" ON "AssetEntity__AssetEntity_exifInfo"."assetId" = "AssetEntity"."id" - LEFT JOIN "smart_info" "AssetEntity__AssetEntity_smartInfo" ON "AssetEntity__AssetEntity_smartInfo"."assetId" = "AssetEntity"."id" LEFT JOIN "tag_asset" "AssetEntity_AssetEntity__AssetEntity_tags" ON "AssetEntity_AssetEntity__AssetEntity_tags"."assetsId" = "AssetEntity"."id" LEFT JOIN "tags" "AssetEntity__AssetEntity_tags" ON "AssetEntity__AssetEntity_tags"."id" = "AssetEntity_AssetEntity__AssetEntity_tags"."tagsId" LEFT JOIN "asset_faces" "AssetEntity__AssetEntity_faces" ON "AssetEntity__AssetEntity_faces"."assetId" = "AssetEntity"."id" @@ -932,36 +928,6 @@ WHERE LIMIT 12 --- AssetRepository.getAssetIdByTag -WITH - "random_tags" AS ( - SELECT - unnest(tags) AS "tag" - FROM - "smart_info" "si" - GROUP BY - tag - HAVING - count(*) >= $1 - ) -SELECT DISTINCT - ON (unnest("si"."tags")) "asset"."id" AS "data", - unnest("si"."tags") AS "value" -FROM - "assets" "asset" - INNER JOIN "smart_info" "si" ON "asset"."id" = si."assetId" - INNER JOIN "random_tags" "t" ON "si"."tags" @> ARRAY[t.tag] -WHERE - ( - "asset"."isVisible" = true - AND "asset"."type" = $2 - AND "asset"."ownerId" IN ($3) - AND "asset"."isArchived" = $4 - ) - AND ("asset"."deletedAt" IS NULL) -LIMIT - 12 - -- AssetRepository.getAllForUserFullSync SELECT "asset"."id" AS "asset_id", diff --git a/server/src/repositories/asset.repository.ts b/server/src/repositories/asset.repository.ts index a50dd0f79c..ce7d257b40 100644 --- a/server/src/repositories/asset.repository.ts +++ b/server/src/repositories/asset.repository.ts @@ -5,7 +5,6 @@ import { AssetFileEntity } from 'src/entities/asset-files.entity'; import { AssetJobStatusEntity } from 'src/entities/asset-job-status.entity'; import { AssetEntity } from 'src/entities/asset.entity'; import { ExifEntity } from 'src/entities/exif.entity'; -import { SmartInfoEntity } from 'src/entities/smart-info.entity'; import { AssetFileType, AssetOrder, AssetStatus, AssetType, PaginationMode } from 'src/enum'; import { AssetBuilderOptions, @@ -60,7 +59,6 @@ export class AssetRepository implements IAssetRepository { @InjectRepository(AssetFileEntity) private fileRepository: Repository, @InjectRepository(ExifEntity) private exifRepository: Repository, @InjectRepository(AssetJobStatusEntity) private jobStatusRepository: Repository, - @InjectRepository(SmartInfoEntity) private smartInfoRepository: Repository, ) {} async upsertExif(exif: Partial): Promise { @@ -119,7 +117,6 @@ export class AssetRepository implements IAssetRepository { where: { id: In(ids) }, relations: { exifInfo: true, - smartInfo: true, tags: true, faces: { person: true, @@ -422,22 +419,6 @@ export class AssetRepository implements IAssetRepository { break; } - case WithoutProperty.OBJECT_TAGS: { - relations = { - smartInfo: true, - }; - where = { - jobStatus: { - previewAt: Not(IsNull()), - }, - isVisible: true, - smartInfo: { - tags: IsNull(), - }, - }; - break; - } - case WithoutProperty.FACES: { relations = { faces: true, @@ -457,23 +438,6 @@ export class AssetRepository implements IAssetRepository { break; } - case WithoutProperty.PERSON: { - relations = { - faces: true, - }; - where = { - jobStatus: { - previewAt: Not(IsNull()), - }, - isVisible: true, - faces: { - assetId: Not(IsNull()), - personId: IsNull(), - }, - }; - break; - } - case WithoutProperty.SIDECAR: { where = [ { sidecarPath: IsNull(), isVisible: true }, @@ -611,35 +575,6 @@ export class AssetRepository implements IAssetRepository { return { fieldName: 'exifInfo.city', items }; } - @GenerateSql({ params: [DummyValue.UUID, { minAssetsPerField: 5, maxFields: 12 }] }) - async getAssetIdByTag( - ownerId: string, - { minAssetsPerField, maxFields }: AssetExploreFieldOptions, - ): Promise> { - const cte = this.smartInfoRepository - .createQueryBuilder('si') - .select('unnest(tags)', 'tag') - .groupBy('tag') - .having('count(*) >= :minAssetsPerField', { minAssetsPerField }); - - const items = await this.getBuilder({ - userIds: [ownerId], - exifInfo: false, - assetType: AssetType.IMAGE, - isArchived: false, - }) - .select('unnest(si.tags)', 'value') - .addSelect('asset.id', 'data') - .distinctOn(['unnest(si.tags)']) - .innerJoin('smart_info', 'si', 'asset.id = si."assetId"') - .addCommonTableExpression(cte, 'random_tags') - .innerJoin('random_tags', 't', 'si.tags @> ARRAY[t.tag]') - .limit(maxFields) - .getRawMany(); - - return { fieldName: 'smartInfo.tags', items }; - } - private getBuilder(options: AssetBuilderOptions) { const builder = this.repository.createQueryBuilder('asset').where('asset.isVisible = true'); diff --git a/server/src/repositories/search.repository.ts b/server/src/repositories/search.repository.ts index b5969beecb..01b7773076 100644 --- a/server/src/repositories/search.repository.ts +++ b/server/src/repositories/search.repository.ts @@ -6,7 +6,6 @@ import { AssetFaceEntity } from 'src/entities/asset-face.entity'; import { AssetEntity } from 'src/entities/asset.entity'; import { ExifEntity } from 'src/entities/exif.entity'; import { GeodataPlacesEntity } from 'src/entities/geodata-places.entity'; -import { SmartInfoEntity } from 'src/entities/smart-info.entity'; import { SmartSearchEntity } from 'src/entities/smart-search.entity'; import { AssetType, PaginationMode } from 'src/enum'; import { IConfigRepository } from 'src/interfaces/config.interface'; @@ -34,7 +33,6 @@ export class SearchRepository implements ISearchRepository { private assetsByCityQuery: string; constructor( - @InjectRepository(SmartInfoEntity) private repository: Repository, @InjectRepository(AssetEntity) private assetRepository: Repository, @InjectRepository(ExifEntity) private exifRepository: Repository, @InjectRepository(AssetFaceEntity) private assetFaceRepository: Repository, @@ -278,7 +276,7 @@ export class SearchRepository implements ISearchRepository { @GenerateSql({ params: [[DummyValue.UUID]] }) async getAssetsByCity(userIds: string[]): Promise { const parameters = [userIds, true, false, AssetType.IMAGE]; - const rawRes = await this.repository.query(this.assetsByCityQuery, parameters); + const rawRes = await this.assetRepository.query(this.assetsByCityQuery, parameters); const items: AssetEntity[] = []; for (const res of rawRes) { diff --git a/server/src/services/asset.service.ts b/server/src/services/asset.service.ts index e9f128194b..98d6ec00f6 100644 --- a/server/src/services/asset.service.ts +++ b/server/src/services/asset.service.ts @@ -94,7 +94,6 @@ export class AssetService extends BaseService { { exifInfo: true, sharedLinks: true, - smartInfo: true, tags: true, owner: true, faces: { @@ -162,7 +161,6 @@ export class AssetService extends BaseService { const asset = await this.assetRepository.getById(id, { exifInfo: true, owner: true, - smartInfo: true, tags: true, faces: { person: true, diff --git a/server/src/services/search.service.spec.ts b/server/src/services/search.service.spec.ts index e0b03f31ae..0f95d88083 100644 --- a/server/src/services/search.service.spec.ts +++ b/server/src/services/search.service.spec.ts @@ -47,14 +47,9 @@ describe(SearchService.name, () => { fieldName: 'exifInfo.city', items: [{ value: 'Paris', data: assetStub.image.id }], }); - assetMock.getAssetIdByTag.mockResolvedValue({ - fieldName: 'smartInfo.tags', - items: [{ value: 'train', data: assetStub.imageFrom2015.id }], - }); assetMock.getByIdsWithAllRelations.mockResolvedValue([assetStub.image, assetStub.imageFrom2015]); const expectedResponse = [ { fieldName: 'exifInfo.city', items: [{ value: 'Paris', data: mapAsset(assetStub.image) }] }, - { fieldName: 'smartInfo.tags', items: [{ value: 'train', data: mapAsset(assetStub.imageFrom2015) }] }, ]; const result = await sut.getExploreData(authStub.user1); diff --git a/server/src/services/search.service.ts b/server/src/services/search.service.ts index 03ffbe97db..04d3addb63 100644 --- a/server/src/services/search.service.ts +++ b/server/src/services/search.service.ts @@ -34,10 +34,8 @@ export class SearchService extends BaseService { async getExploreData(auth: AuthDto): Promise[]> { const options = { maxFields: 12, minAssetsPerField: 5 }; - const results = await Promise.all([ - this.assetRepository.getAssetIdByCity(auth.user.id, options), - this.assetRepository.getAssetIdByTag(auth.user.id, options), - ]); + const result = await this.assetRepository.getAssetIdByCity(auth.user.id, options); + const results = [result]; const assetIds = new Set(results.flatMap((field) => field.items.map((item) => item.data))); const assets = await this.assetRepository.getByIdsWithAllRelations([...assetIds]); const assetMap = new Map(assets.map((asset) => [asset.id, mapAsset(asset)])); diff --git a/server/src/utils/database.ts b/server/src/utils/database.ts index 55e4fcb0e5..ad2198b38c 100644 --- a/server/src/utils/database.ts +++ b/server/src/utils/database.ts @@ -90,7 +90,6 @@ export function searchAssetBuilder( isNotInAlbum, withFaces, withPeople, - withSmartInfo, personIds, withStacked, trashedAfter, @@ -123,10 +122,6 @@ export function searchAssetBuilder( builder.leftJoinAndSelect('faces.person', 'person'); } - if (withSmartInfo) { - builder.leftJoinAndSelect(`${builder.alias}.smartInfo`, 'smartInfo'); - } - if (personIds && personIds.length > 0) { const cte = builder .createQueryBuilder() diff --git a/server/test/fixtures/shared-link.stub.ts b/server/test/fixtures/shared-link.stub.ts index e446a6180b..a8b8e02d74 100644 --- a/server/test/fixtures/shared-link.stub.ts +++ b/server/test/fixtures/shared-link.stub.ts @@ -62,10 +62,6 @@ const assetResponse: AssetResponseDto = { updatedAt: today, isFavorite: false, isArchived: false, - smartInfo: { - tags: [], - objects: ['a', 'b', 'c'], - }, duration: '0:00:00.00000', exifInfo: assetInfo, livePhotoVideoId: null, @@ -205,12 +201,6 @@ export const sharedLinkStub = { isArchived: false, isExternal: false, isOffline: false, - smartInfo: { - assetId: 'id_1', - tags: [], - objects: ['a', 'b', 'c'], - asset: null as any, - }, files: [], thumbhash: null, encodedVideoPath: '', diff --git a/server/test/repositories/asset.repository.mock.ts b/server/test/repositories/asset.repository.mock.ts index 982273ff69..928a7956c5 100644 --- a/server/test/repositories/asset.repository.mock.ts +++ b/server/test/repositories/asset.repository.mock.ts @@ -33,7 +33,6 @@ export const newAssetRepositoryMock = (): Mocked => { getTimeBucket: vitest.fn(), getTimeBuckets: vitest.fn(), getAssetIdByCity: vitest.fn(), - getAssetIdByTag: vitest.fn(), getAllForUserFullSync: vitest.fn(), getChangedDeltaSync: vitest.fn(), getDuplicates: vitest.fn(), diff --git a/web/src/routes/(user)/explore/+page.svelte b/web/src/routes/(user)/explore/+page.svelte index 18c9dffdf3..ebd2e96b5a 100644 --- a/web/src/routes/(user)/explore/+page.svelte +++ b/web/src/routes/(user)/explore/+page.svelte @@ -16,8 +16,6 @@ enum Field { CITY = 'exifInfo.city', - TAGS = 'smartInfo.tags', - OBJECTS = 'smartInfo.objects', } const getFieldItems = (items: SearchExploreResponseDto[], field: Field) => {