Started improving server shares and general api controller structure
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.Shared.Constants;
|
||||
|
||||
public class ServerPermissionConstants
|
||||
{
|
||||
public const string Console = "console";
|
||||
public const string Power = "power";
|
||||
public const string Shares = "shares";
|
||||
public const string Files = "files";
|
||||
public const string Variables = "variables";
|
||||
public const string Settings = "settings";
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
namespace MoonlightServers.Shared.Enums;
|
||||
|
||||
public enum ServerPermissionType
|
||||
public enum ServerPermissionLevel
|
||||
{
|
||||
None = -1,
|
||||
Read = 0,
|
||||
ReadWrite = 1
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||
@@ -8,5 +9,5 @@ public record CreateShareRequest
|
||||
[Required(ErrorMessage = "You need to provide a username")]
|
||||
public string Username { get; set; }
|
||||
|
||||
public List<ServerSharePermission> Permissions { get; set; } = [];
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; } = [];
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using MoonlightServers.Shared.Models;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||
|
||||
public record UpdateShareRequest
|
||||
{
|
||||
public List<ServerSharePermission> Permissions { get; set; } = [];
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; } = [];
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers.Allocations;
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
@@ -23,6 +24,6 @@ public record ServerDetailResponse
|
||||
public record ShareData
|
||||
{
|
||||
public string SharedBy { get; set; }
|
||||
public ServerSharePermission[] Permissions { get; set; }
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Shares;
|
||||
@@ -6,5 +7,5 @@ public class ServerShareResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public ServerSharePermission[] Permissions { get; set; }
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Models;
|
||||
|
||||
public record ServerSharePermission
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ServerPermissionType Type { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user