You've already forked immich
							
							
				mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 00:18:28 +02:00 
			
		
		
		
	feat(web,server): user storage label (#2418)
* feat: user storage label * chore: open api * fix: checks * fix: api update validation and tests * feat: default admin storage label * fix: linting * fix: user create/update dto * fix: delete library with custom label
This commit is contained in:
		
							
								
								
									
										17
									
								
								mobile/openapi/lib/model/create_user_dto.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								mobile/openapi/lib/model/create_user_dto.dart
									
									
									
										generated
									
									
									
								
							| @@ -17,6 +17,7 @@ class CreateUserDto { | ||||
|     required this.password, | ||||
|     required this.firstName, | ||||
|     required this.lastName, | ||||
|     this.storageLabel, | ||||
|   }); | ||||
| 
 | ||||
|   String email; | ||||
| @@ -27,12 +28,15 @@ class CreateUserDto { | ||||
| 
 | ||||
|   String lastName; | ||||
| 
 | ||||
|   String? storageLabel; | ||||
| 
 | ||||
|   @override | ||||
|   bool operator ==(Object other) => identical(this, other) || other is CreateUserDto && | ||||
|      other.email == email && | ||||
|      other.password == password && | ||||
|      other.firstName == firstName && | ||||
|      other.lastName == lastName; | ||||
|      other.lastName == lastName && | ||||
|      other.storageLabel == storageLabel; | ||||
| 
 | ||||
|   @override | ||||
|   int get hashCode => | ||||
| @@ -40,10 +44,11 @@ class CreateUserDto { | ||||
|     (email.hashCode) + | ||||
|     (password.hashCode) + | ||||
|     (firstName.hashCode) + | ||||
|     (lastName.hashCode); | ||||
|     (lastName.hashCode) + | ||||
|     (storageLabel == null ? 0 : storageLabel!.hashCode); | ||||
| 
 | ||||
|   @override | ||||
|   String toString() => 'CreateUserDto[email=$email, password=$password, firstName=$firstName, lastName=$lastName]'; | ||||
|   String toString() => 'CreateUserDto[email=$email, password=$password, firstName=$firstName, lastName=$lastName, storageLabel=$storageLabel]'; | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final json = <String, dynamic>{}; | ||||
| @@ -51,6 +56,11 @@ class CreateUserDto { | ||||
|       json[r'password'] = this.password; | ||||
|       json[r'firstName'] = this.firstName; | ||||
|       json[r'lastName'] = this.lastName; | ||||
|     if (this.storageLabel != null) { | ||||
|       json[r'storageLabel'] = this.storageLabel; | ||||
|     } else { | ||||
|       // json[r'storageLabel'] = null; | ||||
|     } | ||||
|     return json; | ||||
|   } | ||||
| 
 | ||||
| @@ -77,6 +87,7 @@ class CreateUserDto { | ||||
|         password: mapValueOfType<String>(json, r'password')!, | ||||
|         firstName: mapValueOfType<String>(json, r'firstName')!, | ||||
|         lastName: mapValueOfType<String>(json, r'lastName')!, | ||||
|         storageLabel: mapValueOfType<String>(json, r'storageLabel'), | ||||
|       ); | ||||
|     } | ||||
|     return null; | ||||
|   | ||||
							
								
								
									
										31
									
								
								mobile/openapi/lib/model/update_user_dto.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										31
									
								
								mobile/openapi/lib/model/update_user_dto.dart
									
									
									
										generated
									
									
									
								
							| @@ -13,15 +13,18 @@ part of openapi.api; | ||||
| class UpdateUserDto { | ||||
|   /// Returns a new [UpdateUserDto] instance. | ||||
|   UpdateUserDto({ | ||||
|     required this.id, | ||||
|     this.email, | ||||
|     this.password, | ||||
|     this.firstName, | ||||
|     this.lastName, | ||||
|     required this.id, | ||||
|     this.storageLabel, | ||||
|     this.isAdmin, | ||||
|     this.shouldChangePassword, | ||||
|   }); | ||||
| 
 | ||||
|   String id; | ||||
| 
 | ||||
|   /// | ||||
|   /// 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 | ||||
| @@ -54,7 +57,13 @@ class UpdateUserDto { | ||||
|   /// | ||||
|   String? lastName; | ||||
| 
 | ||||
|   String id; | ||||
|   /// | ||||
|   /// 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. | ||||
|   /// | ||||
|   String? storageLabel; | ||||
| 
 | ||||
|   /// | ||||
|   /// Please note: This property should have been non-nullable! Since the specification file | ||||
| @@ -74,30 +83,33 @@ class UpdateUserDto { | ||||
| 
 | ||||
|   @override | ||||
|   bool operator ==(Object other) => identical(this, other) || other is UpdateUserDto && | ||||
|      other.id == id && | ||||
|      other.email == email && | ||||
|      other.password == password && | ||||
|      other.firstName == firstName && | ||||
|      other.lastName == lastName && | ||||
|      other.id == id && | ||||
|      other.storageLabel == storageLabel && | ||||
|      other.isAdmin == isAdmin && | ||||
|      other.shouldChangePassword == shouldChangePassword; | ||||
| 
 | ||||
|   @override | ||||
|   int get hashCode => | ||||
|     // ignore: unnecessary_parenthesis | ||||
|     (id.hashCode) + | ||||
|     (email == null ? 0 : email!.hashCode) + | ||||
|     (password == null ? 0 : password!.hashCode) + | ||||
|     (firstName == null ? 0 : firstName!.hashCode) + | ||||
|     (lastName == null ? 0 : lastName!.hashCode) + | ||||
|     (id.hashCode) + | ||||
|     (storageLabel == null ? 0 : storageLabel!.hashCode) + | ||||
|     (isAdmin == null ? 0 : isAdmin!.hashCode) + | ||||
|     (shouldChangePassword == null ? 0 : shouldChangePassword!.hashCode); | ||||
| 
 | ||||
|   @override | ||||
|   String toString() => 'UpdateUserDto[email=$email, password=$password, firstName=$firstName, lastName=$lastName, id=$id, isAdmin=$isAdmin, shouldChangePassword=$shouldChangePassword]'; | ||||
|   String toString() => 'UpdateUserDto[id=$id, email=$email, password=$password, firstName=$firstName, lastName=$lastName, storageLabel=$storageLabel, isAdmin=$isAdmin, shouldChangePassword=$shouldChangePassword]'; | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final json = <String, dynamic>{}; | ||||
|       json[r'id'] = this.id; | ||||
|     if (this.email != null) { | ||||
|       json[r'email'] = this.email; | ||||
|     } else { | ||||
| @@ -118,7 +130,11 @@ class UpdateUserDto { | ||||
|     } else { | ||||
|       // json[r'lastName'] = null; | ||||
|     } | ||||
|       json[r'id'] = this.id; | ||||
|     if (this.storageLabel != null) { | ||||
|       json[r'storageLabel'] = this.storageLabel; | ||||
|     } else { | ||||
|       // json[r'storageLabel'] = null; | ||||
|     } | ||||
|     if (this.isAdmin != null) { | ||||
|       json[r'isAdmin'] = this.isAdmin; | ||||
|     } else { | ||||
| @@ -151,11 +167,12 @@ class UpdateUserDto { | ||||
|       }()); | ||||
| 
 | ||||
|       return UpdateUserDto( | ||||
|         id: mapValueOfType<String>(json, r'id')!, | ||||
|         email: mapValueOfType<String>(json, r'email'), | ||||
|         password: mapValueOfType<String>(json, r'password'), | ||||
|         firstName: mapValueOfType<String>(json, r'firstName'), | ||||
|         lastName: mapValueOfType<String>(json, r'lastName'), | ||||
|         id: mapValueOfType<String>(json, r'id')!, | ||||
|         storageLabel: mapValueOfType<String>(json, r'storageLabel'), | ||||
|         isAdmin: mapValueOfType<bool>(json, r'isAdmin'), | ||||
|         shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'), | ||||
|       ); | ||||
|   | ||||
							
								
								
									
										14
									
								
								mobile/openapi/lib/model/user_response_dto.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								mobile/openapi/lib/model/user_response_dto.dart
									
									
									
										generated
									
									
									
								
							| @@ -17,6 +17,7 @@ class UserResponseDto { | ||||
|     required this.email, | ||||
|     required this.firstName, | ||||
|     required this.lastName, | ||||
|     required this.storageLabel, | ||||
|     required this.createdAt, | ||||
|     required this.profileImagePath, | ||||
|     required this.shouldChangePassword, | ||||
| @@ -34,6 +35,8 @@ class UserResponseDto { | ||||
| 
 | ||||
|   String lastName; | ||||
| 
 | ||||
|   String? storageLabel; | ||||
| 
 | ||||
|   String createdAt; | ||||
| 
 | ||||
|   String profileImagePath; | ||||
| @@ -66,6 +69,7 @@ class UserResponseDto { | ||||
|      other.email == email && | ||||
|      other.firstName == firstName && | ||||
|      other.lastName == lastName && | ||||
|      other.storageLabel == storageLabel && | ||||
|      other.createdAt == createdAt && | ||||
|      other.profileImagePath == profileImagePath && | ||||
|      other.shouldChangePassword == shouldChangePassword && | ||||
| @@ -81,6 +85,7 @@ class UserResponseDto { | ||||
|     (email.hashCode) + | ||||
|     (firstName.hashCode) + | ||||
|     (lastName.hashCode) + | ||||
|     (storageLabel == null ? 0 : storageLabel!.hashCode) + | ||||
|     (createdAt.hashCode) + | ||||
|     (profileImagePath.hashCode) + | ||||
|     (shouldChangePassword.hashCode) + | ||||
| @@ -90,7 +95,7 @@ class UserResponseDto { | ||||
|     (oauthId.hashCode); | ||||
| 
 | ||||
|   @override | ||||
|   String toString() => 'UserResponseDto[id=$id, email=$email, firstName=$firstName, lastName=$lastName, createdAt=$createdAt, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, isAdmin=$isAdmin, deletedAt=$deletedAt, updatedAt=$updatedAt, oauthId=$oauthId]'; | ||||
|   String toString() => 'UserResponseDto[id=$id, email=$email, firstName=$firstName, lastName=$lastName, storageLabel=$storageLabel, createdAt=$createdAt, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, isAdmin=$isAdmin, deletedAt=$deletedAt, updatedAt=$updatedAt, oauthId=$oauthId]'; | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final json = <String, dynamic>{}; | ||||
| @@ -98,6 +103,11 @@ class UserResponseDto { | ||||
|       json[r'email'] = this.email; | ||||
|       json[r'firstName'] = this.firstName; | ||||
|       json[r'lastName'] = this.lastName; | ||||
|     if (this.storageLabel != null) { | ||||
|       json[r'storageLabel'] = this.storageLabel; | ||||
|     } else { | ||||
|       // json[r'storageLabel'] = null; | ||||
|     } | ||||
|       json[r'createdAt'] = this.createdAt; | ||||
|       json[r'profileImagePath'] = this.profileImagePath; | ||||
|       json[r'shouldChangePassword'] = this.shouldChangePassword; | ||||
| @@ -139,6 +149,7 @@ class UserResponseDto { | ||||
|         email: mapValueOfType<String>(json, r'email')!, | ||||
|         firstName: mapValueOfType<String>(json, r'firstName')!, | ||||
|         lastName: mapValueOfType<String>(json, r'lastName')!, | ||||
|         storageLabel: mapValueOfType<String>(json, r'storageLabel'), | ||||
|         createdAt: mapValueOfType<String>(json, r'createdAt')!, | ||||
|         profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!, | ||||
|         shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!, | ||||
| @@ -197,6 +208,7 @@ class UserResponseDto { | ||||
|     'email', | ||||
|     'firstName', | ||||
|     'lastName', | ||||
|     'storageLabel', | ||||
|     'createdAt', | ||||
|     'profileImagePath', | ||||
|     'shouldChangePassword', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user