feat: support co-gm group delegation
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
namespace GmRelay.Shared.Domain;
|
||||
|
||||
public enum GroupManagerRole
|
||||
{
|
||||
Owner,
|
||||
CoGm
|
||||
}
|
||||
|
||||
public static class GroupManagerRoleExtensions
|
||||
{
|
||||
public const string OwnerValue = "Owner";
|
||||
public const string CoGmValue = "CoGm";
|
||||
|
||||
public static string ToDatabaseValue(this GroupManagerRole role) => role switch
|
||||
{
|
||||
GroupManagerRole.Owner => OwnerValue,
|
||||
GroupManagerRole.CoGm => CoGmValue,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(role), role, "Unknown group manager role.")
|
||||
};
|
||||
|
||||
public static GroupManagerRole FromDatabaseValue(string value) => value switch
|
||||
{
|
||||
OwnerValue => GroupManagerRole.Owner,
|
||||
CoGmValue => GroupManagerRole.CoGm,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown group manager role.")
|
||||
};
|
||||
|
||||
public static string ToDisplayName(this GroupManagerRole role) => role switch
|
||||
{
|
||||
GroupManagerRole.Owner => "Owner",
|
||||
GroupManagerRole.CoGm => "Co-GM",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(role), role, "Unknown group manager role.")
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user