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

This commit is contained in:
Jason Rasmussen 2024-05-15 15:17:48 -04:00 committed by GitHub
parent 581b467b4b
commit 73bf8f343a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 19 additions and 131 deletions

View File

@ -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) | |

View File

@ -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)

View File

@ -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'])!,

View File

@ -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'),
);
}

View File

@ -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

View File

@ -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

View File

@ -7708,9 +7708,6 @@
},
"type": "array"
},
"isVisible": {
"type": "boolean"
},
"name": {
"type": "string"
},
@ -10741,9 +10738,6 @@
},
"type": "array"
},
"isVisible": {
"type": "boolean"
},
"name": {
"type": "string"
}

View File

@ -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 = {

View File

@ -101,7 +101,6 @@ export class UserCore {
type: LibraryType.UPLOAD,
importPaths: [],
exclusionPatterns: [],
isVisible: true,
});
return userEntity;

View File

@ -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 })

View File

@ -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 {

View File

@ -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`);
}
}

View File

@ -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'

View File

@ -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: {

View File

@ -259,7 +259,6 @@ export class AssetServiceV1 {
type: LibraryType.UPLOAD,
importPaths: [],
exclusionPatterns: [],
isVisible: true,
});
}

View File

@ -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,
}),
);
});

View File

@ -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}}`);

View File

@ -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/**'],
}),
};