refactor(server): standardize user controller (#3501)

* chore: remove redundant sortint

* chore: standardize user controller

* chore: open api

* fix: web dtos
This commit is contained in:
Jason Rasmussen 2023-08-03 14:17:38 -04:00 committed by GitHub
parent fa03ed7dd7
commit b44f8d52ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 242 additions and 255 deletions

View file

@ -166,13 +166,13 @@ Class | Method | HTTP request | Description
*TagApi* | [**updateTag**](doc//TagApi.md#updatetag) | **PATCH** /tag/{id} |
*UserApi* | [**createProfileImage**](doc//UserApi.md#createprofileimage) | **POST** /user/profile-image |
*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user |
*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{userId} |
*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{id} |
*UserApi* | [**getAllUsers**](doc//UserApi.md#getallusers) | **GET** /user |
*UserApi* | [**getMyUserInfo**](doc//UserApi.md#getmyuserinfo) | **GET** /user/me |
*UserApi* | [**getProfileImage**](doc//UserApi.md#getprofileimage) | **GET** /user/profile-image/{userId} |
*UserApi* | [**getUserById**](doc//UserApi.md#getuserbyid) | **GET** /user/info/{userId} |
*UserApi* | [**getProfileImage**](doc//UserApi.md#getprofileimage) | **GET** /user/profile-image/{id} |
*UserApi* | [**getUserById**](doc//UserApi.md#getuserbyid) | **GET** /user/info/{id} |
*UserApi* | [**getUserCount**](doc//UserApi.md#getusercount) | **GET** /user/count |
*UserApi* | [**restoreUser**](doc//UserApi.md#restoreuser) | **POST** /user/{userId}/restore |
*UserApi* | [**restoreUser**](doc//UserApi.md#restoreuser) | **POST** /user/{id}/restore |
*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user |

View file

@ -11,13 +11,13 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**createProfileImage**](UserApi.md#createprofileimage) | **POST** /user/profile-image |
[**createUser**](UserApi.md#createuser) | **POST** /user |
[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{userId} |
[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{id} |
[**getAllUsers**](UserApi.md#getallusers) | **GET** /user |
[**getMyUserInfo**](UserApi.md#getmyuserinfo) | **GET** /user/me |
[**getProfileImage**](UserApi.md#getprofileimage) | **GET** /user/profile-image/{userId} |
[**getUserById**](UserApi.md#getuserbyid) | **GET** /user/info/{userId} |
[**getProfileImage**](UserApi.md#getprofileimage) | **GET** /user/profile-image/{id} |
[**getUserById**](UserApi.md#getuserbyid) | **GET** /user/info/{id} |
[**getUserCount**](UserApi.md#getusercount) | **GET** /user/count |
[**restoreUser**](UserApi.md#restoreuser) | **POST** /user/{userId}/restore |
[**restoreUser**](UserApi.md#restoreuser) | **POST** /user/{id}/restore |
[**updateUser**](UserApi.md#updateuser) | **PUT** /user |
@ -132,7 +132,7 @@ Name | Type | Description | Notes
[[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(userId)
> UserResponseDto deleteUser(id)
@ -155,10 +155,10 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = UserApi();
final userId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
final result = api_instance.deleteUser(userId);
final result = api_instance.deleteUser(id);
print(result);
} catch (e) {
print('Exception when calling UserApi->deleteUser: $e\n');
@ -169,7 +169,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**userId** | **String**| |
**id** | **String**| |
### Return type
@ -293,7 +293,7 @@ This endpoint does not need any parameter.
[[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)
# **getProfileImage**
> Object getProfileImage(userId)
> Object getProfileImage(id)
@ -316,10 +316,10 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = UserApi();
final userId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
final result = api_instance.getProfileImage(userId);
final result = api_instance.getProfileImage(id);
print(result);
} catch (e) {
print('Exception when calling UserApi->getProfileImage: $e\n');
@ -330,7 +330,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**userId** | **String**| |
**id** | **String**| |
### Return type
@ -348,7 +348,7 @@ Name | Type | Description | Notes
[[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)
# **getUserById**
> UserResponseDto getUserById(userId)
> UserResponseDto getUserById(id)
@ -371,10 +371,10 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = UserApi();
final userId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
final result = api_instance.getUserById(userId);
final result = api_instance.getUserById(id);
print(result);
} catch (e) {
print('Exception when calling UserApi->getUserById: $e\n');
@ -385,7 +385,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**userId** | **String**| |
**id** | **String**| |
### Return type
@ -444,7 +444,7 @@ No authorization required
[[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)
# **restoreUser**
> UserResponseDto restoreUser(userId)
> UserResponseDto restoreUser(id)
@ -467,10 +467,10 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = UserApi();
final userId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
final result = api_instance.restoreUser(userId);
final result = api_instance.restoreUser(id);
print(result);
} catch (e) {
print('Exception when calling UserApi->restoreUser: $e\n');
@ -481,7 +481,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**userId** | **String**| |
**id** | **String**| |
### Return type

View file

@ -120,14 +120,14 @@ class UserApi {
return null;
}
/// Performs an HTTP 'DELETE /user/{userId}' operation and returns the [Response].
/// Performs an HTTP 'DELETE /user/{id}' operation and returns the [Response].
/// Parameters:
///
/// * [String] userId (required):
Future<Response> deleteUserWithHttpInfo(String userId,) async {
/// * [String] id (required):
Future<Response> deleteUserWithHttpInfo(String id,) async {
// ignore: prefer_const_declarations
final path = r'/user/{userId}'
.replaceAll('{userId}', userId);
final path = r'/user/{id}'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
@ -152,9 +152,9 @@ class UserApi {
/// Parameters:
///
/// * [String] userId (required):
Future<UserResponseDto?> deleteUser(String userId,) async {
final response = await deleteUserWithHttpInfo(userId,);
/// * [String] id (required):
Future<UserResponseDto?> deleteUser(String id,) async {
final response = await deleteUserWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@ -261,14 +261,14 @@ class UserApi {
return null;
}
/// Performs an HTTP 'GET /user/profile-image/{userId}' operation and returns the [Response].
/// Performs an HTTP 'GET /user/profile-image/{id}' operation and returns the [Response].
/// Parameters:
///
/// * [String] userId (required):
Future<Response> getProfileImageWithHttpInfo(String userId,) async {
/// * [String] id (required):
Future<Response> getProfileImageWithHttpInfo(String id,) async {
// ignore: prefer_const_declarations
final path = r'/user/profile-image/{userId}'
.replaceAll('{userId}', userId);
final path = r'/user/profile-image/{id}'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
@ -293,9 +293,9 @@ class UserApi {
/// Parameters:
///
/// * [String] userId (required):
Future<Object?> getProfileImage(String userId,) async {
final response = await getProfileImageWithHttpInfo(userId,);
/// * [String] id (required):
Future<Object?> getProfileImage(String id,) async {
final response = await getProfileImageWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@ -309,14 +309,14 @@ class UserApi {
return null;
}
/// Performs an HTTP 'GET /user/info/{userId}' operation and returns the [Response].
/// Performs an HTTP 'GET /user/info/{id}' operation and returns the [Response].
/// Parameters:
///
/// * [String] userId (required):
Future<Response> getUserByIdWithHttpInfo(String userId,) async {
/// * [String] id (required):
Future<Response> getUserByIdWithHttpInfo(String id,) async {
// ignore: prefer_const_declarations
final path = r'/user/info/{userId}'
.replaceAll('{userId}', userId);
final path = r'/user/info/{id}'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
@ -341,9 +341,9 @@ class UserApi {
/// Parameters:
///
/// * [String] userId (required):
Future<UserResponseDto?> getUserById(String userId,) async {
final response = await getUserByIdWithHttpInfo(userId,);
/// * [String] id (required):
Future<UserResponseDto?> getUserById(String id,) async {
final response = await getUserByIdWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@ -408,14 +408,14 @@ class UserApi {
return null;
}
/// Performs an HTTP 'POST /user/{userId}/restore' operation and returns the [Response].
/// Performs an HTTP 'POST /user/{id}/restore' operation and returns the [Response].
/// Parameters:
///
/// * [String] userId (required):
Future<Response> restoreUserWithHttpInfo(String userId,) async {
/// * [String] id (required):
Future<Response> restoreUserWithHttpInfo(String id,) async {
// ignore: prefer_const_declarations
final path = r'/user/{userId}/restore'
.replaceAll('{userId}', userId);
final path = r'/user/{id}/restore'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
@ -440,9 +440,9 @@ class UserApi {
/// Parameters:
///
/// * [String] userId (required):
Future<UserResponseDto?> restoreUser(String userId,) async {
final response = await restoreUserWithHttpInfo(userId,);
/// * [String] id (required):
Future<UserResponseDto?> restoreUser(String id,) async {
final response = await restoreUserWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View file

@ -27,7 +27,7 @@ void main() {
// TODO
});
//Future<UserResponseDto> deleteUser(String userId) async
//Future<UserResponseDto> deleteUser(String id) async
test('test deleteUser', () async {
// TODO
});
@ -42,12 +42,12 @@ void main() {
// TODO
});
//Future<Object> getProfileImage(String userId) async
//Future<Object> getProfileImage(String id) async
test('test getProfileImage', () async {
// TODO
});
//Future<UserResponseDto> getUserById(String userId) async
//Future<UserResponseDto> getUserById(String id) async
test('test getUserById', () async {
// TODO
});
@ -57,7 +57,7 @@ void main() {
// TODO
});
//Future<UserResponseDto> restoreUser(String userId) async
//Future<UserResponseDto> restoreUser(String id) async
test('test restoreUser', () async {
// TODO
});