Started refactoring to be compatible with the changed nuget packages and the mooncore changes
This commit is contained in:
25
MoonlightServers.ApiServer/Mappers/ServerMapper.cs
Normal file
25
MoonlightServers.ApiServer/Mappers/ServerMapper.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.Servers;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.Servers;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Mappers;
|
||||
|
||||
[Mapper(AllowNullPropertyAssignment = false)]
|
||||
public static partial class ServerMapper
|
||||
{
|
||||
[UserMapping(Default = true)]
|
||||
public static ServerResponse ToAdminServerResponse(Server server)
|
||||
{
|
||||
var response = ToAdminServerResponse_Internal(server);
|
||||
|
||||
response.AllocationIds = server.Allocations.Select(x => x.Id).ToArray();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private static partial ServerResponse ToAdminServerResponse_Internal(Server server);
|
||||
|
||||
public static partial Server ToServer(CreateServerRequest request);
|
||||
public static partial Server Merge(UpdateServerRequest request, Server server);
|
||||
}
|
||||
Reference in New Issue
Block a user