Fix redist/tool/server exports
Fixes various issues that may prevent redistributables, tools, or servers from being exported properly.
This commit is contained in:
parent
3b3da2980c
commit
b8e9a8c8cd
4 changed files with 38 additions and 2 deletions
|
|
@ -500,6 +500,8 @@ public class ExportContext(
|
|||
manifest.Archives.Add(await ExportRecordAsync(queueItem, Archives));
|
||||
else if (queueItem.Type == ImportExportRecordType.Script)
|
||||
manifest.Scripts.Add(await ExportRecordAsync(queueItem, Scripts));
|
||||
else if (queueItem.Type == ImportExportRecordType.Action)
|
||||
manifest.Actions.Add(await ExportRecordAsync(queueItem, Actions));
|
||||
}
|
||||
|
||||
return manifest;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@ public class RedistributableExporter(RedistributableService redistributableServi
|
|||
|
||||
public override async Task<Redistributable> ExportAsync(Guid id)
|
||||
{
|
||||
return await redistributableService.GetAsync<Redistributable>(id);
|
||||
var redistributable = await redistributableService.GetAsync<Redistributable>(id);
|
||||
|
||||
if (redistributable.Archives is null)
|
||||
redistributable.Archives = new List<Archive>();
|
||||
|
||||
if (redistributable.Scripts is null)
|
||||
redistributable.Scripts = new List<Script>();
|
||||
|
||||
return redistributable;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
using AutoMapper;
|
||||
using LANCommander.SDK.Models.Manifest;
|
||||
using LANCommander.Server.ImportExport.Models;
|
||||
using LANCommander.Server.Services;
|
||||
using Action = LANCommander.SDK.Models.Manifest.Action;
|
||||
|
||||
namespace LANCommander.Server.ImportExport.Exporters;
|
||||
|
||||
|
|
@ -59,6 +61,18 @@ public class ServerExporter(ServerService serverService) : BaseExporter<SDK.Mode
|
|||
// File could not be added to archive
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.Scripts is null)
|
||||
entity.Scripts = new List<Script>();
|
||||
|
||||
if (entity.Actions is null)
|
||||
entity.Actions = new List<Action>();
|
||||
|
||||
if (entity.HttpPaths is null)
|
||||
entity.HttpPaths = new List<ServerHttpPath>();
|
||||
|
||||
if (entity.ServerConsoles is null)
|
||||
entity.ServerConsoles = new List<ServerConsole>();
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using AutoMapper;
|
|||
using LANCommander.SDK.Models.Manifest;
|
||||
using LANCommander.Server.ImportExport.Models;
|
||||
using LANCommander.Server.Services;
|
||||
using Action = LANCommander.SDK.Models.Manifest.Action;
|
||||
|
||||
namespace LANCommander.Server.ImportExport.Exporters;
|
||||
|
||||
|
|
@ -20,6 +21,17 @@ public class ToolExporter(ToolService toolService) : BaseExporter<Tool, Data.Mod
|
|||
|
||||
public override async Task<Tool> ExportAsync(Guid id)
|
||||
{
|
||||
return await toolService.GetAsync<Tool>(id);
|
||||
var tool = await toolService.GetAsync<Tool>(id);
|
||||
|
||||
if (tool.Archives is null)
|
||||
tool.Archives = new List<Archive>();
|
||||
|
||||
if (tool.Scripts is null)
|
||||
tool.Scripts = new List<Script>();
|
||||
|
||||
if (tool.Actions is null)
|
||||
tool.Actions = new List<Action>();
|
||||
|
||||
return tool;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue