Started refactoring to be compatible with the changed nuget packages and the mooncore changes
This commit is contained in:
14
MoonlightServers.ApiServer/Mappers/AllocationMapper.cs
Normal file
14
MoonlightServers.ApiServer/Mappers/AllocationMapper.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Mappers;
|
||||
|
||||
[Mapper(AllowNullPropertyAssignment = false)]
|
||||
public static partial class AllocationMapper
|
||||
{
|
||||
public static partial NodeAllocationResponse ToNodeAllocation(Allocation allocation);
|
||||
public static partial Allocation ToAllocation(CreateNodeAllocationRequest request);
|
||||
public static partial Allocation Merge(UpdateNodeAllocationRequest request, Allocation allocation);
|
||||
}
|
||||
15
MoonlightServers.ApiServer/Mappers/DockerImageMapper.cs
Normal file
15
MoonlightServers.ApiServer/Mappers/DockerImageMapper.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Mappers;
|
||||
|
||||
[Mapper(AllowNullPropertyAssignment = false)]
|
||||
public static partial class DockerImageMapper
|
||||
{
|
||||
public static partial StarDockerImageDetailResponse ToAdminResponse(StarDockerImage dockerImage);
|
||||
public static partial StarDockerImage ToDockerImage(CreateStarDockerImageRequest request);
|
||||
public static partial StarDockerImage Merge(UpdateStarVariableRequest request, StarDockerImage variable);
|
||||
}
|
||||
14
MoonlightServers.ApiServer/Mappers/NodeMapper.cs
Normal file
14
MoonlightServers.ApiServer/Mappers/NodeMapper.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.Nodes;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.Nodes;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Mappers;
|
||||
|
||||
[Mapper(AllowNullPropertyAssignment = false)]
|
||||
public static partial class NodeMapper
|
||||
{
|
||||
public static partial NodeResponse ToAdminNodeResponse(Node node);
|
||||
public static partial Node ToNode(CreateNodeRequest request);
|
||||
public static partial Node Merge(UpdateNodeRequest request, Node node);
|
||||
}
|
||||
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);
|
||||
}
|
||||
11
MoonlightServers.ApiServer/Mappers/ServerVariableMapper.cs
Normal file
11
MoonlightServers.ApiServer/Mappers/ServerVariableMapper.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Mappers;
|
||||
|
||||
[Mapper(AllowNullPropertyAssignment = false)]
|
||||
public static partial class ServerVariableMapper
|
||||
{
|
||||
public static partial ServerVariableResponse ToAdminResponse(ServerVariable serverVariable);
|
||||
}
|
||||
14
MoonlightServers.ApiServer/Mappers/StarVariableMapper.cs
Normal file
14
MoonlightServers.ApiServer/Mappers/StarVariableMapper.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.StarVariables;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Mappers;
|
||||
|
||||
[Mapper(AllowNullPropertyAssignment = false)]
|
||||
public static partial class StarVariableMapper
|
||||
{
|
||||
public static partial StarVariableDetailResponse ToAdminResponse(StarVariable variable);
|
||||
public static partial StarVariable ToStarVariable(CreateStarVariableRequest request);
|
||||
public static partial StarVariable Merge(UpdateStarVariableRequest request, StarVariable variable);
|
||||
}
|
||||
Reference in New Issue
Block a user