forked from Cutlery/immich
		
	fix(server): remove isWatched from DTO (#8598)
* fix: remove isWatched * chore: open api
This commit is contained in:
		
							parent
							
								
									20583d5334
								
							
						
					
					
						commit
						7b1562c050
					
				
							
								
								
									
										1
									
								
								mobile/openapi/doc/CreateLibraryDto.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								mobile/openapi/doc/CreateLibraryDto.md
									
									
									
										generated
									
									
									
								
							@ -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) |  | 
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										19
									
								
								mobile/openapi/lib/model/create_library_dto.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										19
									
								
								mobile/openapi/lib/model/create_library_dto.dart
									
									
									
										generated
									
									
									
								
							@ -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'])!,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								mobile/openapi/test/create_library_dto_test.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								mobile/openapi/test/create_library_dto_test.dart
									
									
									
										generated
									
									
									
								
							@ -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
 | 
				
			||||||
 | 
				
			|||||||
@ -8000,9 +8000,6 @@
 | 
				
			|||||||
          "isVisible": {
 | 
					          "isVisible": {
 | 
				
			||||||
            "type": "boolean"
 | 
					            "type": "boolean"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "isWatched": {
 | 
					 | 
				
			||||||
            "type": "boolean"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "name": {
 | 
					          "name": {
 | 
				
			||||||
            "type": "string"
 | 
					            "type": "string"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
 | 
				
			|||||||
@ -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 {
 | 
				
			||||||
 | 
				
			|||||||
@ -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();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -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}`,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user