From 53888df71f7580bf169dfab3d13d313cf96d26df Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 21 Aug 2020 21:25:33 +0800 Subject: ... --- Timeline/Controllers/UserController.cs | 39 +++++++++++++--------------------- 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'Timeline/Controllers/UserController.cs') diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs index fa2d37d8..02c09aab 100644 --- a/Timeline/Controllers/UserController.cs +++ b/Timeline/Controllers/UserController.cs @@ -43,9 +43,9 @@ namespace Timeline.Controllers /// /// Get all users. /// - /// The user list. + /// All user list. [HttpGet("users")] - [ProducesResponseType(typeof(UserInfo[]), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task> List() { var users = await _userService.GetUsers(); @@ -54,12 +54,13 @@ namespace Timeline.Controllers } /// - /// Get a user info. + /// Get a user's info. /// /// Username of the user. - /// The user info. + /// User info. [HttpGet("users/{username}")] - [ProducesResponseType(typeof(UserInfo), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task> Get([FromRoute][Username] string username) { try @@ -75,16 +76,14 @@ namespace Timeline.Controllers } /// - /// Change a user's property. You have to be administrator in some condition. + /// Change a user's property. /// /// /// Username of the user to change. - /// Succeed to change the user and return the new user info. - /// You have not logged in. - /// You are not administrator. - /// The user to change does not exist. + /// The new user info. [HttpPatch("users/{username}"), Authorize] - [ProducesResponseType(typeof(UserInfo), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status403Forbidden)] [ProducesResponseType(StatusCodes.Status404NotFound)] @@ -134,11 +133,9 @@ namespace Timeline.Controllers /// Delete a user and all his related data. You have to be administrator. /// /// Username of the user to delete. - /// Succeeded to delete or the user does not exist. - /// You have not logged in. - /// You are not administrator. + /// Info of deletion. [HttpDelete("users/{username}"), AdminAuthorize] - [ProducesResponseType(typeof(CommonDeleteResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task> Delete([FromRoute][Username] string username) @@ -153,12 +150,9 @@ namespace Timeline.Controllers /// /// Create a new user. You have to be administrator. /// - /// Succeeded to create a new user and return his user info. - /// Error code is 11020101 if a user with given username already exists. - /// You have not logged in. - /// You are not administrator. + /// The new user's info. [HttpPost("userop/createuser"), AdminAuthorize] - [ProducesResponseType(typeof(UserInfo), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status403Forbidden)] @@ -178,11 +172,8 @@ namespace Timeline.Controllers /// /// Change password with old password. /// - /// Succeeded to change password. - /// Error code is 11020201 if old password is wrong. - /// You have not logged in. [HttpPost("userop/changepassword"), Authorize] - [ProducesResponseType(typeof(void), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] public async Task ChangePassword([FromBody] ChangePasswordRequest request) -- cgit v1.2.3