Implemented basic ui for server sharing. Extracted server authorization. Refactoring and small improvements

This commit is contained in:
2025-06-11 21:59:49 +02:00
parent cfed1aefde
commit b53140e633
35 changed files with 1098 additions and 213 deletions

View File

@@ -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; } = [];
}

View File

@@ -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; } = [];
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}

View 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; }
}

View File

@@ -13,9 +13,5 @@
<PackageTags>shared</PackageTags>
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Http\Responses\Users\Servers\" />
</ItemGroup>
</Project>