浏览代码

Update get user info controller to avoid conflict with /count

Alex Tran 3 年之前
父节点
当前提交
cbdb8fa51f

+ 1 - 1
mobile/openapi/README.md

@@ -100,7 +100,7 @@ Class | Method | HTTP request | Description
 *UserApi* | [**getAllUsers**](doc//UserApi.md#getallusers) | **GET** /user | 
 *UserApi* | [**getAllUsers**](doc//UserApi.md#getallusers) | **GET** /user | 
 *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/{userId} | 
 *UserApi* | [**getProfileImage**](doc//UserApi.md#getprofileimage) | **GET** /user/profile-image/{userId} | 
-*UserApi* | [**getUserById**](doc//UserApi.md#getuserbyid) | **GET** /user/{userId} | 
+*UserApi* | [**getUserById**](doc//UserApi.md#getuserbyid) | **GET** /user/info/{userId} | 
 *UserApi* | [**getUserCount**](doc//UserApi.md#getusercount) | **GET** /user/count | 
 *UserApi* | [**getUserCount**](doc//UserApi.md#getusercount) | **GET** /user/count | 
 *UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user | 
 *UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user | 
 
 

+ 1 - 1
mobile/openapi/doc/UserApi.md

@@ -14,7 +14,7 @@ Method | HTTP request | Description
 [**getAllUsers**](UserApi.md#getallusers) | **GET** /user | 
 [**getAllUsers**](UserApi.md#getallusers) | **GET** /user | 
 [**getMyUserInfo**](UserApi.md#getmyuserinfo) | **GET** /user/me | 
 [**getMyUserInfo**](UserApi.md#getmyuserinfo) | **GET** /user/me | 
 [**getProfileImage**](UserApi.md#getprofileimage) | **GET** /user/profile-image/{userId} | 
 [**getProfileImage**](UserApi.md#getprofileimage) | **GET** /user/profile-image/{userId} | 
-[**getUserById**](UserApi.md#getuserbyid) | **GET** /user/{userId} | 
+[**getUserById**](UserApi.md#getuserbyid) | **GET** /user/info/{userId} | 
 [**getUserCount**](UserApi.md#getusercount) | **GET** /user/count | 
 [**getUserCount**](UserApi.md#getusercount) | **GET** /user/count | 
 [**updateUser**](UserApi.md#updateuser) | **PUT** /user | 
 [**updateUser**](UserApi.md#updateuser) | **PUT** /user | 
 
 

+ 2 - 2
mobile/openapi/lib/api/user_api.dart

@@ -261,13 +261,13 @@ class UserApi {
     return null;
     return null;
   }
   }
 
 
-  /// Performs an HTTP 'GET /user/{userId}' operation and returns the [Response].
+  /// Performs an HTTP 'GET /user/info/{userId}' operation and returns the [Response].
   /// Parameters:
   /// Parameters:
   ///
   ///
   /// * [String] userId (required):
   /// * [String] userId (required):
   Future<Response> getUserByIdWithHttpInfo(String userId,) async {
   Future<Response> getUserByIdWithHttpInfo(String userId,) async {
     // ignore: prefer_const_declarations
     // ignore: prefer_const_declarations
-    final path = r'/user/{userId}'
+    final path = r'/user/info/{userId}'
       .replaceAll('{userId}', userId);
       .replaceAll('{userId}', userId);
 
 
     // ignore: prefer_final_locals
     // ignore: prefer_final_locals

+ 1 - 1
server/apps/immich/src/api-v1/user/user.controller.ts

@@ -45,7 +45,7 @@ export class UserController {
     return await this.userService.getAllUsers(authUser, isAll);
     return await this.userService.getAllUsers(authUser, isAll);
   }
   }
 
 
-  @Get('/:userId')
+  @Get('/info/:userId')
   async getUserById(@Param('userId') userId: string): Promise<UserResponseDto> {
   async getUserById(@Param('userId') userId: string): Promise<UserResponseDto> {
     return await this.userService.getUserById(userId);
     return await this.userService.getUserById(userId);
   }
   }

+ 2 - 0
server/apps/immich/src/api-v1/user/user.service.ts

@@ -39,6 +39,7 @@ export class UserService {
   }
   }
 
 
   async getUserById(userId: string): Promise<UserResponseDto> {
   async getUserById(userId: string): Promise<UserResponseDto> {
+    console.log(userId);
     const user = await this.userRepository.get(userId);
     const user = await this.userRepository.get(userId);
     if (!user) {
     if (!user) {
       throw new NotFoundException('User not found');
       throw new NotFoundException('User not found');
@@ -46,6 +47,7 @@ export class UserService {
 
 
     return mapUser(user);
     return mapUser(user);
   }
   }
+
   async getUserInfo(authUser: AuthUserDto): Promise<UserResponseDto> {
   async getUserInfo(authUser: AuthUserDto): Promise<UserResponseDto> {
     const user = await this.userRepository.get(authUser.id);
     const user = await this.userRepository.get(authUser.id);
     if (!user) {
     if (!user) {

文件差异内容过多而无法显示
+ 0 - 0
server/immich-openapi-specs.json


+ 1 - 1
web/src/api/open-api/api.ts

@@ -3623,7 +3623,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
         getUserById: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
         getUserById: async (userId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
             // verify required parameter 'userId' is not null or undefined
             // verify required parameter 'userId' is not null or undefined
             assertParamExists('getUserById', 'userId', userId)
             assertParamExists('getUserById', 'userId', userId)
-            const localVarPath = `/user/{userId}`
+            const localVarPath = `/user/info/{userId}`
                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId)));
                 .replace(`{${"userId"}}`, encodeURIComponent(String(userId)));
             // use dummy base URL string because the URL constructor only accepts absolute URLs.
             // use dummy base URL string because the URL constructor only accepts absolute URLs.
             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);

部分文件因为文件数量过多而无法显示