Improved server share permission handling and share ui

This commit is contained in:
2025-07-24 20:19:49 +02:00
parent 1f94752c54
commit 431cdcb260
19 changed files with 270 additions and 151 deletions

View File

@@ -0,0 +1,27 @@
using MoonlightServers.ApiServer.Models;
using MoonlightServers.Shared.Enums;
using Riok.Mapperly.Abstractions;
namespace MoonlightServers.ApiServer.Mappers;
[Mapper]
public static partial class ShareMapper
{
public static ServerShareContent MapToServerShareContent(Dictionary<string, ServerPermissionLevel> permissionLevels)
{
return new ServerShareContent()
{
Permissions = permissionLevels.Select(x => new ServerShareContent.SharePermission()
{
Identifier = x.Key,
Level = x.Value
}).ToList()
};
}
public static Dictionary<string, ServerPermissionLevel> MapToPermissionLevels(
ServerShareContent content)
{
return content.Permissions.ToDictionary(x => x.Identifier, x => x.Level);
}
}