Skip to content

High performance self-hosted photo and video management solution.

chore(server): remove unused property (#9521)

Jason Rasmussen73bf8f343ac1
diff --git a/mobile/openapi/doc/CreateLibraryDto.md b/mobile/openapi/doc/CreateLibraryDto.md
index 01a2a0f917..f7d5c0ecfe 100644
--- a/mobile/openapi/doc/CreateLibraryDto.md
+++ b/mobile/openapi/doc/CreateLibraryDto.md
@@ -10,7 +10,6 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**exclusionPatterns** | **List<String>** | | [optional] [default to const []]
**importPaths** | **List<String>** | | [optional] [default to const []]
-**isVisible** | **bool** | | [optional]
**name** | **String** | | [optional]
**ownerId** | **String** | |
**type** | [**LibraryType**](LibraryType.md) | |
diff --git a/mobile/openapi/doc/UpdateLibraryDto.md b/mobile/openapi/doc/UpdateLibraryDto.md
index 0f0e2652b8..432e2aee41 100644
--- a/mobile/openapi/doc/UpdateLibraryDto.md
+++ b/mobile/openapi/doc/UpdateLibraryDto.md
@@ -10,7 +10,6 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**exclusionPatterns** | **List<String>** | | [optional] [default to const []]
**importPaths** | **List<String>** | | [optional] [default to const []]
-**isVisible** | **bool** | | [optional]
**name** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/mobile/openapi/lib/model/create_library_dto.dart b/mobile/openapi/lib/model/create_library_dto.dart
index 93fb89b701..532ddd68e3 100644
--- a/mobile/openapi/lib/model/create_library_dto.dart
+++ b/mobile/openapi/lib/model/create_library_dto.dart
@@ -15,7 +15,6 @@ class CreateLibraryDto {
CreateLibraryDto({
this.exclusionPatterns = const [],
this.importPaths = const [],
- this.isVisible,
this.name,
required this.ownerId,
required this.type,
@@ -25,14 +24,6 @@ class CreateLibraryDto {
List<String> importPaths;
- ///
- /// Please note: This property should have been non-nullable! Since the specification file
- /// does not include a default value (using the "default:" property), however, the generated
- /// source code must fall back to having a nullable type.
- /// Consider adding a "default:" property in the specification file to hide this note.
- ///
- bool? isVisible;
-
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
@@ -49,7 +40,6 @@ class CreateLibraryDto {
bool operator ==(Object other) => identical(this, other) || other is CreateLibraryDto &&
_deepEquality.equals(other.exclusionPatterns, exclusionPatterns) &&
_deepEquality.equals(other.importPaths, importPaths) &&
- other.isVisible == isVisible &&
other.name == name &&
other.ownerId == ownerId &&
other.type == type;
@@ -59,23 +49,17 @@ class CreateLibraryDto {
// ignore: unnecessary_parenthesis
(exclusionPatterns.hashCode) +
(importPaths.hashCode) +
- (isVisible == null ? 0 : isVisible!.hashCode) +
(name == null ? 0 : name!.hashCode) +
(ownerId.hashCode) +
(type.hashCode);
@override
- String toString() => 'CreateLibraryDto[exclusionPatterns=$exclusionPatterns, importPaths=$importPaths, isVisible=$isVisible, name=$name, ownerId=$ownerId, type=$type]';
+ String toString() => 'CreateLibraryDto[exclusionPatterns=$exclusionPatterns, importPaths=$importPaths, name=$name, ownerId=$ownerId, type=$type]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'exclusionPatterns'] = this.exclusionPatterns;
json[r'importPaths'] = this.importPaths;
- if (this.isVisible != null) {
- json[r'isVisible'] = this.isVisible;
- } else {
- // json[r'isVisible'] = null;
- }
if (this.name != null) {
json[r'name'] = this.name;
} else {
@@ -100,7 +84,6 @@ class CreateLibraryDto {
importPaths: json[r'importPaths'] is Iterable
? (json[r'importPaths'] as Iterable).cast<String>().toList(growable: false)
: const [],
- isVisible: mapValueOfType<bool>(json, r'isVisible'),
name: mapValueOfType<String>(json, r'name'),
ownerId: mapValueOfType<String>(json, r'ownerId')!,
type: LibraryType.fromJson(json[r'type'])!,
diff --git a/mobile/openapi/lib/model/update_library_dto.dart b/mobile/openapi/lib/model/update_library_dto.dart
index b870f240fe..f197ca8599 100644
--- a/mobile/openapi/lib/model/update_library_dto.dart
+++ b/mobile/openapi/lib/model/update_library_dto.dart
@@ -15,7 +15,6 @@ class UpdateLibraryDto {
UpdateLibraryDto({
this.exclusionPatterns = const [],
this.importPaths = const [],
- this.isVisible,
this.name,
});
@@ -23,14 +22,6 @@ class UpdateLibraryDto {
List<String> importPaths;
- ///
- /// Please note: This property should have been non-nullable! Since the specification file
- /// does not include a default value (using the "default:" property), however, the generated
- /// source code must fall back to having a nullable type.
- /// Consider adding a "default:" property in the specification file to hide this note.
- ///
- bool? isVisible;
-
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
@@ -43,7 +34,6 @@ class UpdateLibraryDto {
bool operator ==(Object other) => identical(this, other) || other is UpdateLibraryDto &&
_deepEquality.equals(other.exclusionPatterns, exclusionPatterns) &&
_deepEquality.equals(other.importPaths, importPaths) &&
- other.isVisible == isVisible &&
other.name == name;
@override
@@ -51,21 +41,15 @@ class UpdateLibraryDto {
// ignore: unnecessary_parenthesis
(exclusionPatterns.hashCode) +
(importPaths.hashCode) +
- (isVisible == null ? 0 : isVisible!.hashCode) +
(name == null ? 0 : name!.hashCode);
@override
- String toString() => 'UpdateLibraryDto[exclusionPatterns=$exclusionPatterns, importPaths=$importPaths, isVisible=$isVisible, name=$name]';
+ String toString() => 'UpdateLibraryDto[exclusionPatterns=$exclusionPatterns, importPaths=$importPaths, name=$name]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'exclusionPatterns'] = this.exclusionPatterns;
json[r'importPaths'] = this.importPaths;
- if (this.isVisible != null) {
- json[r'isVisible'] = this.isVisible;
- } else {
- // json[r'isVisible'] = null;
- }
if (this.name != null) {
json[r'name'] = this.name;
} else {
@@ -88,7 +72,6 @@ class UpdateLibraryDto {
importPaths: json[r'importPaths'] is Iterable
? (json[r'importPaths'] as Iterable).cast<String>().toList(growable: false)
: const [],
- isVisible: mapValueOfType<bool>(json, r'isVisible'),
name: mapValueOfType<String>(json, r'name'),
);
}
diff --git a/mobile/openapi/test/create_library_dto_test.dart b/mobile/openapi/test/create_library_dto_test.dart
index 1dd77af251..eedb0d59d2 100644
--- a/mobile/openapi/test/create_library_dto_test.dart
+++ b/mobile/openapi/test/create_library_dto_test.dart
@@ -26,11 +26,6 @@ void main() {
// TODO
});
- // bool isVisible
- test('to test the property `isVisible`', () async {
- // TODO
- });
-
// String name
test('to test the property `name`', () async {
// TODO
diff --git a/mobile/openapi/test/update_library_dto_test.dart b/mobile/openapi/test/update_library_dto_test.dart
index 222eb333bc..0db376dddb 100644
--- a/mobile/openapi/test/update_library_dto_test.dart
+++ b/mobile/openapi/test/update_library_dto_test.dart
@@ -26,11 +26,6 @@ void main() {
// TODO
});
- // bool isVisible
- test('to test the property `isVisible`', () async {
- // TODO
- });
-
// String name
test('to test the property `name`', () async {
// TODO
diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json
index e87e55958a..ac8634766a 100644
--- a/open-api/immich-openapi-specs.json
+++ b/open-api/immich-openapi-specs.json
@@ -7708,9 +7708,6 @@
},
"type": "array"
},
- "isVisible": {
- "type": "boolean"
- },
"name": {
"type": "string"
},
@@ -10741,9 +10738,6 @@
},
"type": "array"
},
- "isVisible": {
- "type": "boolean"
- },
"name": {
"type": "string"
}
diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts
index cbe9e5b1f4..d6a2b2529f 100644
--- a/open-api/typescript-sdk/src/fetch-client.ts
+++ b/open-api/typescript-sdk/src/fetch-client.ts
@@ -442,7 +442,6 @@ export type LibraryResponseDto = {
export type CreateLibraryDto = {
exclusionPatterns?: string[];
importPaths?: string[];
- isVisible?: boolean;
name?: string;
ownerId: string;
"type": LibraryType;
@@ -450,7 +449,6 @@ export type CreateLibraryDto = {
export type UpdateLibraryDto = {
exclusionPatterns?: string[];
importPaths?: string[];
- isVisible?: boolean;
name?: string;
};
export type ScanLibraryDto = {
diff --git a/server/src/cores/user.core.ts b/server/src/cores/user.core.ts
index e8596db3e7..db2a9c780c 100644
--- a/server/src/cores/user.core.ts
+++ b/server/src/cores/user.core.ts
@@ -101,7 +101,6 @@ export class UserCore {
type: LibraryType.UPLOAD,
importPaths: [],
exclusionPatterns: [],
- isVisible: true,
});
return userEntity;
diff --git a/server/src/dtos/library.dto.ts b/server/src/dtos/library.dto.ts
index b693d35adf..045aaecf54 100644
--- a/server/src/dtos/library.dto.ts
+++ b/server/src/dtos/library.dto.ts
@@ -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 })
diff --git a/server/src/entities/library.entity.ts b/server/src/entities/library.entity.ts
index 8be560a889..56e62dd062 100644
--- a/server/src/entities/library.entity.ts
+++ b/server/src/entities/library.entity.ts
@@ -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 {
diff --git a/server/src/migrations/1715798702876-RemoveLibraryIsVisible.ts b/server/src/migrations/1715798702876-RemoveLibraryIsVisible.ts
new file mode 100644
index 0000000000..45f5248c1a
--- /dev/null
+++ b/server/src/migrations/1715798702876-RemoveLibraryIsVisible.ts
@@ -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`);
+ }
+
+}
diff --git a/server/src/queries/library.repository.sql b/server/src/queries/library.repository.sql
index 93a6fc97fb..3e655d6506 100644
--- a/server/src/queries/library.repository.sql
+++ b/server/src/queries/library.repository.sql
@@ -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'
diff --git a/server/src/repositories/library.repository.ts b/server/src/repositories/library.repository.ts
index b0350c14ec..25eb010356 100644
--- a/server/src/repositories/library.repository.ts
+++ b/server/src/repositories/library.repository.ts
@@ -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: {
diff --git a/server/src/services/asset-v1.service.ts b/server/src/services/asset-v1.service.ts
index 9667730fb3..bd6f540061 100644
--- a/server/src/services/asset-v1.service.ts
+++ b/server/src/services/asset-v1.service.ts
@@ -259,7 +259,6 @@ export class AssetServiceV1 {
type: LibraryType.UPLOAD,
importPaths: [],
exclusionPatterns: [],
- isVisible: true,
});
}
diff --git a/server/src/services/library.service.spec.ts b/server/src/services/library.service.spec.ts
index f987fd1b57..fa45341784 100644
--- a/server/src/services/library.service.spec.ts
+++ b/server/src/services/library.service.spec.ts
@@ -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,
}),
);
});
diff --git a/server/src/services/library.service.ts b/server/src/services/library.service.ts
index a0d9b70d65..3c6e26a315 100644
--- a/server/src/services/library.service.ts
+++ b/server/src/services/library.service.ts
@@ -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}}`);
diff --git a/server/test/fixtures/library.stub.ts b/server/test/fixtures/library.stub.ts
index dde250a7a1..bb95439d1c 100644
--- a/server/test/fixtures/library.stub.ts
+++ b/server/test/fixtures/library.stub.ts
@@ -16,7 +16,6 @@ export const libraryStub = {
createdAt: new Date('2022-01-01'),
updatedAt: new Date('2022-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: [],
}),
externalLibrary1: Object.freeze<LibraryEntity>({
@@ -30,7 +29,6 @@ export const libraryStub = {
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: [],
}),
externalLibrary2: Object.freeze<LibraryEntity>({
@@ -44,7 +42,6 @@ export const libraryStub = {
createdAt: new Date('2021-01-01'),
updatedAt: new Date('2022-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: [],
}),
externalLibraryWithImportPaths1: Object.freeze<LibraryEntity>({
@@ -58,7 +55,6 @@ export const libraryStub = {
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: [],
}),
externalLibraryWithImportPaths2: Object.freeze<LibraryEntity>({
@@ -72,7 +68,6 @@ export const libraryStub = {
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: [],
}),
externalLibraryWithExclusionPattern: Object.freeze<LibraryEntity>({
@@ -86,7 +81,6 @@ export const libraryStub = {
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: ['**/dir1/**'],
}),
patternPath: Object.freeze<LibraryEntity>({
@@ -100,7 +94,6 @@ export const libraryStub = {
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: ['**/dir1/**'],
}),
hasImmichPaths: Object.freeze<LibraryEntity>({
@@ -114,7 +107,6 @@ export const libraryStub = {
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
- isVisible: true,
exclusionPatterns: ['**/dir1/**'],
}),
};