mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 14:20:06 +01:00
feat: return user's role name inside UserInfoDTO
This commit is contained in:
@@ -70,7 +70,7 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
// All set - generate the token and return it
|
||||
var token = guhf.GenerateJwtToken(user);
|
||||
SuccessfulLoginDTO response = user.ToSuccessfulLoginDTO(token);
|
||||
SuccessfulLoginDTO response = user.ToSuccessfulLoginDTO(token, guhf.UserRoleAsStr(user));
|
||||
|
||||
return Ok(response);
|
||||
} else return Unauthorized(new {status = "error", error_msg = "Unknown pair of email and password"});
|
||||
@@ -149,7 +149,7 @@ public class AuthController : ControllerBase
|
||||
return BadRequest(new ErrorDTO { Status = "error", Error_msg = "User not found" });
|
||||
|
||||
// Return user data as a DTO
|
||||
return Ok(u.ToUserInfoDTO());
|
||||
return Ok(u.ToUserInfoDTO(guhf.UserRoleAsStr(u)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -71,9 +71,9 @@ public class CategoryController : ControllerBase
|
||||
/// [AUTHED] Create a new category
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Allows authorized users to create categories. <br/>
|
||||
/// <b>Important!</b>
|
||||
/// Allows authorized users to create categories.
|
||||
/// <br/><br/>
|
||||
/// <b>Important!</b>
|
||||
/// Category names are case insensitive. <br/>
|
||||
/// Has CORS set.
|
||||
/// </remarks>
|
||||
@@ -110,4 +110,10 @@ public class CategoryController : ControllerBase
|
||||
|
||||
}
|
||||
|
||||
// TODO: Update category
|
||||
// PATCH /api/v1/categories/1
|
||||
|
||||
// TODO: Delete category
|
||||
// DELETE /api/v1/categories/1
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user