@@ -13,24 +13,29 @@ public sealed partial class UsersController
1313 /// <response code="200">The user's information was successfully retrieved.</response>
1414 [ HttpGet ( "self" ) ]
1515 [ ProducesResponseType < BaseResponse < SelfResponse > > ( StatusCodes . Status200OK , MediaTypeNames . Application . Json ) ]
16- public BaseResponse < SelfResponse > GetSelf ( ) => new ( )
16+ public BaseResponse < SelfResponse > GetSelf ( )
1717 {
18- Data = new SelfResponse
18+ return new BaseResponse < SelfResponse >
1919 {
20- Id = CurrentUser . Id ,
21- Name = CurrentUser . Name ,
22- Email = CurrentUser . Email ,
23- Image = CurrentUser . GetImageUrl ( ) ,
24- Roles = CurrentUser . Roles
25- }
26- } ;
20+ Data = new SelfResponse
21+ {
22+ Id = CurrentUser . Id ,
23+ Name = CurrentUser . Name ,
24+ Email = CurrentUser . Email ,
25+ Image = CurrentUser . GetImageUrl ( ) ,
26+ Roles = CurrentUser . Roles ,
27+ Rank = CurrentUser . Roles . Count > 0 ? CurrentUser . Roles . Max ( ) . ToString ( ) : "User"
28+ }
29+ } ;
30+ }
31+
2732 public sealed class SelfResponse
2833 {
2934 public required Guid Id { get ; set ; }
3035 public required string Name { get ; set ; }
3136 public required string Email { get ; set ; }
3237 public required Uri Image { get ; set ; }
3338 public required List < RoleType > Roles { get ; set ; }
34- public string Rank => Roles . Max ( ) . ToString ( ) ;
39+ public required string Rank { get ; set ; }
3540 }
3641}
0 commit comments