mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
chore(server): remove unused property (#9521)
This commit is contained in:
parent
581b467b4b
commit
73bf8f343a
18 changed files with 19 additions and 131 deletions
|
|
@ -101,7 +101,6 @@ export class UserCore {
|
|||
type: LibraryType.UPLOAD,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
});
|
||||
|
||||
return userEntity;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@ export class CreateLibraryDto {
|
|||
@IsNotEmpty()
|
||||
name?: string;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
isVisible?: boolean;
|
||||
|
||||
@Optional()
|
||||
@IsString({ each: true })
|
||||
@IsNotEmpty({ each: true })
|
||||
|
|
@ -40,9 +37,6 @@ export class UpdateLibraryDto {
|
|||
@IsNotEmpty()
|
||||
name?: string;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
isVisible?: boolean;
|
||||
|
||||
@Optional()
|
||||
@IsString({ each: true })
|
||||
@IsNotEmpty({ each: true })
|
||||
|
|
|
|||
|
|
@ -50,9 +50,6 @@ export class LibraryEntity {
|
|||
|
||||
@Column({ type: 'timestamptz', nullable: true })
|
||||
refreshedAt!: Date | null;
|
||||
|
||||
@Column({ type: 'boolean', default: true })
|
||||
isVisible!: boolean;
|
||||
}
|
||||
|
||||
export enum LibraryType {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class RemoveLibraryIsVisible1715798702876 implements MigrationInterface {
|
||||
name = 'RemoveLibraryIsVisible1715798702876'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "libraries" DROP COLUMN "isVisible"`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "libraries" ADD "isVisible" boolean NOT NULL DEFAULT true`);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,7 +16,6 @@ FROM
|
|||
"LibraryEntity"."updatedAt" AS "LibraryEntity_updatedAt",
|
||||
"LibraryEntity"."deletedAt" AS "LibraryEntity_deletedAt",
|
||||
"LibraryEntity"."refreshedAt" AS "LibraryEntity_refreshedAt",
|
||||
"LibraryEntity"."isVisible" AS "LibraryEntity_isVisible",
|
||||
"LibraryEntity__LibraryEntity_owner"."id" AS "LibraryEntity__LibraryEntity_owner_id",
|
||||
"LibraryEntity__LibraryEntity_owner"."name" AS "LibraryEntity__LibraryEntity_owner_name",
|
||||
"LibraryEntity__LibraryEntity_owner"."avatarColor" AS "LibraryEntity__LibraryEntity_owner_avatarColor",
|
||||
|
|
@ -89,8 +88,7 @@ SELECT
|
|||
"LibraryEntity"."createdAt" AS "LibraryEntity_createdAt",
|
||||
"LibraryEntity"."updatedAt" AS "LibraryEntity_updatedAt",
|
||||
"LibraryEntity"."deletedAt" AS "LibraryEntity_deletedAt",
|
||||
"LibraryEntity"."refreshedAt" AS "LibraryEntity_refreshedAt",
|
||||
"LibraryEntity"."isVisible" AS "LibraryEntity_isVisible"
|
||||
"LibraryEntity"."refreshedAt" AS "LibraryEntity_refreshedAt"
|
||||
FROM
|
||||
"libraries" "LibraryEntity"
|
||||
WHERE
|
||||
|
|
@ -132,7 +130,6 @@ SELECT
|
|||
"LibraryEntity"."updatedAt" AS "LibraryEntity_updatedAt",
|
||||
"LibraryEntity"."deletedAt" AS "LibraryEntity_deletedAt",
|
||||
"LibraryEntity"."refreshedAt" AS "LibraryEntity_refreshedAt",
|
||||
"LibraryEntity"."isVisible" AS "LibraryEntity_isVisible",
|
||||
"LibraryEntity__LibraryEntity_owner"."id" AS "LibraryEntity__LibraryEntity_owner_id",
|
||||
"LibraryEntity__LibraryEntity_owner"."name" AS "LibraryEntity__LibraryEntity_owner_name",
|
||||
"LibraryEntity__LibraryEntity_owner"."avatarColor" AS "LibraryEntity__LibraryEntity_owner_avatarColor",
|
||||
|
|
@ -156,12 +153,7 @@ FROM
|
|||
"LibraryEntity__LibraryEntity_owner"."deletedAt" IS NULL
|
||||
)
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
("LibraryEntity"."ownerId" = $1)
|
||||
AND ("LibraryEntity"."isVisible" = $2)
|
||||
)
|
||||
)
|
||||
((("LibraryEntity"."ownerId" = $1)))
|
||||
AND ("LibraryEntity"."deletedAt" IS NULL)
|
||||
ORDER BY
|
||||
"LibraryEntity"."createdAt" ASC
|
||||
|
|
@ -178,7 +170,6 @@ SELECT
|
|||
"LibraryEntity"."updatedAt" AS "LibraryEntity_updatedAt",
|
||||
"LibraryEntity"."deletedAt" AS "LibraryEntity_deletedAt",
|
||||
"LibraryEntity"."refreshedAt" AS "LibraryEntity_refreshedAt",
|
||||
"LibraryEntity"."isVisible" AS "LibraryEntity_isVisible",
|
||||
"LibraryEntity__LibraryEntity_owner"."id" AS "LibraryEntity__LibraryEntity_owner_id",
|
||||
"LibraryEntity__LibraryEntity_owner"."name" AS "LibraryEntity__LibraryEntity_owner_name",
|
||||
"LibraryEntity__LibraryEntity_owner"."avatarColor" AS "LibraryEntity__LibraryEntity_owner_avatarColor",
|
||||
|
|
@ -218,7 +209,6 @@ SELECT
|
|||
"LibraryEntity"."updatedAt" AS "LibraryEntity_updatedAt",
|
||||
"LibraryEntity"."deletedAt" AS "LibraryEntity_deletedAt",
|
||||
"LibraryEntity"."refreshedAt" AS "LibraryEntity_refreshedAt",
|
||||
"LibraryEntity"."isVisible" AS "LibraryEntity_isVisible",
|
||||
"LibraryEntity__LibraryEntity_owner"."id" AS "LibraryEntity__LibraryEntity_owner_id",
|
||||
"LibraryEntity__LibraryEntity_owner"."name" AS "LibraryEntity__LibraryEntity_owner_name",
|
||||
"LibraryEntity__LibraryEntity_owner"."avatarColor" AS "LibraryEntity__LibraryEntity_owner_avatarColor",
|
||||
|
|
@ -239,10 +229,7 @@ FROM
|
|||
"libraries" "LibraryEntity"
|
||||
LEFT JOIN "users" "LibraryEntity__LibraryEntity_owner" ON "LibraryEntity__LibraryEntity_owner"."id" = "LibraryEntity"."ownerId"
|
||||
WHERE
|
||||
(
|
||||
("LibraryEntity"."isVisible" = $1)
|
||||
AND (NOT ("LibraryEntity"."deletedAt" IS NULL))
|
||||
)
|
||||
((NOT ("LibraryEntity"."deletedAt" IS NULL)))
|
||||
ORDER BY
|
||||
"LibraryEntity"."createdAt" ASC
|
||||
|
||||
|
|
@ -258,7 +245,6 @@ SELECT
|
|||
"libraries"."updatedAt" AS "libraries_updatedAt",
|
||||
"libraries"."deletedAt" AS "libraries_deletedAt",
|
||||
"libraries"."refreshedAt" AS "libraries_refreshedAt",
|
||||
"libraries"."isVisible" AS "libraries_isVisible",
|
||||
COUNT("assets"."id") FILTER (
|
||||
WHERE
|
||||
"assets"."type" = 'IMAGE'
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ export class LibraryRepository implements ILibraryRepository {
|
|||
return this.repository.find({
|
||||
where: {
|
||||
ownerId,
|
||||
isVisible: true,
|
||||
type,
|
||||
},
|
||||
relations: {
|
||||
|
|
@ -97,7 +96,6 @@ export class LibraryRepository implements ILibraryRepository {
|
|||
getAllDeleted(): Promise<LibraryEntity[]> {
|
||||
return this.repository.find({
|
||||
where: {
|
||||
isVisible: true,
|
||||
deletedAt: Not(IsNull()),
|
||||
},
|
||||
relations: {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,6 @@ export class AssetServiceV1 {
|
|||
type: LibraryType.UPLOAD,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -830,7 +830,6 @@ describe(LibraryService.name, () => {
|
|||
type: LibraryType.EXTERNAL,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
@ -860,37 +859,6 @@ describe(LibraryService.name, () => {
|
|||
type: LibraryType.EXTERNAL,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should create invisible', async () => {
|
||||
libraryMock.create.mockResolvedValue(libraryStub.externalLibrary1);
|
||||
await expect(
|
||||
sut.create({ ownerId: authStub.admin.user.id, type: LibraryType.EXTERNAL, isVisible: false }),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
id: libraryStub.externalLibrary1.id,
|
||||
type: LibraryType.EXTERNAL,
|
||||
name: libraryStub.externalLibrary1.name,
|
||||
ownerId: libraryStub.externalLibrary1.ownerId,
|
||||
assetCount: 0,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
createdAt: libraryStub.externalLibrary1.createdAt,
|
||||
updatedAt: libraryStub.externalLibrary1.updatedAt,
|
||||
refreshedAt: null,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(libraryMock.create).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
name: expect.any(String),
|
||||
type: LibraryType.EXTERNAL,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
@ -924,7 +892,6 @@ describe(LibraryService.name, () => {
|
|||
type: LibraryType.EXTERNAL,
|
||||
importPaths: ['/data/images', '/data/videos'],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
@ -972,7 +939,6 @@ describe(LibraryService.name, () => {
|
|||
type: LibraryType.EXTERNAL,
|
||||
importPaths: [],
|
||||
exclusionPatterns: ['*.tmp', '*.bak'],
|
||||
isVisible: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
@ -1002,7 +968,6 @@ describe(LibraryService.name, () => {
|
|||
type: LibraryType.UPLOAD,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
@ -1032,7 +997,6 @@ describe(LibraryService.name, () => {
|
|||
type: LibraryType.UPLOAD,
|
||||
importPaths: [],
|
||||
exclusionPatterns: [],
|
||||
isVisible: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -271,7 +271,6 @@ export class LibraryService {
|
|||
type: dto.type,
|
||||
importPaths: dto.importPaths ?? [],
|
||||
exclusionPatterns: dto.exclusionPatterns ?? [],
|
||||
isVisible: dto.isVisible ?? true,
|
||||
});
|
||||
|
||||
this.logger.log(`Creating ${dto.type} library for ${dto.ownerId}}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue