1
0
mirror of https://github.com/immich-app/immich.git synced 2025-01-26 17:21:29 +02:00

fix(server): remove isWatched from DTO (#8598)

* fix: remove isWatched

* chore: open api
This commit is contained in:
Daniel Dietzler 2024-04-08 22:00:08 +02:00 committed by GitHub
parent 20583d5334
commit 7b1562c050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 4 additions and 43 deletions

View File

@ -11,7 +11,6 @@ Name | Type | Description | Notes
**exclusionPatterns** | **List<String>** | | [optional] [default to const []] **exclusionPatterns** | **List<String>** | | [optional] [default to const []]
**importPaths** | **List<String>** | | [optional] [default to const []] **importPaths** | **List<String>** | | [optional] [default to const []]
**isVisible** | **bool** | | [optional] **isVisible** | **bool** | | [optional]
**isWatched** | **bool** | | [optional]
**name** | **String** | | [optional] **name** | **String** | | [optional]
**ownerId** | **String** | | **ownerId** | **String** | |
**type** | [**LibraryType**](LibraryType.md) | | **type** | [**LibraryType**](LibraryType.md) | |

View File

@ -16,7 +16,6 @@ class CreateLibraryDto {
this.exclusionPatterns = const [], this.exclusionPatterns = const [],
this.importPaths = const [], this.importPaths = const [],
this.isVisible, this.isVisible,
this.isWatched,
this.name, this.name,
required this.ownerId, required this.ownerId,
required this.type, required this.type,
@ -34,14 +33,6 @@ class CreateLibraryDto {
/// ///
bool? isVisible; 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
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isWatched;
/// ///
/// Please note: This property should have been non-nullable! Since the specification file /// 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 /// does not include a default value (using the "default:" property), however, the generated
@ -59,7 +50,6 @@ class CreateLibraryDto {
_deepEquality.equals(other.exclusionPatterns, exclusionPatterns) && _deepEquality.equals(other.exclusionPatterns, exclusionPatterns) &&
_deepEquality.equals(other.importPaths, importPaths) && _deepEquality.equals(other.importPaths, importPaths) &&
other.isVisible == isVisible && other.isVisible == isVisible &&
other.isWatched == isWatched &&
other.name == name && other.name == name &&
other.ownerId == ownerId && other.ownerId == ownerId &&
other.type == type; other.type == type;
@ -70,13 +60,12 @@ class CreateLibraryDto {
(exclusionPatterns.hashCode) + (exclusionPatterns.hashCode) +
(importPaths.hashCode) + (importPaths.hashCode) +
(isVisible == null ? 0 : isVisible!.hashCode) + (isVisible == null ? 0 : isVisible!.hashCode) +
(isWatched == null ? 0 : isWatched!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(ownerId.hashCode) + (ownerId.hashCode) +
(type.hashCode); (type.hashCode);
@override @override
String toString() => 'CreateLibraryDto[exclusionPatterns=$exclusionPatterns, importPaths=$importPaths, isVisible=$isVisible, isWatched=$isWatched, name=$name, ownerId=$ownerId, type=$type]'; String toString() => 'CreateLibraryDto[exclusionPatterns=$exclusionPatterns, importPaths=$importPaths, isVisible=$isVisible, name=$name, ownerId=$ownerId, type=$type]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -87,11 +76,6 @@ class CreateLibraryDto {
} else { } else {
// json[r'isVisible'] = null; // json[r'isVisible'] = null;
} }
if (this.isWatched != null) {
json[r'isWatched'] = this.isWatched;
} else {
// json[r'isWatched'] = null;
}
if (this.name != null) { if (this.name != null) {
json[r'name'] = this.name; json[r'name'] = this.name;
} else { } else {
@ -117,7 +101,6 @@ class CreateLibraryDto {
? (json[r'importPaths'] as Iterable).cast<String>().toList(growable: false) ? (json[r'importPaths'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],
isVisible: mapValueOfType<bool>(json, r'isVisible'), isVisible: mapValueOfType<bool>(json, r'isVisible'),
isWatched: mapValueOfType<bool>(json, r'isWatched'),
name: mapValueOfType<String>(json, r'name'), name: mapValueOfType<String>(json, r'name'),
ownerId: mapValueOfType<String>(json, r'ownerId')!, ownerId: mapValueOfType<String>(json, r'ownerId')!,
type: LibraryType.fromJson(json[r'type'])!, type: LibraryType.fromJson(json[r'type'])!,

View File

@ -31,11 +31,6 @@ void main() {
// TODO // TODO
}); });
// bool isWatched
test('to test the property `isWatched`', () async {
// TODO
});
// String name // String name
test('to test the property `name`', () async { test('to test the property `name`', () async {
// TODO // TODO

View File

@ -8000,9 +8000,6 @@
"isVisible": { "isVisible": {
"type": "boolean" "type": "boolean"
}, },
"isWatched": {
"type": "boolean"
},
"name": { "name": {
"type": "string" "type": "string"
}, },

View File

@ -461,7 +461,6 @@ export type CreateLibraryDto = {
exclusionPatterns?: string[]; exclusionPatterns?: string[];
importPaths?: string[]; importPaths?: string[];
isVisible?: boolean; isVisible?: boolean;
isWatched?: boolean;
name?: string; name?: string;
ownerId: string; ownerId: string;
"type": LibraryType; "type": LibraryType;

View File

@ -32,9 +32,6 @@ export class CreateLibraryDto {
@ArrayUnique() @ArrayUnique()
@ArrayMaxSize(128) @ArrayMaxSize(128)
exclusionPatterns?: string[]; exclusionPatterns?: string[];
@ValidateBoolean({ optional: true })
isWatched?: boolean;
} }
export class UpdateLibraryDto { export class UpdateLibraryDto {

View File

@ -1058,14 +1058,6 @@ describe(LibraryService.name, () => {
expect(libraryMock.create).not.toHaveBeenCalled(); expect(libraryMock.create).not.toHaveBeenCalled();
}); });
it('should not create watched', async () => {
await expect(
sut.create({ ownerId: authStub.admin.user.id, type: LibraryType.UPLOAD, isWatched: true }),
).rejects.toBeInstanceOf(BadRequestException);
expect(storageMock.watch).not.toHaveBeenCalled();
});
}); });
}); });

View File

@ -266,9 +266,6 @@ export class LibraryService extends EventEmitter {
if (dto.exclusionPatterns && dto.exclusionPatterns.length > 0) { if (dto.exclusionPatterns && dto.exclusionPatterns.length > 0) {
throw new BadRequestException('Upload libraries cannot have exclusion patterns'); throw new BadRequestException('Upload libraries cannot have exclusion patterns');
} }
if (dto.isWatched) {
throw new BadRequestException('Upload libraries cannot be watched');
}
break; break;
} }
} }

View File

@ -118,7 +118,9 @@
const handleCreate = async (ownerId: string) => { const handleCreate = async (ownerId: string) => {
try { try {
const createdLibrary = await createLibrary({ createLibraryDto: { ownerId, type: LibraryType.External } }); const createdLibrary = await createLibrary({
createLibraryDto: { ownerId, type: LibraryType.External },
});
notificationController.show({ notificationController.show({
message: `Created library: ${createdLibrary.name}`, message: `Created library: ${createdLibrary.name}`,