mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-02 18:47:07 -05:00 
			
		
		
		
	chore(server): remove user count endpoint (#4724)
* chore: remove unused endpoint * chore: open api
This commit is contained in:
		
							parent
							
								
									2f87463170
								
							
						
					
					
						commit
						8dcd159bd6
					
				
							
								
								
									
										101
									
								
								cli/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										101
									
								
								cli/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							@ -3964,6 +3964,7 @@ export const TranscodeHWAccel = {
 | 
				
			|||||||
    Nvenc: 'nvenc',
 | 
					    Nvenc: 'nvenc',
 | 
				
			||||||
    Qsv: 'qsv',
 | 
					    Qsv: 'qsv',
 | 
				
			||||||
    Vaapi: 'vaapi',
 | 
					    Vaapi: 'vaapi',
 | 
				
			||||||
 | 
					    Rkmpp: 'rkmpp',
 | 
				
			||||||
    Disabled: 'disabled'
 | 
					    Disabled: 'disabled'
 | 
				
			||||||
} as const;
 | 
					} as const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4209,19 +4210,6 @@ export interface UsageByUserDto {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    'videos': number;
 | 
					    'videos': number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 * @export
 | 
					 | 
				
			||||||
 * @interface UserCountResponseDto
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export interface UserCountResponseDto {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * @type {number}
 | 
					 | 
				
			||||||
     * @memberof UserCountResponseDto
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    'userCount': number;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * @export
 | 
					 * @export
 | 
				
			||||||
@ -15742,49 +15730,6 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
            setSearchParams(localVarUrlObj, localVarQueryParameter);
 | 
					 | 
				
			||||||
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
 | 
					 | 
				
			||||||
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return {
 | 
					 | 
				
			||||||
                url: toPathString(localVarUrlObj),
 | 
					 | 
				
			||||||
                options: localVarRequestOptions,
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * 
 | 
					 | 
				
			||||||
         * @param {boolean} [admin] 
 | 
					 | 
				
			||||||
         * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
         * @throws {RequiredError}
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        getUserCount: async (admin?: boolean, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
 | 
					 | 
				
			||||||
            const localVarPath = `/user/count`;
 | 
					 | 
				
			||||||
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | 
					 | 
				
			||||||
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
 | 
					 | 
				
			||||||
            let baseOptions;
 | 
					 | 
				
			||||||
            if (configuration) {
 | 
					 | 
				
			||||||
                baseOptions = configuration.baseOptions;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
 | 
					 | 
				
			||||||
            const localVarHeaderParameter = {} as any;
 | 
					 | 
				
			||||||
            const localVarQueryParameter = {} as any;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // authentication cookie required
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // authentication api_key required
 | 
					 | 
				
			||||||
            await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // authentication bearer required
 | 
					 | 
				
			||||||
            // http bearer authentication required
 | 
					 | 
				
			||||||
            await setBearerAuthToObject(localVarHeaderParameter, configuration)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (admin !== undefined) {
 | 
					 | 
				
			||||||
                localVarQueryParameter['admin'] = admin;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
            setSearchParams(localVarUrlObj, localVarQueryParameter);
 | 
					            setSearchParams(localVarUrlObj, localVarQueryParameter);
 | 
				
			||||||
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
 | 
					            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
 | 
				
			||||||
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
 | 
					            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
 | 
				
			||||||
@ -15959,16 +15904,6 @@ export const UserApiFp = function(configuration?: Configuration) {
 | 
				
			|||||||
            const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(id, options);
 | 
					            const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(id, options);
 | 
				
			||||||
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
 | 
					            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * 
 | 
					 | 
				
			||||||
         * @param {boolean} [admin] 
 | 
					 | 
				
			||||||
         * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
         * @throws {RequiredError}
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        async getUserCount(admin?: boolean, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserCountResponseDto>> {
 | 
					 | 
				
			||||||
            const localVarAxiosArgs = await localVarAxiosParamCreator.getUserCount(admin, options);
 | 
					 | 
				
			||||||
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * 
 | 
					         * 
 | 
				
			||||||
         * @param {string} id 
 | 
					         * @param {string} id 
 | 
				
			||||||
@ -16061,15 +15996,6 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
 | 
				
			|||||||
        getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> {
 | 
					        getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> {
 | 
				
			||||||
            return localVarFp.getUserById(requestParameters.id, options).then((request) => request(axios, basePath));
 | 
					            return localVarFp.getUserById(requestParameters.id, options).then((request) => request(axios, basePath));
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * 
 | 
					 | 
				
			||||||
         * @param {UserApiGetUserCountRequest} requestParameters Request parameters.
 | 
					 | 
				
			||||||
         * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
         * @throws {RequiredError}
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        getUserCount(requestParameters: UserApiGetUserCountRequest = {}, options?: AxiosRequestConfig): AxiosPromise<UserCountResponseDto> {
 | 
					 | 
				
			||||||
            return localVarFp.getUserCount(requestParameters.admin, options).then((request) => request(axios, basePath));
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * 
 | 
					         * 
 | 
				
			||||||
         * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
					         * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
				
			||||||
@ -16175,20 +16101,6 @@ export interface UserApiGetUserByIdRequest {
 | 
				
			|||||||
    readonly id: string
 | 
					    readonly id: string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Request parameters for getUserCount operation in UserApi.
 | 
					 | 
				
			||||||
 * @export
 | 
					 | 
				
			||||||
 * @interface UserApiGetUserCountRequest
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export interface UserApiGetUserCountRequest {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * @type {boolean}
 | 
					 | 
				
			||||||
     * @memberof UserApiGetUserCount
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    readonly admin?: boolean
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Request parameters for restoreUser operation in UserApi.
 | 
					 * Request parameters for restoreUser operation in UserApi.
 | 
				
			||||||
 * @export
 | 
					 * @export
 | 
				
			||||||
@ -16300,17 +16212,6 @@ export class UserApi extends BaseAPI {
 | 
				
			|||||||
        return UserApiFp(this.configuration).getUserById(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
 | 
					        return UserApiFp(this.configuration).getUserById(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * @param {UserApiGetUserCountRequest} requestParameters Request parameters.
 | 
					 | 
				
			||||||
     * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
     * @throws {RequiredError}
 | 
					 | 
				
			||||||
     * @memberof UserApi
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public getUserCount(requestParameters: UserApiGetUserCountRequest = {}, options?: AxiosRequestConfig) {
 | 
					 | 
				
			||||||
        return UserApiFp(this.configuration).getUserCount(requestParameters.admin, options).then((request) => request(this.axios, this.basePath));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
					     * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										3
									
								
								mobile/openapi/.openapi-generator/FILES
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								mobile/openapi/.openapi-generator/FILES
									
									
									
										generated
									
									
									
								
							@ -156,7 +156,6 @@ doc/UpdateTagDto.md
 | 
				
			|||||||
doc/UpdateUserDto.md
 | 
					doc/UpdateUserDto.md
 | 
				
			||||||
doc/UsageByUserDto.md
 | 
					doc/UsageByUserDto.md
 | 
				
			||||||
doc/UserApi.md
 | 
					doc/UserApi.md
 | 
				
			||||||
doc/UserCountResponseDto.md
 | 
					 | 
				
			||||||
doc/UserResponseDto.md
 | 
					doc/UserResponseDto.md
 | 
				
			||||||
doc/ValidateAccessTokenResponseDto.md
 | 
					doc/ValidateAccessTokenResponseDto.md
 | 
				
			||||||
doc/VideoCodec.md
 | 
					doc/VideoCodec.md
 | 
				
			||||||
@ -323,7 +322,6 @@ lib/model/update_stack_parent_dto.dart
 | 
				
			|||||||
lib/model/update_tag_dto.dart
 | 
					lib/model/update_tag_dto.dart
 | 
				
			||||||
lib/model/update_user_dto.dart
 | 
					lib/model/update_user_dto.dart
 | 
				
			||||||
lib/model/usage_by_user_dto.dart
 | 
					lib/model/usage_by_user_dto.dart
 | 
				
			||||||
lib/model/user_count_response_dto.dart
 | 
					 | 
				
			||||||
lib/model/user_response_dto.dart
 | 
					lib/model/user_response_dto.dart
 | 
				
			||||||
lib/model/validate_access_token_response_dto.dart
 | 
					lib/model/validate_access_token_response_dto.dart
 | 
				
			||||||
lib/model/video_codec.dart
 | 
					lib/model/video_codec.dart
 | 
				
			||||||
@ -481,7 +479,6 @@ test/update_tag_dto_test.dart
 | 
				
			|||||||
test/update_user_dto_test.dart
 | 
					test/update_user_dto_test.dart
 | 
				
			||||||
test/usage_by_user_dto_test.dart
 | 
					test/usage_by_user_dto_test.dart
 | 
				
			||||||
test/user_api_test.dart
 | 
					test/user_api_test.dart
 | 
				
			||||||
test/user_count_response_dto_test.dart
 | 
					 | 
				
			||||||
test/user_response_dto_test.dart
 | 
					test/user_response_dto_test.dart
 | 
				
			||||||
test/validate_access_token_response_dto_test.dart
 | 
					test/validate_access_token_response_dto_test.dart
 | 
				
			||||||
test/video_codec_test.dart
 | 
					test/video_codec_test.dart
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								mobile/openapi/README.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								mobile/openapi/README.md
									
									
									
										generated
									
									
									
								
							@ -194,7 +194,6 @@ Class | Method | HTTP request | Description
 | 
				
			|||||||
*UserApi* | [**getMyUserInfo**](doc//UserApi.md#getmyuserinfo) | **GET** /user/me | 
 | 
					*UserApi* | [**getMyUserInfo**](doc//UserApi.md#getmyuserinfo) | **GET** /user/me | 
 | 
				
			||||||
*UserApi* | [**getProfileImage**](doc//UserApi.md#getprofileimage) | **GET** /user/profile-image/{id} | 
 | 
					*UserApi* | [**getProfileImage**](doc//UserApi.md#getprofileimage) | **GET** /user/profile-image/{id} | 
 | 
				
			||||||
*UserApi* | [**getUserById**](doc//UserApi.md#getuserbyid) | **GET** /user/info/{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/{id}/restore | 
 | 
					*UserApi* | [**restoreUser**](doc//UserApi.md#restoreuser) | **POST** /user/{id}/restore | 
 | 
				
			||||||
*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user | 
 | 
					*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user | 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -338,7 +337,6 @@ Class | Method | HTTP request | Description
 | 
				
			|||||||
 - [UpdateTagDto](doc//UpdateTagDto.md)
 | 
					 - [UpdateTagDto](doc//UpdateTagDto.md)
 | 
				
			||||||
 - [UpdateUserDto](doc//UpdateUserDto.md)
 | 
					 - [UpdateUserDto](doc//UpdateUserDto.md)
 | 
				
			||||||
 - [UsageByUserDto](doc//UsageByUserDto.md)
 | 
					 - [UsageByUserDto](doc//UsageByUserDto.md)
 | 
				
			||||||
 - [UserCountResponseDto](doc//UserCountResponseDto.md)
 | 
					 | 
				
			||||||
 - [UserResponseDto](doc//UserResponseDto.md)
 | 
					 - [UserResponseDto](doc//UserResponseDto.md)
 | 
				
			||||||
 - [ValidateAccessTokenResponseDto](doc//ValidateAccessTokenResponseDto.md)
 | 
					 - [ValidateAccessTokenResponseDto](doc//ValidateAccessTokenResponseDto.md)
 | 
				
			||||||
 - [VideoCodec](doc//VideoCodec.md)
 | 
					 - [VideoCodec](doc//VideoCodec.md)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										56
									
								
								mobile/openapi/doc/UserApi.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										56
									
								
								mobile/openapi/doc/UserApi.md
									
									
									
										generated
									
									
									
								
							@ -16,7 +16,6 @@ Method | HTTP request | Description
 | 
				
			|||||||
[**getMyUserInfo**](UserApi.md#getmyuserinfo) | **GET** /user/me | 
 | 
					[**getMyUserInfo**](UserApi.md#getmyuserinfo) | **GET** /user/me | 
 | 
				
			||||||
[**getProfileImage**](UserApi.md#getprofileimage) | **GET** /user/profile-image/{id} | 
 | 
					[**getProfileImage**](UserApi.md#getprofileimage) | **GET** /user/profile-image/{id} | 
 | 
				
			||||||
[**getUserById**](UserApi.md#getuserbyid) | **GET** /user/info/{id} | 
 | 
					[**getUserById**](UserApi.md#getuserbyid) | **GET** /user/info/{id} | 
 | 
				
			||||||
[**getUserCount**](UserApi.md#getusercount) | **GET** /user/count | 
 | 
					 | 
				
			||||||
[**restoreUser**](UserApi.md#restoreuser) | **POST** /user/{id}/restore | 
 | 
					[**restoreUser**](UserApi.md#restoreuser) | **POST** /user/{id}/restore | 
 | 
				
			||||||
[**updateUser**](UserApi.md#updateuser) | **PUT** /user | 
 | 
					[**updateUser**](UserApi.md#updateuser) | **PUT** /user | 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -402,61 +401,6 @@ 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)
 | 
					[[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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# **getUserCount**
 | 
					 | 
				
			||||||
> UserCountResponseDto getUserCount(admin)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Example
 | 
					 | 
				
			||||||
```dart
 | 
					 | 
				
			||||||
import 'package:openapi/api.dart';
 | 
					 | 
				
			||||||
// TODO Configure API key authorization: cookie
 | 
					 | 
				
			||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
 | 
					 | 
				
			||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
 | 
					 | 
				
			||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
 | 
					 | 
				
			||||||
// TODO Configure API key authorization: api_key
 | 
					 | 
				
			||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
 | 
					 | 
				
			||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
 | 
					 | 
				
			||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
 | 
					 | 
				
			||||||
// TODO Configure HTTP Bearer authorization: bearer
 | 
					 | 
				
			||||||
// Case 1. Use String Token
 | 
					 | 
				
			||||||
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
 | 
					 | 
				
			||||||
// Case 2. Use Function which generate token.
 | 
					 | 
				
			||||||
// String yourTokenGeneratorFunction() { ... }
 | 
					 | 
				
			||||||
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
final api_instance = UserApi();
 | 
					 | 
				
			||||||
final admin = true; // bool | 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
try {
 | 
					 | 
				
			||||||
    final result = api_instance.getUserCount(admin);
 | 
					 | 
				
			||||||
    print(result);
 | 
					 | 
				
			||||||
} catch (e) {
 | 
					 | 
				
			||||||
    print('Exception when calling UserApi->getUserCount: $e\n');
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Parameters
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Name | Type | Description  | Notes
 | 
					 | 
				
			||||||
------------- | ------------- | ------------- | -------------
 | 
					 | 
				
			||||||
 **admin** | **bool**|  | [optional] [default to false]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Return type
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[**UserCountResponseDto**](UserCountResponseDto.md)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Authorization
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### HTTP request headers
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 - **Content-Type**: Not defined
 | 
					 | 
				
			||||||
 - **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)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# **restoreUser**
 | 
					# **restoreUser**
 | 
				
			||||||
> UserResponseDto restoreUser(id)
 | 
					> UserResponseDto restoreUser(id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								mobile/openapi/doc/UserCountResponseDto.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										15
									
								
								mobile/openapi/doc/UserCountResponseDto.md
									
									
									
										generated
									
									
									
								
							@ -1,15 +0,0 @@
 | 
				
			|||||||
# openapi.model.UserCountResponseDto
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Load the model package
 | 
					 | 
				
			||||||
```dart
 | 
					 | 
				
			||||||
import 'package:openapi/api.dart';
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Properties
 | 
					 | 
				
			||||||
Name | Type | Description | Notes
 | 
					 | 
				
			||||||
------------ | ------------- | ------------- | -------------
 | 
					 | 
				
			||||||
**userCount** | **int** |  | 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[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/lib/api.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								mobile/openapi/lib/api.dart
									
									
									
										generated
									
									
									
								
							@ -182,7 +182,6 @@ part 'model/update_stack_parent_dto.dart';
 | 
				
			|||||||
part 'model/update_tag_dto.dart';
 | 
					part 'model/update_tag_dto.dart';
 | 
				
			||||||
part 'model/update_user_dto.dart';
 | 
					part 'model/update_user_dto.dart';
 | 
				
			||||||
part 'model/usage_by_user_dto.dart';
 | 
					part 'model/usage_by_user_dto.dart';
 | 
				
			||||||
part 'model/user_count_response_dto.dart';
 | 
					 | 
				
			||||||
part 'model/user_response_dto.dart';
 | 
					part 'model/user_response_dto.dart';
 | 
				
			||||||
part 'model/validate_access_token_response_dto.dart';
 | 
					part 'model/validate_access_token_response_dto.dart';
 | 
				
			||||||
part 'model/video_codec.dart';
 | 
					part 'model/video_codec.dart';
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										51
									
								
								mobile/openapi/lib/api/user_api.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										51
									
								
								mobile/openapi/lib/api/user_api.dart
									
									
									
										generated
									
									
									
								
							@ -357,57 +357,6 @@ class UserApi {
 | 
				
			|||||||
    return null;
 | 
					    return null;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Performs an HTTP 'GET /user/count' operation and returns the [Response].
 | 
					 | 
				
			||||||
  /// Parameters:
 | 
					 | 
				
			||||||
  ///
 | 
					 | 
				
			||||||
  /// * [bool] admin:
 | 
					 | 
				
			||||||
  Future<Response> getUserCountWithHttpInfo({ bool? admin, }) async {
 | 
					 | 
				
			||||||
    // ignore: prefer_const_declarations
 | 
					 | 
				
			||||||
    final path = r'/user/count';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // ignore: prefer_final_locals
 | 
					 | 
				
			||||||
    Object? postBody;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    final queryParams = <QueryParam>[];
 | 
					 | 
				
			||||||
    final headerParams = <String, String>{};
 | 
					 | 
				
			||||||
    final formParams = <String, String>{};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (admin != null) {
 | 
					 | 
				
			||||||
      queryParams.addAll(_queryParams('', 'admin', admin));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const contentTypes = <String>[];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return apiClient.invokeAPI(
 | 
					 | 
				
			||||||
      path,
 | 
					 | 
				
			||||||
      'GET',
 | 
					 | 
				
			||||||
      queryParams,
 | 
					 | 
				
			||||||
      postBody,
 | 
					 | 
				
			||||||
      headerParams,
 | 
					 | 
				
			||||||
      formParams,
 | 
					 | 
				
			||||||
      contentTypes.isEmpty ? null : contentTypes.first,
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /// Parameters:
 | 
					 | 
				
			||||||
  ///
 | 
					 | 
				
			||||||
  /// * [bool] admin:
 | 
					 | 
				
			||||||
  Future<UserCountResponseDto?> getUserCount({ bool? admin, }) async {
 | 
					 | 
				
			||||||
    final response = await getUserCountWithHttpInfo( admin: admin, );
 | 
					 | 
				
			||||||
    if (response.statusCode >= HttpStatus.badRequest) {
 | 
					 | 
				
			||||||
      throw ApiException(response.statusCode, await _decodeBodyBytes(response));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // When a remote server returns no body with a status of 204, we shall not decode it.
 | 
					 | 
				
			||||||
    // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
 | 
					 | 
				
			||||||
    // FormatException when trying to decode an empty string.
 | 
					 | 
				
			||||||
    if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
 | 
					 | 
				
			||||||
      return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserCountResponseDto',) as UserCountResponseDto;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return null;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /// Performs an HTTP 'POST /user/{id}/restore' operation and returns the [Response].
 | 
					  /// Performs an HTTP 'POST /user/{id}/restore' operation and returns the [Response].
 | 
				
			||||||
  /// Parameters:
 | 
					  /// Parameters:
 | 
				
			||||||
  ///
 | 
					  ///
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								mobile/openapi/lib/api_client.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								mobile/openapi/lib/api_client.dart
									
									
									
										generated
									
									
									
								
							@ -455,8 +455,6 @@ class ApiClient {
 | 
				
			|||||||
          return UpdateUserDto.fromJson(value);
 | 
					          return UpdateUserDto.fromJson(value);
 | 
				
			||||||
        case 'UsageByUserDto':
 | 
					        case 'UsageByUserDto':
 | 
				
			||||||
          return UsageByUserDto.fromJson(value);
 | 
					          return UsageByUserDto.fromJson(value);
 | 
				
			||||||
        case 'UserCountResponseDto':
 | 
					 | 
				
			||||||
          return UserCountResponseDto.fromJson(value);
 | 
					 | 
				
			||||||
        case 'UserResponseDto':
 | 
					        case 'UserResponseDto':
 | 
				
			||||||
          return UserResponseDto.fromJson(value);
 | 
					          return UserResponseDto.fromJson(value);
 | 
				
			||||||
        case 'ValidateAccessTokenResponseDto':
 | 
					        case 'ValidateAccessTokenResponseDto':
 | 
				
			||||||
 | 
				
			|||||||
@ -1,98 +0,0 @@
 | 
				
			|||||||
//
 | 
					 | 
				
			||||||
// 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 UserCountResponseDto {
 | 
					 | 
				
			||||||
  /// Returns a new [UserCountResponseDto] instance.
 | 
					 | 
				
			||||||
  UserCountResponseDto({
 | 
					 | 
				
			||||||
    required this.userCount,
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int userCount;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  bool operator ==(Object other) => identical(this, other) || other is UserCountResponseDto &&
 | 
					 | 
				
			||||||
     other.userCount == userCount;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  int get hashCode =>
 | 
					 | 
				
			||||||
    // ignore: unnecessary_parenthesis
 | 
					 | 
				
			||||||
    (userCount.hashCode);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  String toString() => 'UserCountResponseDto[userCount=$userCount]';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Map<String, dynamic> toJson() {
 | 
					 | 
				
			||||||
    final json = <String, dynamic>{};
 | 
					 | 
				
			||||||
      json[r'userCount'] = this.userCount;
 | 
					 | 
				
			||||||
    return json;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /// Returns a new [UserCountResponseDto] instance and imports its values from
 | 
					 | 
				
			||||||
  /// [value] if it's a [Map], null otherwise.
 | 
					 | 
				
			||||||
  // ignore: prefer_constructors_over_static_methods
 | 
					 | 
				
			||||||
  static UserCountResponseDto? fromJson(dynamic value) {
 | 
					 | 
				
			||||||
    if (value is Map) {
 | 
					 | 
				
			||||||
      final json = value.cast<String, dynamic>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return UserCountResponseDto(
 | 
					 | 
				
			||||||
        userCount: mapValueOfType<int>(json, r'userCount')!,
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return null;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static List<UserCountResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
 | 
					 | 
				
			||||||
    final result = <UserCountResponseDto>[];
 | 
					 | 
				
			||||||
    if (json is List && json.isNotEmpty) {
 | 
					 | 
				
			||||||
      for (final row in json) {
 | 
					 | 
				
			||||||
        final value = UserCountResponseDto.fromJson(row);
 | 
					 | 
				
			||||||
        if (value != null) {
 | 
					 | 
				
			||||||
          result.add(value);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return result.toList(growable: growable);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static Map<String, UserCountResponseDto> mapFromJson(dynamic json) {
 | 
					 | 
				
			||||||
    final map = <String, UserCountResponseDto>{};
 | 
					 | 
				
			||||||
    if (json is Map && json.isNotEmpty) {
 | 
					 | 
				
			||||||
      json = json.cast<String, dynamic>(); // ignore: parameter_assignments
 | 
					 | 
				
			||||||
      for (final entry in json.entries) {
 | 
					 | 
				
			||||||
        final value = UserCountResponseDto.fromJson(entry.value);
 | 
					 | 
				
			||||||
        if (value != null) {
 | 
					 | 
				
			||||||
          map[entry.key] = value;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return map;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // maps a json object with a list of UserCountResponseDto-objects as value to a dart map
 | 
					 | 
				
			||||||
  static Map<String, List<UserCountResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
 | 
					 | 
				
			||||||
    final map = <String, List<UserCountResponseDto>>{};
 | 
					 | 
				
			||||||
    if (json is Map && json.isNotEmpty) {
 | 
					 | 
				
			||||||
      // ignore: parameter_assignments
 | 
					 | 
				
			||||||
      json = json.cast<String, dynamic>();
 | 
					 | 
				
			||||||
      for (final entry in json.entries) {
 | 
					 | 
				
			||||||
        map[entry.key] = UserCountResponseDto.listFromJson(entry.value, growable: growable,);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return map;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /// The list of required keys that must be present in a JSON.
 | 
					 | 
				
			||||||
  static const requiredKeys = <String>{
 | 
					 | 
				
			||||||
    'userCount',
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							
								
								
									
										5
									
								
								mobile/openapi/test/user_api_test.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								mobile/openapi/test/user_api_test.dart
									
									
									
										generated
									
									
									
								
							@ -52,11 +52,6 @@ void main() {
 | 
				
			|||||||
      // TODO
 | 
					      // TODO
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //Future<UserCountResponseDto> getUserCount({ bool admin }) async
 | 
					 | 
				
			||||||
    test('test getUserCount', () async {
 | 
					 | 
				
			||||||
      // TODO
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //Future<UserResponseDto> restoreUser(String id) async
 | 
					    //Future<UserResponseDto> restoreUser(String id) async
 | 
				
			||||||
    test('test restoreUser', () async {
 | 
					    test('test restoreUser', () async {
 | 
				
			||||||
      // TODO
 | 
					      // TODO
 | 
				
			||||||
 | 
				
			|||||||
@ -1,27 +0,0 @@
 | 
				
			|||||||
//
 | 
					 | 
				
			||||||
// 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 UserCountResponseDto
 | 
					 | 
				
			||||||
void main() {
 | 
					 | 
				
			||||||
  // final instance = UserCountResponseDto();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  group('test UserCountResponseDto', () {
 | 
					 | 
				
			||||||
    // int userCount
 | 
					 | 
				
			||||||
    test('to test the property `userCount`', () async {
 | 
					 | 
				
			||||||
      // TODO
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -5177,48 +5177,6 @@
 | 
				
			|||||||
        ]
 | 
					        ]
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "/user/count": {
 | 
					 | 
				
			||||||
      "get": {
 | 
					 | 
				
			||||||
        "operationId": "getUserCount",
 | 
					 | 
				
			||||||
        "parameters": [
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            "name": "admin",
 | 
					 | 
				
			||||||
            "required": false,
 | 
					 | 
				
			||||||
            "in": "query",
 | 
					 | 
				
			||||||
            "schema": {
 | 
					 | 
				
			||||||
              "default": false,
 | 
					 | 
				
			||||||
              "type": "boolean"
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        ],
 | 
					 | 
				
			||||||
        "responses": {
 | 
					 | 
				
			||||||
          "200": {
 | 
					 | 
				
			||||||
            "content": {
 | 
					 | 
				
			||||||
              "application/json": {
 | 
					 | 
				
			||||||
                "schema": {
 | 
					 | 
				
			||||||
                  "$ref": "#/components/schemas/UserCountResponseDto"
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "description": ""
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "security": [
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            "bearer": []
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            "cookie": []
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            "api_key": []
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        ],
 | 
					 | 
				
			||||||
        "tags": [
 | 
					 | 
				
			||||||
          "User"
 | 
					 | 
				
			||||||
        ]
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "/user/info/{id}": {
 | 
					    "/user/info/{id}": {
 | 
				
			||||||
      "get": {
 | 
					      "get": {
 | 
				
			||||||
        "operationId": "getUserById",
 | 
					        "operationId": "getUserById",
 | 
				
			||||||
@ -8769,17 +8727,6 @@
 | 
				
			|||||||
        ],
 | 
					        ],
 | 
				
			||||||
        "type": "object"
 | 
					        "type": "object"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "UserCountResponseDto": {
 | 
					 | 
				
			||||||
        "properties": {
 | 
					 | 
				
			||||||
          "userCount": {
 | 
					 | 
				
			||||||
            "type": "integer"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "required": [
 | 
					 | 
				
			||||||
          "userCount"
 | 
					 | 
				
			||||||
        ],
 | 
					 | 
				
			||||||
        "type": "object"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "UserResponseDto": {
 | 
					      "UserResponseDto": {
 | 
				
			||||||
        "properties": {
 | 
					        "properties": {
 | 
				
			||||||
          "createdAt": {
 | 
					          "createdAt": {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
export * from './create-profile-image.dto';
 | 
					export * from './create-profile-image.dto';
 | 
				
			||||||
export * from './create-user.dto';
 | 
					export * from './create-user.dto';
 | 
				
			||||||
export * from './update-user.dto';
 | 
					export * from './update-user.dto';
 | 
				
			||||||
export * from './user-count.dto';
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +0,0 @@
 | 
				
			|||||||
import { Transform } from 'class-transformer';
 | 
					 | 
				
			||||||
import { IsBoolean } from 'class-validator';
 | 
					 | 
				
			||||||
import { Optional } from '../../domain.util';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export class UserCountDto {
 | 
					 | 
				
			||||||
  @IsBoolean()
 | 
					 | 
				
			||||||
  @Optional()
 | 
					 | 
				
			||||||
  @Transform(({ value }) => value === 'true')
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * When true, return the number of admins accounts
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  admin?: boolean = false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,3 +1,2 @@
 | 
				
			|||||||
export * from './create-profile-image-response.dto';
 | 
					export * from './create-profile-image-response.dto';
 | 
				
			||||||
export * from './user-count-response.dto';
 | 
					 | 
				
			||||||
export * from './user-response.dto';
 | 
					export * from './user-response.dto';
 | 
				
			||||||
 | 
				
			|||||||
@ -1,12 +0,0 @@
 | 
				
			|||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export class UserCountResponseDto {
 | 
					 | 
				
			||||||
  @ApiProperty({ type: 'integer' })
 | 
					 | 
				
			||||||
  userCount!: number;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function mapUserCountResponse(count: number): UserCountResponseDto {
 | 
					 | 
				
			||||||
  return {
 | 
					 | 
				
			||||||
    userCount: count,
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -220,24 +220,6 @@ describe(UserService.name, () => {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('getCount', () => {
 | 
					 | 
				
			||||||
    it('should get the user count', async () => {
 | 
					 | 
				
			||||||
      userMock.getList.mockResolvedValue([adminUser]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      const response = await sut.getCount({});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      expect(userMock.getList).toHaveBeenCalled();
 | 
					 | 
				
			||||||
      expect(response).toEqual({ userCount: 1 });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('should get the user count of all admin users', async () => {
 | 
					 | 
				
			||||||
      userMock.getList.mockResolvedValue([adminUser, immichUser]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      await expect(sut.getCount({ admin: true })).resolves.toEqual({ userCount: 1 });
 | 
					 | 
				
			||||||
      expect(userMock.getList).toHaveBeenCalled();
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe('update', () => {
 | 
					  describe('update', () => {
 | 
				
			||||||
    it('should update user', async () => {
 | 
					    it('should update user', async () => {
 | 
				
			||||||
      const update: UpdateUserDto = {
 | 
					      const update: UpdateUserDto = {
 | 
				
			||||||
 | 
				
			|||||||
@ -14,15 +14,8 @@ import {
 | 
				
			|||||||
  IUserRepository,
 | 
					  IUserRepository,
 | 
				
			||||||
} from '../repositories';
 | 
					} from '../repositories';
 | 
				
			||||||
import { StorageCore, StorageFolder } from '../storage';
 | 
					import { StorageCore, StorageFolder } from '../storage';
 | 
				
			||||||
import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto';
 | 
					import { CreateUserDto, UpdateUserDto } from './dto';
 | 
				
			||||||
import {
 | 
					import { CreateProfileImageResponseDto, UserResponseDto, mapCreateProfileImageResponse, mapUser } from './response-dto';
 | 
				
			||||||
  CreateProfileImageResponseDto,
 | 
					 | 
				
			||||||
  UserCountResponseDto,
 | 
					 | 
				
			||||||
  UserResponseDto,
 | 
					 | 
				
			||||||
  mapCreateProfileImageResponse,
 | 
					 | 
				
			||||||
  mapUser,
 | 
					 | 
				
			||||||
  mapUserCountResponse,
 | 
					 | 
				
			||||||
} from './response-dto';
 | 
					 | 
				
			||||||
import { UserCore } from './user.core';
 | 
					import { UserCore } from './user.core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
@ -64,16 +57,6 @@ export class UserService {
 | 
				
			|||||||
    return mapUser(user);
 | 
					    return mapUser(user);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async getCount(dto: UserCountDto): Promise<UserCountResponseDto> {
 | 
					 | 
				
			||||||
    let users = await this.userCore.getList();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (dto.admin) {
 | 
					 | 
				
			||||||
      users = users.filter((user) => user.isAdmin);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return mapUserCountResponse(users.length);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  async create(createUserDto: CreateUserDto): Promise<UserResponseDto> {
 | 
					  async create(createUserDto: CreateUserDto): Promise<UserResponseDto> {
 | 
				
			||||||
    const createdUser = await this.userCore.createUser(createUserDto);
 | 
					    const createdUser = await this.userCore.createUser(createUserDto);
 | 
				
			||||||
    return mapUser(createdUser);
 | 
					    return mapUser(createdUser);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,9 @@
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
  AuthUserDto,
 | 
					  AuthUserDto,
 | 
				
			||||||
  UserCountDto as CountDto,
 | 
					 | 
				
			||||||
  CreateUserDto as CreateDto,
 | 
					  CreateUserDto as CreateDto,
 | 
				
			||||||
  CreateProfileImageDto,
 | 
					  CreateProfileImageDto,
 | 
				
			||||||
  CreateProfileImageResponseDto,
 | 
					  CreateProfileImageResponseDto,
 | 
				
			||||||
  UpdateUserDto as UpdateDto,
 | 
					  UpdateUserDto as UpdateDto,
 | 
				
			||||||
  UserCountResponseDto,
 | 
					 | 
				
			||||||
  UserResponseDto,
 | 
					  UserResponseDto,
 | 
				
			||||||
  UserService,
 | 
					  UserService,
 | 
				
			||||||
} from '@app/domain';
 | 
					} from '@app/domain';
 | 
				
			||||||
@ -59,12 +57,6 @@ export class UserController {
 | 
				
			|||||||
    return this.service.create(createUserDto);
 | 
					    return this.service.create(createUserDto);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @AdminRoute()
 | 
					 | 
				
			||||||
  @Get('count')
 | 
					 | 
				
			||||||
  getUserCount(@Query() dto: CountDto): Promise<UserCountResponseDto> {
 | 
					 | 
				
			||||||
    return this.service.getCount(dto);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @AdminRoute()
 | 
					  @AdminRoute()
 | 
				
			||||||
  @Delete(':id')
 | 
					  @Delete(':id')
 | 
				
			||||||
  deleteUser(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<UserResponseDto> {
 | 
					  deleteUser(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<UserResponseDto> {
 | 
				
			||||||
 | 
				
			|||||||
@ -312,32 +312,4 @@ describe(`${UserController.name}`, () => {
 | 
				
			|||||||
      expect(before.updatedAt).not.toEqual(after.updatedAt);
 | 
					      expect(before.updatedAt).not.toEqual(after.updatedAt);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe('GET /user/count', () => {
 | 
					 | 
				
			||||||
    it('should require authentication', async () => {
 | 
					 | 
				
			||||||
      const { status, body } = await request(server).get(`/user/count`);
 | 
					 | 
				
			||||||
      expect(status).toBe(401);
 | 
					 | 
				
			||||||
      expect(body).toEqual(errorStub.unauthorized);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('should start with just the admin', async () => {
 | 
					 | 
				
			||||||
      const { status, body } = await request(server).get(`/user/count`).set('Authorization', `Bearer ${accessToken}`);
 | 
					 | 
				
			||||||
      expect(status).toBe(200);
 | 
					 | 
				
			||||||
      expect(body).toEqual({ userCount: 1 });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('should return the total user count', async () => {
 | 
					 | 
				
			||||||
      for (let i = 0; i < 5; i++) {
 | 
					 | 
				
			||||||
        await api.userApi.create(server, accessToken, {
 | 
					 | 
				
			||||||
          email: `user${i + 1}@immich.app`,
 | 
					 | 
				
			||||||
          password: 'Password123',
 | 
					 | 
				
			||||||
          firstName: `User ${i + 1}`,
 | 
					 | 
				
			||||||
          lastName: 'Test',
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      const { status, body } = await request(server).get(`/user/count`).set('Authorization', `Bearer ${accessToken}`);
 | 
					 | 
				
			||||||
      expect(status).toBe(200);
 | 
					 | 
				
			||||||
      expect(body).toEqual({ userCount: 6 });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										100
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										100
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							@ -4210,19 +4210,6 @@ export interface UsageByUserDto {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    'videos': number;
 | 
					    'videos': number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 * @export
 | 
					 | 
				
			||||||
 * @interface UserCountResponseDto
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export interface UserCountResponseDto {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * @type {number}
 | 
					 | 
				
			||||||
     * @memberof UserCountResponseDto
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    'userCount': number;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * @export
 | 
					 * @export
 | 
				
			||||||
@ -15743,49 +15730,6 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
            setSearchParams(localVarUrlObj, localVarQueryParameter);
 | 
					 | 
				
			||||||
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
 | 
					 | 
				
			||||||
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return {
 | 
					 | 
				
			||||||
                url: toPathString(localVarUrlObj),
 | 
					 | 
				
			||||||
                options: localVarRequestOptions,
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * 
 | 
					 | 
				
			||||||
         * @param {boolean} [admin] 
 | 
					 | 
				
			||||||
         * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
         * @throws {RequiredError}
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        getUserCount: async (admin?: boolean, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
 | 
					 | 
				
			||||||
            const localVarPath = `/user/count`;
 | 
					 | 
				
			||||||
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | 
					 | 
				
			||||||
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
 | 
					 | 
				
			||||||
            let baseOptions;
 | 
					 | 
				
			||||||
            if (configuration) {
 | 
					 | 
				
			||||||
                baseOptions = configuration.baseOptions;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
 | 
					 | 
				
			||||||
            const localVarHeaderParameter = {} as any;
 | 
					 | 
				
			||||||
            const localVarQueryParameter = {} as any;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // authentication cookie required
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // authentication api_key required
 | 
					 | 
				
			||||||
            await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // authentication bearer required
 | 
					 | 
				
			||||||
            // http bearer authentication required
 | 
					 | 
				
			||||||
            await setBearerAuthToObject(localVarHeaderParameter, configuration)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (admin !== undefined) {
 | 
					 | 
				
			||||||
                localVarQueryParameter['admin'] = admin;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
            setSearchParams(localVarUrlObj, localVarQueryParameter);
 | 
					            setSearchParams(localVarUrlObj, localVarQueryParameter);
 | 
				
			||||||
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
 | 
					            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
 | 
				
			||||||
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
 | 
					            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
 | 
				
			||||||
@ -15960,16 +15904,6 @@ export const UserApiFp = function(configuration?: Configuration) {
 | 
				
			|||||||
            const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(id, options);
 | 
					            const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(id, options);
 | 
				
			||||||
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
 | 
					            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * 
 | 
					 | 
				
			||||||
         * @param {boolean} [admin] 
 | 
					 | 
				
			||||||
         * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
         * @throws {RequiredError}
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        async getUserCount(admin?: boolean, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserCountResponseDto>> {
 | 
					 | 
				
			||||||
            const localVarAxiosArgs = await localVarAxiosParamCreator.getUserCount(admin, options);
 | 
					 | 
				
			||||||
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * 
 | 
					         * 
 | 
				
			||||||
         * @param {string} id 
 | 
					         * @param {string} id 
 | 
				
			||||||
@ -16062,15 +15996,6 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
 | 
				
			|||||||
        getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> {
 | 
					        getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> {
 | 
				
			||||||
            return localVarFp.getUserById(requestParameters.id, options).then((request) => request(axios, basePath));
 | 
					            return localVarFp.getUserById(requestParameters.id, options).then((request) => request(axios, basePath));
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * 
 | 
					 | 
				
			||||||
         * @param {UserApiGetUserCountRequest} requestParameters Request parameters.
 | 
					 | 
				
			||||||
         * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
         * @throws {RequiredError}
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        getUserCount(requestParameters: UserApiGetUserCountRequest = {}, options?: AxiosRequestConfig): AxiosPromise<UserCountResponseDto> {
 | 
					 | 
				
			||||||
            return localVarFp.getUserCount(requestParameters.admin, options).then((request) => request(axios, basePath));
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * 
 | 
					         * 
 | 
				
			||||||
         * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
					         * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
				
			||||||
@ -16176,20 +16101,6 @@ export interface UserApiGetUserByIdRequest {
 | 
				
			|||||||
    readonly id: string
 | 
					    readonly id: string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Request parameters for getUserCount operation in UserApi.
 | 
					 | 
				
			||||||
 * @export
 | 
					 | 
				
			||||||
 * @interface UserApiGetUserCountRequest
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export interface UserApiGetUserCountRequest {
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * @type {boolean}
 | 
					 | 
				
			||||||
     * @memberof UserApiGetUserCount
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    readonly admin?: boolean
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Request parameters for restoreUser operation in UserApi.
 | 
					 * Request parameters for restoreUser operation in UserApi.
 | 
				
			||||||
 * @export
 | 
					 * @export
 | 
				
			||||||
@ -16301,17 +16212,6 @@ export class UserApi extends BaseAPI {
 | 
				
			|||||||
        return UserApiFp(this.configuration).getUserById(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
 | 
					        return UserApiFp(this.configuration).getUserById(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 
 | 
					 | 
				
			||||||
     * @param {UserApiGetUserCountRequest} requestParameters Request parameters.
 | 
					 | 
				
			||||||
     * @param {*} [options] Override http request option.
 | 
					 | 
				
			||||||
     * @throws {RequiredError}
 | 
					 | 
				
			||||||
     * @memberof UserApi
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public getUserCount(requestParameters: UserApiGetUserCountRequest = {}, options?: AxiosRequestConfig) {
 | 
					 | 
				
			||||||
        return UserApiFp(this.configuration).getUserCount(requestParameters.admin, options).then((request) => request(this.axios, this.basePath));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
					     * @param {UserApiRestoreUserRequest} requestParameters Request parameters.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user