mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.Json.Serialization;
|
|
using RadicadeServer.RecNet.Accounts;
|
|
using RadicadeServer.RecNet.Auth.Enums;
|
|
|
|
namespace RadicadeServer.RecNet.Auth
|
|
{
|
|
public class Profile
|
|
{
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public long accountId { get; set; }
|
|
|
|
public string profileImage { get; set; } = null!;
|
|
|
|
public string? bannerImage { get; set; }
|
|
|
|
public bool isRecentHistoryVisible { get; set; } = true;
|
|
|
|
public bool isJunior { get; set; }
|
|
|
|
public int platforms { get; set; }
|
|
|
|
public string username { get; set; } = null!;
|
|
public string displayName { get; set; } = null!;
|
|
|
|
public string? bio { get; set; }
|
|
public int personalPronouns { get; set; }
|
|
public int identityFlags { get; set; }
|
|
|
|
public string? displayEmoji { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool NameLocked { get; set; }
|
|
public bool BioLocked { get; set; }
|
|
|
|
public DateTime createdAt { get; set; }
|
|
|
|
public string? role { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool developer => HasRole("developer");
|
|
public bool moderator => HasRole("moderator");
|
|
public bool screenshare => HasRole("screenshare");
|
|
public bool influencer => HasRole("influencer");
|
|
|
|
public bool HasRole(string expectedRoleName)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(role)) return false;
|
|
|
|
|
|
var normalized = expectedRoleName switch
|
|
{
|
|
"screenshare" => "sharescreen",
|
|
"influencer" => "imfluencer",
|
|
_ => expectedRoleName
|
|
};
|
|
return role.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
|
|
.Any(r => r.Equals(expectedRoleName, StringComparison.OrdinalIgnoreCase) || r.Equals(normalized, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
}
|
|
}
|