mirror of
https://github.com/immich-app/immich.git
synced 2025-12-13 17:23:10 +03:00
feat(server,web): add force delete to immediately remove user (#7681)
* feat(server,web): add force delete to immediately remove user * update wording on force delete confirmation * fix force delete css * PR feedback * cleanup user service delete for force * adding user status column * some cleanup and tests * more test fixes * run npm run sql:generate * chore: cleanup and websocket * chore: linting * userRepository.restore * removed bad color class from delete-confirm-dialoge * additional confirmation for user force delete * shorten confirmation message --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
6
mobile/openapi/.openapi-generator/FILES
generated
6
mobile/openapi/.openapi-generator/FILES
generated
@@ -58,6 +58,7 @@ doc/CreateTagDto.md
|
||||
doc/CreateUserDto.md
|
||||
doc/CuratedLocationsResponseDto.md
|
||||
doc/CuratedObjectsResponseDto.md
|
||||
doc/DeleteUserDto.md
|
||||
doc/DownloadApi.md
|
||||
doc/DownloadArchiveInfo.md
|
||||
doc/DownloadInfoDto.md
|
||||
@@ -184,6 +185,7 @@ doc/UserApi.md
|
||||
doc/UserAvatarColor.md
|
||||
doc/UserDto.md
|
||||
doc/UserResponseDto.md
|
||||
doc/UserStatus.md
|
||||
doc/ValidateAccessTokenResponseDto.md
|
||||
doc/ValidateLibraryDto.md
|
||||
doc/ValidateLibraryImportPathResponseDto.md
|
||||
@@ -268,6 +270,7 @@ lib/model/create_tag_dto.dart
|
||||
lib/model/create_user_dto.dart
|
||||
lib/model/curated_locations_response_dto.dart
|
||||
lib/model/curated_objects_response_dto.dart
|
||||
lib/model/delete_user_dto.dart
|
||||
lib/model/download_archive_info.dart
|
||||
lib/model/download_info_dto.dart
|
||||
lib/model/download_response_dto.dart
|
||||
@@ -380,6 +383,7 @@ lib/model/usage_by_user_dto.dart
|
||||
lib/model/user_avatar_color.dart
|
||||
lib/model/user_dto.dart
|
||||
lib/model/user_response_dto.dart
|
||||
lib/model/user_status.dart
|
||||
lib/model/validate_access_token_response_dto.dart
|
||||
lib/model/validate_library_dto.dart
|
||||
lib/model/validate_library_import_path_response_dto.dart
|
||||
@@ -441,6 +445,7 @@ test/create_tag_dto_test.dart
|
||||
test/create_user_dto_test.dart
|
||||
test/curated_locations_response_dto_test.dart
|
||||
test/curated_objects_response_dto_test.dart
|
||||
test/delete_user_dto_test.dart
|
||||
test/download_api_test.dart
|
||||
test/download_archive_info_test.dart
|
||||
test/download_info_dto_test.dart
|
||||
@@ -567,6 +572,7 @@ test/user_api_test.dart
|
||||
test/user_avatar_color_test.dart
|
||||
test/user_dto_test.dart
|
||||
test/user_response_dto_test.dart
|
||||
test/user_status_test.dart
|
||||
test/validate_access_token_response_dto_test.dart
|
||||
test/validate_library_dto_test.dart
|
||||
test/validate_library_import_path_response_dto_test.dart
|
||||
|
||||
2
mobile/openapi/README.md
generated
2
mobile/openapi/README.md
generated
@@ -264,6 +264,7 @@ Class | Method | HTTP request | Description
|
||||
- [CreateUserDto](doc//CreateUserDto.md)
|
||||
- [CuratedLocationsResponseDto](doc//CuratedLocationsResponseDto.md)
|
||||
- [CuratedObjectsResponseDto](doc//CuratedObjectsResponseDto.md)
|
||||
- [DeleteUserDto](doc//DeleteUserDto.md)
|
||||
- [DownloadArchiveInfo](doc//DownloadArchiveInfo.md)
|
||||
- [DownloadInfoDto](doc//DownloadInfoDto.md)
|
||||
- [DownloadResponseDto](doc//DownloadResponseDto.md)
|
||||
@@ -376,6 +377,7 @@ Class | Method | HTTP request | Description
|
||||
- [UserAvatarColor](doc//UserAvatarColor.md)
|
||||
- [UserDto](doc//UserDto.md)
|
||||
- [UserResponseDto](doc//UserResponseDto.md)
|
||||
- [UserStatus](doc//UserStatus.md)
|
||||
- [ValidateAccessTokenResponseDto](doc//ValidateAccessTokenResponseDto.md)
|
||||
- [ValidateLibraryDto](doc//ValidateLibraryDto.md)
|
||||
- [ValidateLibraryImportPathResponseDto](doc//ValidateLibraryImportPathResponseDto.md)
|
||||
|
||||
15
mobile/openapi/doc/DeleteUserDto.md
generated
Normal file
15
mobile/openapi/doc/DeleteUserDto.md
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
# openapi.model.DeleteUserDto
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**force** | **bool** | | [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)
|
||||
|
||||
|
||||
1
mobile/openapi/doc/PartnerResponseDto.md
generated
1
mobile/openapi/doc/PartnerResponseDto.md
generated
@@ -22,6 +22,7 @@ Name | Type | Description | Notes
|
||||
**quotaSizeInBytes** | **int** | |
|
||||
**quotaUsageInBytes** | **int** | |
|
||||
**shouldChangePassword** | **bool** | |
|
||||
**status** | [**UserStatus**](UserStatus.md) | |
|
||||
**storageLabel** | **String** | |
|
||||
**updatedAt** | [**DateTime**](DateTime.md) | |
|
||||
|
||||
|
||||
8
mobile/openapi/doc/UserApi.md
generated
8
mobile/openapi/doc/UserApi.md
generated
@@ -182,7 +182,7 @@ void (empty response body)
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> UserResponseDto deleteUser(id)
|
||||
> UserResponseDto deleteUser(id, deleteUserDto)
|
||||
|
||||
|
||||
|
||||
@@ -206,9 +206,10 @@ import 'package:openapi/api.dart';
|
||||
|
||||
final api_instance = UserApi();
|
||||
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
|
||||
final deleteUserDto = DeleteUserDto(); // DeleteUserDto |
|
||||
|
||||
try {
|
||||
final result = api_instance.deleteUser(id);
|
||||
final result = api_instance.deleteUser(id, deleteUserDto);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling UserApi->deleteUser: $e\n');
|
||||
@@ -220,6 +221,7 @@ try {
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **String**| |
|
||||
**deleteUserDto** | [**DeleteUserDto**](DeleteUserDto.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -231,7 +233,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
1
mobile/openapi/doc/UserResponseDto.md
generated
1
mobile/openapi/doc/UserResponseDto.md
generated
@@ -21,6 +21,7 @@ Name | Type | Description | Notes
|
||||
**quotaSizeInBytes** | **int** | |
|
||||
**quotaUsageInBytes** | **int** | |
|
||||
**shouldChangePassword** | **bool** | |
|
||||
**status** | [**UserStatus**](UserStatus.md) | |
|
||||
**storageLabel** | **String** | |
|
||||
**updatedAt** | [**DateTime**](DateTime.md) | |
|
||||
|
||||
|
||||
14
mobile/openapi/doc/UserStatus.md
generated
Normal file
14
mobile/openapi/doc/UserStatus.md
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
# openapi.model.UserStatus
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
2
mobile/openapi/lib/api.dart
generated
2
mobile/openapi/lib/api.dart
generated
@@ -99,6 +99,7 @@ part 'model/create_tag_dto.dart';
|
||||
part 'model/create_user_dto.dart';
|
||||
part 'model/curated_locations_response_dto.dart';
|
||||
part 'model/curated_objects_response_dto.dart';
|
||||
part 'model/delete_user_dto.dart';
|
||||
part 'model/download_archive_info.dart';
|
||||
part 'model/download_info_dto.dart';
|
||||
part 'model/download_response_dto.dart';
|
||||
@@ -211,6 +212,7 @@ part 'model/usage_by_user_dto.dart';
|
||||
part 'model/user_avatar_color.dart';
|
||||
part 'model/user_dto.dart';
|
||||
part 'model/user_response_dto.dart';
|
||||
part 'model/user_status.dart';
|
||||
part 'model/validate_access_token_response_dto.dart';
|
||||
part 'model/validate_library_dto.dart';
|
||||
part 'model/validate_library_import_path_response_dto.dart';
|
||||
|
||||
14
mobile/openapi/lib/api/user_api.dart
generated
14
mobile/openapi/lib/api/user_api.dart
generated
@@ -157,19 +157,21 @@ class UserApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<Response> deleteUserWithHttpInfo(String id,) async {
|
||||
///
|
||||
/// * [DeleteUserDto] deleteUserDto (required):
|
||||
Future<Response> deleteUserWithHttpInfo(String id, DeleteUserDto deleteUserDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{id}'
|
||||
.replaceAll('{id}', id);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
Object? postBody = deleteUserDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
@@ -186,8 +188,10 @@ class UserApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<UserResponseDto?> deleteUser(String id,) async {
|
||||
final response = await deleteUserWithHttpInfo(id,);
|
||||
///
|
||||
/// * [DeleteUserDto] deleteUserDto (required):
|
||||
Future<UserResponseDto?> deleteUser(String id, DeleteUserDto deleteUserDto,) async {
|
||||
final response = await deleteUserWithHttpInfo(id, deleteUserDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
||||
4
mobile/openapi/lib/api_client.dart
generated
4
mobile/openapi/lib/api_client.dart
generated
@@ -280,6 +280,8 @@ class ApiClient {
|
||||
return CuratedLocationsResponseDto.fromJson(value);
|
||||
case 'CuratedObjectsResponseDto':
|
||||
return CuratedObjectsResponseDto.fromJson(value);
|
||||
case 'DeleteUserDto':
|
||||
return DeleteUserDto.fromJson(value);
|
||||
case 'DownloadArchiveInfo':
|
||||
return DownloadArchiveInfo.fromJson(value);
|
||||
case 'DownloadInfoDto':
|
||||
@@ -504,6 +506,8 @@ class ApiClient {
|
||||
return UserDto.fromJson(value);
|
||||
case 'UserResponseDto':
|
||||
return UserResponseDto.fromJson(value);
|
||||
case 'UserStatus':
|
||||
return UserStatusTypeTransformer().decode(value);
|
||||
case 'ValidateAccessTokenResponseDto':
|
||||
return ValidateAccessTokenResponseDto.fromJson(value);
|
||||
case 'ValidateLibraryDto':
|
||||
|
||||
3
mobile/openapi/lib/api_helper.dart
generated
3
mobile/openapi/lib/api_helper.dart
generated
@@ -136,6 +136,9 @@ String parameterToString(dynamic value) {
|
||||
if (value is UserAvatarColor) {
|
||||
return UserAvatarColorTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is UserStatus) {
|
||||
return UserStatusTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is VideoCodec) {
|
||||
return VideoCodecTypeTransformer().encode(value).toString();
|
||||
}
|
||||
|
||||
107
mobile/openapi/lib/model/delete_user_dto.dart
generated
Normal file
107
mobile/openapi/lib/model/delete_user_dto.dart
generated
Normal file
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class DeleteUserDto {
|
||||
/// Returns a new [DeleteUserDto] instance.
|
||||
DeleteUserDto({
|
||||
this.force,
|
||||
});
|
||||
|
||||
///
|
||||
/// 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? force;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is DeleteUserDto &&
|
||||
other.force == force;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(force == null ? 0 : force!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'DeleteUserDto[force=$force]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.force != null) {
|
||||
json[r'force'] = this.force;
|
||||
} else {
|
||||
// json[r'force'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [DeleteUserDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static DeleteUserDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return DeleteUserDto(
|
||||
force: mapValueOfType<bool>(json, r'force'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<DeleteUserDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <DeleteUserDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = DeleteUserDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, DeleteUserDto> mapFromJson(dynamic json) {
|
||||
final map = <String, DeleteUserDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = DeleteUserDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of DeleteUserDto-objects as value to a dart map
|
||||
static Map<String, List<DeleteUserDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<DeleteUserDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = DeleteUserDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
10
mobile/openapi/lib/model/partner_response_dto.dart
generated
10
mobile/openapi/lib/model/partner_response_dto.dart
generated
@@ -27,6 +27,7 @@ class PartnerResponseDto {
|
||||
required this.quotaSizeInBytes,
|
||||
required this.quotaUsageInBytes,
|
||||
required this.shouldChangePassword,
|
||||
required this.status,
|
||||
required this.storageLabel,
|
||||
required this.updatedAt,
|
||||
});
|
||||
@@ -71,6 +72,8 @@ class PartnerResponseDto {
|
||||
|
||||
bool shouldChangePassword;
|
||||
|
||||
UserStatus status;
|
||||
|
||||
String? storageLabel;
|
||||
|
||||
DateTime updatedAt;
|
||||
@@ -91,6 +94,7 @@ class PartnerResponseDto {
|
||||
other.quotaSizeInBytes == quotaSizeInBytes &&
|
||||
other.quotaUsageInBytes == quotaUsageInBytes &&
|
||||
other.shouldChangePassword == shouldChangePassword &&
|
||||
other.status == status &&
|
||||
other.storageLabel == storageLabel &&
|
||||
other.updatedAt == updatedAt;
|
||||
|
||||
@@ -111,11 +115,12 @@ class PartnerResponseDto {
|
||||
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
|
||||
(quotaUsageInBytes == null ? 0 : quotaUsageInBytes!.hashCode) +
|
||||
(shouldChangePassword.hashCode) +
|
||||
(status.hashCode) +
|
||||
(storageLabel == null ? 0 : storageLabel!.hashCode) +
|
||||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'PartnerResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, inTimeline=$inTimeline, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
|
||||
String toString() => 'PartnerResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, inTimeline=$inTimeline, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -153,6 +158,7 @@ class PartnerResponseDto {
|
||||
// json[r'quotaUsageInBytes'] = null;
|
||||
}
|
||||
json[r'shouldChangePassword'] = this.shouldChangePassword;
|
||||
json[r'status'] = this.status;
|
||||
if (this.storageLabel != null) {
|
||||
json[r'storageLabel'] = this.storageLabel;
|
||||
} else {
|
||||
@@ -184,6 +190,7 @@ class PartnerResponseDto {
|
||||
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
|
||||
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes'),
|
||||
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
|
||||
status: UserStatus.fromJson(json[r'status'])!,
|
||||
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
|
||||
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
|
||||
);
|
||||
@@ -245,6 +252,7 @@ class PartnerResponseDto {
|
||||
'quotaSizeInBytes',
|
||||
'quotaUsageInBytes',
|
||||
'shouldChangePassword',
|
||||
'status',
|
||||
'storageLabel',
|
||||
'updatedAt',
|
||||
};
|
||||
|
||||
10
mobile/openapi/lib/model/user_response_dto.dart
generated
10
mobile/openapi/lib/model/user_response_dto.dart
generated
@@ -26,6 +26,7 @@ class UserResponseDto {
|
||||
required this.quotaSizeInBytes,
|
||||
required this.quotaUsageInBytes,
|
||||
required this.shouldChangePassword,
|
||||
required this.status,
|
||||
required this.storageLabel,
|
||||
required this.updatedAt,
|
||||
});
|
||||
@@ -62,6 +63,8 @@ class UserResponseDto {
|
||||
|
||||
bool shouldChangePassword;
|
||||
|
||||
UserStatus status;
|
||||
|
||||
String? storageLabel;
|
||||
|
||||
DateTime updatedAt;
|
||||
@@ -81,6 +84,7 @@ class UserResponseDto {
|
||||
other.quotaSizeInBytes == quotaSizeInBytes &&
|
||||
other.quotaUsageInBytes == quotaUsageInBytes &&
|
||||
other.shouldChangePassword == shouldChangePassword &&
|
||||
other.status == status &&
|
||||
other.storageLabel == storageLabel &&
|
||||
other.updatedAt == updatedAt;
|
||||
|
||||
@@ -100,11 +104,12 @@ class UserResponseDto {
|
||||
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
|
||||
(quotaUsageInBytes == null ? 0 : quotaUsageInBytes!.hashCode) +
|
||||
(shouldChangePassword.hashCode) +
|
||||
(status.hashCode) +
|
||||
(storageLabel == null ? 0 : storageLabel!.hashCode) +
|
||||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'UserResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
|
||||
String toString() => 'UserResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -137,6 +142,7 @@ class UserResponseDto {
|
||||
// json[r'quotaUsageInBytes'] = null;
|
||||
}
|
||||
json[r'shouldChangePassword'] = this.shouldChangePassword;
|
||||
json[r'status'] = this.status;
|
||||
if (this.storageLabel != null) {
|
||||
json[r'storageLabel'] = this.storageLabel;
|
||||
} else {
|
||||
@@ -167,6 +173,7 @@ class UserResponseDto {
|
||||
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
|
||||
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes'),
|
||||
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
|
||||
status: UserStatus.fromJson(json[r'status'])!,
|
||||
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
|
||||
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
|
||||
);
|
||||
@@ -228,6 +235,7 @@ class UserResponseDto {
|
||||
'quotaSizeInBytes',
|
||||
'quotaUsageInBytes',
|
||||
'shouldChangePassword',
|
||||
'status',
|
||||
'storageLabel',
|
||||
'updatedAt',
|
||||
};
|
||||
|
||||
88
mobile/openapi/lib/model/user_status.dart
generated
Normal file
88
mobile/openapi/lib/model/user_status.dart
generated
Normal file
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class UserStatus {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const UserStatus._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const active = UserStatus._(r'active');
|
||||
static const removing = UserStatus._(r'removing');
|
||||
static const deleted = UserStatus._(r'deleted');
|
||||
|
||||
/// List of all possible values in this [enum][UserStatus].
|
||||
static const values = <UserStatus>[
|
||||
active,
|
||||
removing,
|
||||
deleted,
|
||||
];
|
||||
|
||||
static UserStatus? fromJson(dynamic value) => UserStatusTypeTransformer().decode(value);
|
||||
|
||||
static List<UserStatus> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <UserStatus>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = UserStatus.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [UserStatus] to String,
|
||||
/// and [decode] dynamic data back to [UserStatus].
|
||||
class UserStatusTypeTransformer {
|
||||
factory UserStatusTypeTransformer() => _instance ??= const UserStatusTypeTransformer._();
|
||||
|
||||
const UserStatusTypeTransformer._();
|
||||
|
||||
String encode(UserStatus data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a UserStatus.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
UserStatus? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'active': return UserStatus.active;
|
||||
case r'removing': return UserStatus.removing;
|
||||
case r'deleted': return UserStatus.deleted;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [UserStatusTypeTransformer] instance.
|
||||
static UserStatusTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
27
mobile/openapi/test/delete_user_dto_test.dart
generated
Normal file
27
mobile/openapi/test/delete_user_dto_test.dart
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for DeleteUserDto
|
||||
void main() {
|
||||
// final instance = DeleteUserDto();
|
||||
|
||||
group('test DeleteUserDto', () {
|
||||
// bool force
|
||||
test('to test the property `force`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@@ -86,6 +86,11 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// UserStatus status
|
||||
test('to test the property `status`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String storageLabel
|
||||
test('to test the property `storageLabel`', () async {
|
||||
// TODO
|
||||
|
||||
2
mobile/openapi/test/user_api_test.dart
generated
2
mobile/openapi/test/user_api_test.dart
generated
@@ -32,7 +32,7 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
//Future<UserResponseDto> deleteUser(String id) async
|
||||
//Future<UserResponseDto> deleteUser(String id, DeleteUserDto deleteUserDto) async
|
||||
test('test deleteUser', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
5
mobile/openapi/test/user_response_dto_test.dart
generated
5
mobile/openapi/test/user_response_dto_test.dart
generated
@@ -81,6 +81,11 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// UserStatus status
|
||||
test('to test the property `status`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String storageLabel
|
||||
test('to test the property `storageLabel`', () async {
|
||||
// TODO
|
||||
|
||||
21
mobile/openapi/test/user_status_test.dart
generated
Normal file
21
mobile/openapi/test/user_status_test.dart
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for UserStatus
|
||||
void main() {
|
||||
|
||||
group('test UserStatus', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user