mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	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:
		
							
								
								
									
										96
									
								
								cli/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										96
									
								
								cli/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							| @@ -12111,15 +12111,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         deleteUser: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('deleteUser', 'userId', userId) | ||||
|             const localVarPath = `/user/{userId}` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         deleteUser: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('deleteUser', 'id', id) | ||||
|             const localVarPath = `/user/{id}` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12236,15 +12236,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getProfileImage: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('getProfileImage', 'userId', userId) | ||||
|             const localVarPath = `/user/profile-image/{userId}` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         getProfileImage: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('getProfileImage', 'id', id) | ||||
|             const localVarPath = `/user/profile-image/{id}` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12278,15 +12278,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getUserById: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('getUserById', 'userId', userId) | ||||
|             const localVarPath = `/user/info/{userId}` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         getUserById: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('getUserById', 'id', id) | ||||
|             const localVarPath = `/user/info/{id}` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12354,15 +12354,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         restoreUser: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('restoreUser', 'userId', userId) | ||||
|             const localVarPath = `/user/{userId}/restore` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         restoreUser: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('restoreUser', 'id', id) | ||||
|             const localVarPath = `/user/{id}/restore` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12470,12 +12470,12 @@ export const UserApiFp = function(configuration?: Configuration) { | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async deleteUser(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(userId, options); | ||||
|         async deleteUser(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
| @@ -12499,22 +12499,22 @@ export const UserApiFp = function(configuration?: Configuration) { | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async getProfileImage(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getProfileImage(userId, options); | ||||
|         async getProfileImage(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getProfileImage(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async getUserById(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(userId, options); | ||||
|         async getUserById(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
| @@ -12529,12 +12529,12 @@ export const UserApiFp = function(configuration?: Configuration) { | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async restoreUser(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.restoreUser(userId, options); | ||||
|         async restoreUser(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.restoreUser(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
| @@ -12582,7 +12582,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         deleteUser(requestParameters: UserApiDeleteUserRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.deleteUser(requestParameters.userId, options).then((request) => request(axios, basePath)); | ||||
|             return localVarFp.deleteUser(requestParameters.id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12608,7 +12608,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getProfileImage(requestParameters: UserApiGetProfileImageRequest, options?: AxiosRequestConfig): AxiosPromise<object> { | ||||
|             return localVarFp.getProfileImage(requestParameters.userId, options).then((request) => request(axios, basePath)); | ||||
|             return localVarFp.getProfileImage(requestParameters.id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12617,7 +12617,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.getUserById(requestParameters.userId, options).then((request) => request(axios, basePath)); | ||||
|             return localVarFp.getUserById(requestParameters.id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12635,7 +12635,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         restoreUser(requestParameters: UserApiRestoreUserRequest, options?: AxiosRequestConfig): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.restoreUser(requestParameters.userId, options).then((request) => request(axios, basePath)); | ||||
|             return localVarFp.restoreUser(requestParameters.id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12688,7 +12688,7 @@ export interface UserApiDeleteUserRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiDeleteUser | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12716,7 +12716,7 @@ export interface UserApiGetProfileImageRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiGetProfileImage | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12730,7 +12730,7 @@ export interface UserApiGetUserByIdRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiGetUserById | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12758,7 +12758,7 @@ export interface UserApiRestoreUserRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiRestoreUser | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12812,7 +12812,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public deleteUser(requestParameters: UserApiDeleteUserRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).deleteUser(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).deleteUser(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -12844,7 +12844,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public getProfileImage(requestParameters: UserApiGetProfileImageRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).getProfileImage(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).getProfileImage(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -12855,7 +12855,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).getUserById(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).getUserById(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -12877,7 +12877,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public restoreUser(requestParameters: UserApiRestoreUserRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).restoreUser(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).restoreUser(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|   | ||||
							
								
								
									
										8
									
								
								mobile/openapi/README.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								mobile/openapi/README.md
									
									
									
										generated
									
									
									
								
							| @@ -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 |  | ||||
| 
 | ||||
| 
 | ||||
|   | ||||
							
								
								
									
										40
									
								
								mobile/openapi/doc/UserApi.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										40
									
								
								mobile/openapi/doc/UserApi.md
									
									
									
										generated
									
									
									
								
							| @@ -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 | ||||
| 
 | ||||
|   | ||||
							
								
								
									
										64
									
								
								mobile/openapi/lib/api/user_api.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										64
									
								
								mobile/openapi/lib/api/user_api.dart
									
									
									
										generated
									
									
									
								
							| @@ -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)); | ||||
|     } | ||||
|   | ||||
							
								
								
									
										8
									
								
								mobile/openapi/test/user_api_test.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								mobile/openapi/test/user_api_test.dart
									
									
									
										generated
									
									
									
								
							| @@ -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 | ||||
|     }); | ||||
|   | ||||
| @@ -4206,12 +4206,12 @@ | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "/user/info/{userId}": { | ||||
|     "/user/info/{id}": { | ||||
|       "get": { | ||||
|         "operationId": "getUserById", | ||||
|         "parameters": [ | ||||
|           { | ||||
|             "name": "userId", | ||||
|             "name": "id", | ||||
|             "required": true, | ||||
|             "in": "path", | ||||
|             "schema": { | ||||
| @@ -4323,12 +4323,12 @@ | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "/user/profile-image/{userId}": { | ||||
|     "/user/profile-image/{id}": { | ||||
|       "get": { | ||||
|         "operationId": "getProfileImage", | ||||
|         "parameters": [ | ||||
|           { | ||||
|             "name": "userId", | ||||
|             "name": "id", | ||||
|             "required": true, | ||||
|             "in": "path", | ||||
|             "schema": { | ||||
| @@ -4365,12 +4365,12 @@ | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "/user/{userId}": { | ||||
|     "/user/{id}": { | ||||
|       "delete": { | ||||
|         "operationId": "deleteUser", | ||||
|         "parameters": [ | ||||
|           { | ||||
|             "name": "userId", | ||||
|             "name": "id", | ||||
|             "required": true, | ||||
|             "in": "path", | ||||
|             "schema": { | ||||
| @@ -4407,12 +4407,12 @@ | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "/user/{userId}/restore": { | ||||
|     "/user/{id}/restore": { | ||||
|       "post": { | ||||
|         "operationId": "restoreUser", | ||||
|         "parameters": [ | ||||
|           { | ||||
|             "name": "userId", | ||||
|             "name": "id", | ||||
|             "required": true, | ||||
|             "in": "path", | ||||
|             "schema": { | ||||
|   | ||||
| @@ -13,7 +13,7 @@ export class ListUsersCommand extends CommandRunner { | ||||
|  | ||||
|   async run(): Promise<void> { | ||||
|     try { | ||||
|       const users = await this.userService.getAllUsers(CLI_USER, true); | ||||
|       const users = await this.userService.getAll(CLI_USER, true); | ||||
|       console.dir(users); | ||||
|     } catch (error) { | ||||
|       console.error(error); | ||||
|   | ||||
| @@ -1,9 +0,0 @@ | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { IsNotEmpty, IsUUID } from 'class-validator'; | ||||
|  | ||||
| export class UserIdDto { | ||||
|   @IsNotEmpty() | ||||
|   @IsUUID('4') | ||||
|   @ApiProperty({ format: 'uuid' }) | ||||
|   userId!: string; | ||||
| } | ||||
| @@ -136,11 +136,11 @@ describe(UserService.name, () => { | ||||
|     when(userMock.get).calledWith(immichUser.id, undefined).mockResolvedValue(immichUser); | ||||
|   }); | ||||
|  | ||||
|   describe('getAllUsers', () => { | ||||
|   describe('getAll', () => { | ||||
|     it('should get all users', async () => { | ||||
|       userMock.getList.mockResolvedValue([adminUser]); | ||||
|  | ||||
|       const response = await sut.getAllUsers(adminUserAuth, false); | ||||
|       const response = await sut.getAll(adminUserAuth, false); | ||||
|  | ||||
|       expect(userMock.getList).toHaveBeenCalledWith({ withDeleted: true }); | ||||
|       expect(response).toEqual([ | ||||
| @@ -163,11 +163,11 @@ describe(UserService.name, () => { | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('getUserById', () => { | ||||
|   describe('get', () => { | ||||
|     it('should get a user by id', async () => { | ||||
|       userMock.get.mockResolvedValue(adminUser); | ||||
|  | ||||
|       const response = await sut.getUserById(adminUser.id); | ||||
|       const response = await sut.get(adminUser.id); | ||||
|  | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUser.id, false); | ||||
|       expect(response).toEqual(adminUserResponse); | ||||
| @@ -176,17 +176,17 @@ describe(UserService.name, () => { | ||||
|     it('should throw an error if a user is not found', async () => { | ||||
|       userMock.get.mockResolvedValue(null); | ||||
|  | ||||
|       await expect(sut.getUserById(adminUser.id)).rejects.toBeInstanceOf(NotFoundException); | ||||
|       await expect(sut.get(adminUser.id)).rejects.toBeInstanceOf(NotFoundException); | ||||
|  | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUser.id, false); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('getUserInfo', () => { | ||||
|   describe('getMe', () => { | ||||
|     it("should get the auth user's info", async () => { | ||||
|       userMock.get.mockResolvedValue(adminUser); | ||||
|  | ||||
|       const response = await sut.getUserInfo(adminUser); | ||||
|       const response = await sut.getMe(adminUser); | ||||
|  | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUser.id, undefined); | ||||
|       expect(response).toEqual(adminUserResponse); | ||||
| @@ -195,17 +195,17 @@ describe(UserService.name, () => { | ||||
|     it('should throw an error if a user is not found', async () => { | ||||
|       userMock.get.mockResolvedValue(null); | ||||
|  | ||||
|       await expect(sut.getUserInfo(adminUser)).rejects.toBeInstanceOf(BadRequestException); | ||||
|       await expect(sut.getMe(adminUser)).rejects.toBeInstanceOf(BadRequestException); | ||||
|  | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUser.id, undefined); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('getUserCount', () => { | ||||
|   describe('getCount', () => { | ||||
|     it('should get the user count', async () => { | ||||
|       userMock.getList.mockResolvedValue([adminUser]); | ||||
|  | ||||
|       const response = await sut.getUserCount({}); | ||||
|       const response = await sut.getCount({}); | ||||
|  | ||||
|       expect(userMock.getList).toHaveBeenCalled(); | ||||
|       expect(response).toEqual({ userCount: 1 }); | ||||
| @@ -221,14 +221,14 @@ describe(UserService.name, () => { | ||||
|  | ||||
|       when(userMock.update).calledWith(update.id, update).mockResolvedValueOnce(updatedImmichUser); | ||||
|  | ||||
|       const updatedUser = await sut.updateUser(immichUserAuth, update); | ||||
|       const updatedUser = await sut.update(immichUserAuth, update); | ||||
|       expect(updatedUser.shouldChangePassword).toEqual(true); | ||||
|     }); | ||||
|  | ||||
|     it('should not set an empty string for storage label', async () => { | ||||
|       userMock.update.mockResolvedValue(updatedImmichUser); | ||||
|  | ||||
|       await sut.updateUser(adminUserAuth, { id: immichUser.id, storageLabel: '' }); | ||||
|       await sut.update(adminUserAuth, { id: immichUser.id, storageLabel: '' }); | ||||
|  | ||||
|       expect(userMock.update).toHaveBeenCalledWith(immichUser.id, { id: immichUser.id, storageLabel: null }); | ||||
|     }); | ||||
| @@ -236,7 +236,7 @@ describe(UserService.name, () => { | ||||
|     it('should omit a storage label set by non-admin users', async () => { | ||||
|       userMock.update.mockResolvedValue(updatedImmichUser); | ||||
|  | ||||
|       await sut.updateUser(immichUserAuth, { id: immichUser.id, storageLabel: 'admin' }); | ||||
|       await sut.update(immichUserAuth, { id: immichUser.id, storageLabel: 'admin' }); | ||||
|  | ||||
|       expect(userMock.update).toHaveBeenCalledWith(immichUser.id, { id: immichUser.id }); | ||||
|     }); | ||||
| @@ -249,7 +249,7 @@ describe(UserService.name, () => { | ||||
|           id: 'not_immich_auth_user_id', | ||||
|         }); | ||||
|  | ||||
|       const result = sut.updateUser(immichUserAuth, { | ||||
|       const result = sut.update(immichUserAuth, { | ||||
|         id: 'not_immich_auth_user_id', | ||||
|         password: 'I take over your account now', | ||||
|       }); | ||||
| @@ -262,7 +262,7 @@ describe(UserService.name, () => { | ||||
|       userMock.get.mockResolvedValue(immichUser); | ||||
|       userMock.update.mockResolvedValue(immichUser); | ||||
|  | ||||
|       await sut.updateUser(immichUser, dto); | ||||
|       await sut.update(immichUser, dto); | ||||
|  | ||||
|       expect(userMock.update).toHaveBeenCalledWith(immichUser.id, { | ||||
|         id: 'user-id', | ||||
| @@ -276,7 +276,7 @@ describe(UserService.name, () => { | ||||
|       userMock.get.mockResolvedValue(immichUser); | ||||
|       userMock.getByEmail.mockResolvedValue(adminUser); | ||||
|  | ||||
|       await expect(sut.updateUser(immichUser, dto)).rejects.toBeInstanceOf(BadRequestException); | ||||
|       await expect(sut.update(immichUser, dto)).rejects.toBeInstanceOf(BadRequestException); | ||||
|  | ||||
|       expect(userMock.update).not.toHaveBeenCalled(); | ||||
|     }); | ||||
| @@ -287,7 +287,7 @@ describe(UserService.name, () => { | ||||
|       userMock.get.mockResolvedValue(immichUser); | ||||
|       userMock.getByStorageLabel.mockResolvedValue(adminUser); | ||||
|  | ||||
|       await expect(sut.updateUser(adminUser, dto)).rejects.toBeInstanceOf(BadRequestException); | ||||
|       await expect(sut.update(adminUser, dto)).rejects.toBeInstanceOf(BadRequestException); | ||||
|  | ||||
|       expect(userMock.update).not.toHaveBeenCalled(); | ||||
|     }); | ||||
| @@ -300,7 +300,7 @@ describe(UserService.name, () => { | ||||
|  | ||||
|       when(userMock.update).calledWith(immichUser.id, update).mockResolvedValueOnce(updatedImmichUser); | ||||
|  | ||||
|       const result = await sut.updateUser(adminUserAuth, update); | ||||
|       const result = await sut.update(adminUserAuth, update); | ||||
|  | ||||
|       expect(result).toBeDefined(); | ||||
|       expect(result.id).toEqual(updatedImmichUser.id); | ||||
| @@ -310,7 +310,7 @@ describe(UserService.name, () => { | ||||
|     it('update user information should throw error if user not found', async () => { | ||||
|       when(userMock.get).calledWith(immichUser.id, undefined).mockResolvedValueOnce(null); | ||||
|  | ||||
|       const result = sut.updateUser(adminUser, { | ||||
|       const result = sut.update(adminUser, { | ||||
|         id: immichUser.id, | ||||
|         shouldChangePassword: true, | ||||
|       }); | ||||
| @@ -324,7 +324,7 @@ describe(UserService.name, () => { | ||||
|       when(userMock.get).calledWith(adminUser.id).mockResolvedValueOnce(null); | ||||
|       when(userMock.update).calledWith(adminUser.id, dto).mockResolvedValueOnce(adminUser); | ||||
|  | ||||
|       await sut.updateUser(adminUser, dto); | ||||
|       await sut.update(adminUser, dto); | ||||
|  | ||||
|       expect(userMock.update).toHaveBeenCalledWith(adminUser.id, dto); | ||||
|     }); | ||||
| @@ -334,31 +334,31 @@ describe(UserService.name, () => { | ||||
|  | ||||
|       when(userMock.get).calledWith(immichUser.id).mockResolvedValueOnce(immichUser); | ||||
|  | ||||
|       await expect(sut.updateUser(adminUser, dto)).rejects.toBeInstanceOf(BadRequestException); | ||||
|       await expect(sut.update(adminUser, dto)).rejects.toBeInstanceOf(BadRequestException); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('restoreUser', () => { | ||||
|   describe('restore', () => { | ||||
|     it('should require an admin', async () => { | ||||
|       when(userMock.get).calledWith(adminUser.id, true).mockResolvedValue(adminUser); | ||||
|       await expect(sut.restoreUser(immichUserAuth, adminUser.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|       await expect(sut.restore(immichUserAuth, adminUser.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUser.id, true); | ||||
|     }); | ||||
|  | ||||
|     it('should require the auth user be an admin', async () => { | ||||
|       await expect(sut.deleteUser(immichUserAuth, adminUserAuth.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|       await expect(sut.delete(immichUserAuth, adminUserAuth.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|  | ||||
|       expect(userMock.delete).not.toHaveBeenCalled(); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('deleteUser', () => { | ||||
|   describe('delete', () => { | ||||
|     it('cannot delete admin user', async () => { | ||||
|       await expect(sut.deleteUser(adminUserAuth, adminUserAuth.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|       await expect(sut.delete(adminUserAuth, adminUserAuth.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|     }); | ||||
|  | ||||
|     it('should require the auth user be an admin', async () => { | ||||
|       await expect(sut.deleteUser(immichUserAuth, adminUserAuth.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|       await expect(sut.delete(immichUserAuth, adminUserAuth.id)).rejects.toBeInstanceOf(ForbiddenException); | ||||
|  | ||||
|       expect(userMock.delete).not.toHaveBeenCalled(); | ||||
|     }); | ||||
| @@ -369,7 +369,7 @@ describe(UserService.name, () => { | ||||
|       when(userMock.getAdmin).calledWith().mockResolvedValueOnce(null); | ||||
|  | ||||
|       await expect( | ||||
|         sut.createUser({ | ||||
|         sut.create({ | ||||
|           email: 'john_smith@email.com', | ||||
|           firstName: 'John', | ||||
|           lastName: 'Smith', | ||||
| @@ -394,7 +394,7 @@ describe(UserService.name, () => { | ||||
|     it('should throw an error if the user does not exist', async () => { | ||||
|       userMock.get.mockResolvedValue(null); | ||||
|  | ||||
|       await expect(sut.getUserProfileImage(adminUserAuth.id)).rejects.toBeInstanceOf(NotFoundException); | ||||
|       await expect(sut.getProfileImage(adminUserAuth.id)).rejects.toBeInstanceOf(NotFoundException); | ||||
|  | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUserAuth.id, undefined); | ||||
|     }); | ||||
| @@ -402,7 +402,7 @@ describe(UserService.name, () => { | ||||
|     it('should throw an error if the user does not have a picture', async () => { | ||||
|       userMock.get.mockResolvedValue(adminUser); | ||||
|  | ||||
|       await expect(sut.getUserProfileImage(adminUserAuth.id)).rejects.toBeInstanceOf(NotFoundException); | ||||
|       await expect(sut.getProfileImage(adminUserAuth.id)).rejects.toBeInstanceOf(NotFoundException); | ||||
|  | ||||
|       expect(userMock.get).toHaveBeenCalledWith(adminUserAuth.id, undefined); | ||||
|     }); | ||||
|   | ||||
| @@ -39,12 +39,12 @@ export class UserService { | ||||
|     this.userCore = new UserCore(userRepository, cryptoRepository); | ||||
|   } | ||||
|  | ||||
|   async getAllUsers(authUser: AuthUserDto, isAll: boolean): Promise<UserResponseDto[]> { | ||||
|   async getAll(authUser: AuthUserDto, isAll: boolean): Promise<UserResponseDto[]> { | ||||
|     const users = await this.userCore.getList({ withDeleted: !isAll }); | ||||
|     return users.map(mapUser); | ||||
|   } | ||||
|  | ||||
|   async getUserById(userId: string, withDeleted = false): Promise<UserResponseDto> { | ||||
|   async get(userId: string, withDeleted = false): Promise<UserResponseDto> { | ||||
|     const user = await this.userCore.get(userId, withDeleted); | ||||
|     if (!user) { | ||||
|       throw new NotFoundException('User not found'); | ||||
| @@ -53,7 +53,7 @@ export class UserService { | ||||
|     return mapUser(user); | ||||
|   } | ||||
|  | ||||
|   async getUserInfo(authUser: AuthUserDto): Promise<UserResponseDto> { | ||||
|   async getMe(authUser: AuthUserDto): Promise<UserResponseDto> { | ||||
|     const user = await this.userCore.get(authUser.id); | ||||
|     if (!user) { | ||||
|       throw new BadRequestException('User not found'); | ||||
| @@ -61,7 +61,7 @@ export class UserService { | ||||
|     return mapUser(user); | ||||
|   } | ||||
|  | ||||
|   async getUserCount(dto: UserCountDto): Promise<UserCountResponseDto> { | ||||
|   async getCount(dto: UserCountDto): Promise<UserCountResponseDto> { | ||||
|     let users = await this.userCore.getList(); | ||||
|  | ||||
|     if (dto.admin) { | ||||
| @@ -71,12 +71,12 @@ export class UserService { | ||||
|     return mapUserCountResponse(users.length); | ||||
|   } | ||||
|  | ||||
|   async createUser(createUserDto: CreateUserDto): Promise<UserResponseDto> { | ||||
|   async create(createUserDto: CreateUserDto): Promise<UserResponseDto> { | ||||
|     const createdUser = await this.userCore.createUser(createUserDto); | ||||
|     return mapUser(createdUser); | ||||
|   } | ||||
|  | ||||
|   async updateUser(authUser: AuthUserDto, dto: UpdateUserDto): Promise<UserResponseDto> { | ||||
|   async update(authUser: AuthUserDto, dto: UpdateUserDto): Promise<UserResponseDto> { | ||||
|     const user = await this.userCore.get(dto.id); | ||||
|     if (!user) { | ||||
|       throw new NotFoundException('User not found'); | ||||
| @@ -86,7 +86,7 @@ export class UserService { | ||||
|     return mapUser(updatedUser); | ||||
|   } | ||||
|  | ||||
|   async deleteUser(authUser: AuthUserDto, userId: string): Promise<UserResponseDto> { | ||||
|   async delete(authUser: AuthUserDto, userId: string): Promise<UserResponseDto> { | ||||
|     const user = await this.userCore.get(userId); | ||||
|     if (!user) { | ||||
|       throw new BadRequestException('User not found'); | ||||
| @@ -95,7 +95,7 @@ export class UserService { | ||||
|     return mapUser(deletedUser); | ||||
|   } | ||||
|  | ||||
|   async restoreUser(authUser: AuthUserDto, userId: string): Promise<UserResponseDto> { | ||||
|   async restore(authUser: AuthUserDto, userId: string): Promise<UserResponseDto> { | ||||
|     const user = await this.userCore.get(userId, true); | ||||
|     if (!user) { | ||||
|       throw new BadRequestException('User not found'); | ||||
| @@ -112,7 +112,7 @@ export class UserService { | ||||
|     return mapCreateProfileImageResponse(updatedUser.id, updatedUser.profileImagePath); | ||||
|   } | ||||
|  | ||||
|   async getUserProfileImage(userId: string): Promise<ReadStream> { | ||||
|   async getProfileImage(userId: string): Promise<ReadStream> { | ||||
|     const user = await this.userCore.get(userId); | ||||
|     if (!user) { | ||||
|       throw new NotFoundException('User not found'); | ||||
|   | ||||
| @@ -48,11 +48,7 @@ function sortKeys<T>(obj: T): T { | ||||
| } | ||||
|  | ||||
| const patchOpenAPI = (document: OpenAPIObject) => { | ||||
|   for (const [key, value] of Object.entries(document.paths)) { | ||||
|     document.paths[key] = sortKeys(value); | ||||
|   } | ||||
|   document.paths = sortKeys(document.paths); | ||||
|  | ||||
|   if (document.components?.schemas) { | ||||
|     document.components.schemas = sortKeys(document.components.schemas); | ||||
|   } | ||||
|   | ||||
| @@ -2,14 +2,13 @@ import { | ||||
|   AuthUserDto, | ||||
|   CreateProfileImageDto, | ||||
|   CreateProfileImageResponseDto, | ||||
|   CreateUserDto, | ||||
|   UpdateUserDto, | ||||
|   UserCountDto, | ||||
|   CreateUserDto as CreateDto, | ||||
|   UpdateUserDto as UpdateDto, | ||||
|   UserCountDto as CountDto, | ||||
|   UserCountResponseDto, | ||||
|   UserResponseDto, | ||||
|   UserService, | ||||
| } from '@app/domain'; | ||||
| import { UserIdDto } from '@app/domain/user/dto/user-id.dto'; | ||||
| import { | ||||
|   Body, | ||||
|   Controller, | ||||
| @@ -30,6 +29,7 @@ import { Response as Res } from 'express'; | ||||
| import { AdminRoute, Authenticated, AuthUser, PublicRoute } from '../app.guard'; | ||||
| import { FileUploadInterceptor, Route } from '../app.interceptor'; | ||||
| import { UseValidation } from '../app.utils'; | ||||
| import { UUIDParamDto } from './dto/uuid-param.dto'; | ||||
|  | ||||
| @ApiTags('User') | ||||
| @Controller(Route.USER) | ||||
| @@ -40,53 +40,53 @@ export class UserController { | ||||
|  | ||||
|   @Get() | ||||
|   getAllUsers(@AuthUser() authUser: AuthUserDto, @Query('isAll') isAll: boolean): Promise<UserResponseDto[]> { | ||||
|     return this.service.getAllUsers(authUser, isAll); | ||||
|     return this.service.getAll(authUser, isAll); | ||||
|   } | ||||
|  | ||||
|   @Get('/info/:userId') | ||||
|   getUserById(@Param() { userId }: UserIdDto): Promise<UserResponseDto> { | ||||
|     return this.service.getUserById(userId); | ||||
|   @Get('info/:id') | ||||
|   getUserById(@Param() { id }: UUIDParamDto): Promise<UserResponseDto> { | ||||
|     return this.service.get(id); | ||||
|   } | ||||
|  | ||||
|   @Get('me') | ||||
|   getMyUserInfo(@AuthUser() authUser: AuthUserDto): Promise<UserResponseDto> { | ||||
|     return this.service.getUserInfo(authUser); | ||||
|     return this.service.getMe(authUser); | ||||
|   } | ||||
|  | ||||
|   @AdminRoute() | ||||
|   @Post() | ||||
|   createUser(@Body() createUserDto: CreateUserDto): Promise<UserResponseDto> { | ||||
|     return this.service.createUser(createUserDto); | ||||
|   createUser(@Body() createUserDto: CreateDto): Promise<UserResponseDto> { | ||||
|     return this.service.create(createUserDto); | ||||
|   } | ||||
|  | ||||
|   @PublicRoute() | ||||
|   @Get('/count') | ||||
|   getUserCount(@Query() dto: UserCountDto): Promise<UserCountResponseDto> { | ||||
|     return this.service.getUserCount(dto); | ||||
|   @Get('count') | ||||
|   getUserCount(@Query() dto: CountDto): Promise<UserCountResponseDto> { | ||||
|     return this.service.getCount(dto); | ||||
|   } | ||||
|  | ||||
|   @AdminRoute() | ||||
|   @Delete('/:userId') | ||||
|   deleteUser(@AuthUser() authUser: AuthUserDto, @Param() { userId }: UserIdDto): Promise<UserResponseDto> { | ||||
|     return this.service.deleteUser(authUser, userId); | ||||
|   @Delete(':id') | ||||
|   deleteUser(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<UserResponseDto> { | ||||
|     return this.service.delete(authUser, id); | ||||
|   } | ||||
|  | ||||
|   @AdminRoute() | ||||
|   @Post('/:userId/restore') | ||||
|   restoreUser(@AuthUser() authUser: AuthUserDto, @Param() { userId }: UserIdDto): Promise<UserResponseDto> { | ||||
|     return this.service.restoreUser(authUser, userId); | ||||
|   @Post(':id/restore') | ||||
|   restoreUser(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<UserResponseDto> { | ||||
|     return this.service.restore(authUser, id); | ||||
|   } | ||||
|  | ||||
|   // TODO: replace with @Put(':id') | ||||
|   @Put() | ||||
|   updateUser(@AuthUser() authUser: AuthUserDto, @Body() updateUserDto: UpdateUserDto): Promise<UserResponseDto> { | ||||
|     return this.service.updateUser(authUser, updateUserDto); | ||||
|   updateUser(@AuthUser() authUser: AuthUserDto, @Body() updateUserDto: UpdateDto): Promise<UserResponseDto> { | ||||
|     return this.service.update(authUser, updateUserDto); | ||||
|   } | ||||
|  | ||||
|   @UseInterceptors(FileUploadInterceptor) | ||||
|   @ApiConsumes('multipart/form-data') | ||||
|   @ApiBody({ description: 'A new avatar for the user', type: CreateProfileImageDto }) | ||||
|   @Post('/profile-image') | ||||
|   @Post('profile-image') | ||||
|   createProfileImage( | ||||
|     @AuthUser() authUser: AuthUserDto, | ||||
|     @UploadedFile() fileInfo: Express.Multer.File, | ||||
| @@ -94,10 +94,10 @@ export class UserController { | ||||
|     return this.service.createProfileImage(authUser, fileInfo); | ||||
|   } | ||||
|  | ||||
|   @Get('/profile-image/:userId') | ||||
|   @Get('profile-image/:id') | ||||
|   @Header('Cache-Control', 'private, no-cache, no-transform') | ||||
|   async getProfileImage(@Param() { userId }: UserIdDto, @Response({ passthrough: true }) res: Res): Promise<any> { | ||||
|     const readableStream = await this.service.getUserProfileImage(userId); | ||||
|   async getProfileImage(@Param() { id }: UUIDParamDto, @Response({ passthrough: true }) res: Res): Promise<any> { | ||||
|     const readableStream = await this.service.getProfileImage(id); | ||||
|     res.header('Content-Type', 'image/jpeg'); | ||||
|     return new StreamableFile(readableStream); | ||||
|   } | ||||
|   | ||||
							
								
								
									
										112
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										112
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							| @@ -12180,15 +12180,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         deleteUser: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('deleteUser', 'userId', userId) | ||||
|             const localVarPath = `/user/{userId}` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         deleteUser: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('deleteUser', 'id', id) | ||||
|             const localVarPath = `/user/{id}` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12305,15 +12305,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getProfileImage: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('getProfileImage', 'userId', userId) | ||||
|             const localVarPath = `/user/profile-image/{userId}` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         getProfileImage: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('getProfileImage', 'id', id) | ||||
|             const localVarPath = `/user/profile-image/{id}` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12347,15 +12347,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getUserById: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('getUserById', 'userId', userId) | ||||
|             const localVarPath = `/user/info/{userId}` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         getUserById: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('getUserById', 'id', id) | ||||
|             const localVarPath = `/user/info/{id}` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12423,15 +12423,15 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         restoreUser: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'userId' is not null or undefined
 | ||||
|             assertParamExists('restoreUser', 'userId', userId) | ||||
|             const localVarPath = `/user/{userId}/restore` | ||||
|                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); | ||||
|         restoreUser: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             // verify required parameter 'id' is not null or undefined
 | ||||
|             assertParamExists('restoreUser', 'id', id) | ||||
|             const localVarPath = `/user/{id}/restore` | ||||
|                 .replace(`{${"id"}}`, encodeURIComponent(String(id))); | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
| @@ -12539,12 +12539,12 @@ export const UserApiFp = function(configuration?: Configuration) { | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async deleteUser(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(userId, options); | ||||
|         async deleteUser(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
| @@ -12568,22 +12568,22 @@ export const UserApiFp = function(configuration?: Configuration) { | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async getProfileImage(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getProfileImage(userId, options); | ||||
|         async getProfileImage(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getProfileImage(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async getUserById(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(userId, options); | ||||
|         async getUserById(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getUserById(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
| @@ -12598,12 +12598,12 @@ export const UserApiFp = function(configuration?: Configuration) { | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async restoreUser(userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.restoreUser(userId, options); | ||||
|         async restoreUser(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.restoreUser(id, options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
| @@ -12646,12 +12646,12 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         deleteUser(userId: string, options?: any): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.deleteUser(userId, options).then((request) => request(axios, basePath)); | ||||
|         deleteUser(id: string, options?: any): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.deleteUser(id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12672,21 +12672,21 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getProfileImage(userId: string, options?: any): AxiosPromise<object> { | ||||
|             return localVarFp.getProfileImage(userId, options).then((request) => request(axios, basePath)); | ||||
|         getProfileImage(id: string, options?: any): AxiosPromise<object> { | ||||
|             return localVarFp.getProfileImage(id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getUserById(userId: string, options?: any): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.getUserById(userId, options).then((request) => request(axios, basePath)); | ||||
|         getUserById(id: string, options?: any): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.getUserById(id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12699,12 +12699,12 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {string} userId  | ||||
|          * @param {string} id  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         restoreUser(userId: string, options?: any): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.restoreUser(userId, options).then((request) => request(axios, basePath)); | ||||
|         restoreUser(id: string, options?: any): AxiosPromise<UserResponseDto> { | ||||
|             return localVarFp.restoreUser(id, options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
| @@ -12757,7 +12757,7 @@ export interface UserApiDeleteUserRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiDeleteUser | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12785,7 +12785,7 @@ export interface UserApiGetProfileImageRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiGetProfileImage | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12799,7 +12799,7 @@ export interface UserApiGetUserByIdRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiGetUserById | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12827,7 +12827,7 @@ export interface UserApiRestoreUserRequest { | ||||
|      * @type {string} | ||||
|      * @memberof UserApiRestoreUser | ||||
|      */ | ||||
|     readonly userId: string | ||||
|     readonly id: string | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| @@ -12881,7 +12881,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public deleteUser(requestParameters: UserApiDeleteUserRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).deleteUser(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).deleteUser(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -12913,7 +12913,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public getProfileImage(requestParameters: UserApiGetProfileImageRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).getProfileImage(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).getProfileImage(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -12924,7 +12924,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public getUserById(requestParameters: UserApiGetUserByIdRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).getUserById(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).getUserById(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -12946,7 +12946,7 @@ export class UserApi extends BaseAPI { | ||||
|      * @memberof UserApi | ||||
|      */ | ||||
|     public restoreUser(requestParameters: UserApiRestoreUserRequest, options?: AxiosRequestConfig) { | ||||
|         return UserApiFp(this.configuration).restoreUser(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); | ||||
|         return UserApiFp(this.configuration).restoreUser(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
|  | ||||
|   const deleteUser = async () => { | ||||
|     try { | ||||
|       const deletedUser = await api.userApi.deleteUser({ userId: user.id }); | ||||
|       const deletedUser = await api.userApi.deleteUser({ id: user.id }); | ||||
|       if (deletedUser.data.deletedAt != null) { | ||||
|         dispatch('user-delete-success'); | ||||
|       } else { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|   const dispatch = createEventDispatcher(); | ||||
|  | ||||
|   const restoreUser = async () => { | ||||
|     const restoredUser = await api.userApi.restoreUser({ userId: user.id }); | ||||
|     const restoredUser = await api.userApi.restoreUser({ id: user.id }); | ||||
|     if (restoredUser.data.deletedAt == null) dispatch('user-restore-success'); | ||||
|     else dispatch('user-restore-fail'); | ||||
|   }; | ||||
|   | ||||
| @@ -52,7 +52,7 @@ | ||||
|   }); | ||||
|  | ||||
|   const getAlbumOwnerInfo = async (): Promise<UserResponseDto> => { | ||||
|     const { data } = await api.userApi.getUserById({ userId: album.ownerId }); | ||||
|     const { data } = await api.userApi.getUserById({ id: album.ownerId }); | ||||
|  | ||||
|     return data; | ||||
|   }; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ export const load: PageServerLoad = async ({ params, parent, locals: { api } }) | ||||
|     throw redirect(302, AppRoute.AUTH_LOGIN); | ||||
|   } | ||||
|  | ||||
|   const { data: partner } = await api.userApi.getUserById({ userId: params['userId'] }); | ||||
|   const { data: partner } = await api.userApi.getUserById({ id: params['userId'] }); | ||||
|  | ||||
|   return { | ||||
|     user, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user