[backend] Add UserProfile.Role
This commit is contained in:
parent
1c587584bc
commit
14201c8489
2 changed files with 16 additions and 1 deletions
|
@ -47,6 +47,12 @@ public class UserProfileRenderer(DatabaseContext db)
|
||||||
Verified = p.IsVerified
|
Verified = p.IsVerified
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var role = user.IsAdmin
|
||||||
|
? Role.Admin
|
||||||
|
: user.IsModerator
|
||||||
|
? Role.Moderator
|
||||||
|
: Role.None;
|
||||||
|
|
||||||
return new UserProfileResponse
|
return new UserProfileResponse
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
|
@ -56,7 +62,8 @@ public class UserProfileRenderer(DatabaseContext db)
|
||||||
Location = user.UserProfile?.Location,
|
Location = user.UserProfile?.Location,
|
||||||
Followers = followers,
|
Followers = followers,
|
||||||
Following = following,
|
Following = following,
|
||||||
Relations = relations
|
Relations = relations,
|
||||||
|
Role = role
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ public class UserProfileResponse
|
||||||
public required int? Followers { get; set; }
|
public required int? Followers { get; set; }
|
||||||
public required int? Following { get; set; }
|
public required int? Following { get; set; }
|
||||||
public required Relations Relations { get; set; }
|
public required Relations Relations { get; set; }
|
||||||
|
public required Role Role { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
|
@ -25,6 +26,13 @@ public enum Relations
|
||||||
Muting = 64
|
Muting = 64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Role
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Moderator = 1,
|
||||||
|
Admin = 2
|
||||||
|
}
|
||||||
|
|
||||||
public class UserProfileField
|
public class UserProfileField
|
||||||
{
|
{
|
||||||
public required string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue