Implemented basic ui for server sharing. Extracted server authorization. Refactoring and small improvements
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||
|
||||
public record CreateShareRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a username")]
|
||||
public string Username { get; set; }
|
||||
|
||||
public List<ServerSharePermission> Permissions { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||
|
||||
public record UpdateShareRequest
|
||||
{
|
||||
public List<ServerSharePermission> Permissions { get; set; } = [];
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers.Allocations;
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
public class ServerDetailResponse
|
||||
public record ServerDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
@@ -16,4 +17,12 @@ public class ServerDetailResponse
|
||||
public string StarName { get; set; }
|
||||
|
||||
public AllocationDetailResponse[] Allocations { get; set; }
|
||||
|
||||
public ShareData? Share { get; set; } = null;
|
||||
|
||||
public record ShareData
|
||||
{
|
||||
public string SharedBy { get; set; }
|
||||
public ServerSharePermission[] Permissions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
using MoonlightServers.Shared.Models;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Shares;
|
||||
|
||||
public class ServerShareResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
public string Permissions { get; set; }
|
||||
public string Username { get; set; }
|
||||
public ServerSharePermission[] Permissions { get; set; }
|
||||
}
|
||||
9
MoonlightServers.Shared/Models/ServerSharePermission.cs
Normal file
9
MoonlightServers.Shared/Models/ServerSharePermission.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Models;
|
||||
|
||||
public record ServerSharePermission
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ServerPermissionType Type { get; set; }
|
||||
}
|
||||
@@ -13,9 +13,5 @@
|
||||
<PackageTags>shared</PackageTags>
|
||||
<IsPackable>true</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Http\Responses\Users\Servers\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user