LANCommander/LANCommander.Server.ImportExport/Exporters/RedistributableExporter.cs
2026-07-02 18:09:14 -05:00

32 lines
No EOL
1 KiB
C#

using LANCommander.SDK.Models.Manifest;
using LANCommander.Server.ImportExport.Models;
using LANCommander.Server.Services;
namespace LANCommander.Server.ImportExport.Exporters;
public class RedistributableExporter(RedistributableService redistributableService) : BaseExporter<Redistributable, Data.Models.Redistributable>
{
public override async Task<ExportItemInfo> GetExportInfoAsync(Data.Models.Redistributable record)
{
return new ExportItemInfo()
{
Id = record.Id,
Name = record.Name,
};
}
public override bool CanExport(Redistributable record) => true;
public override async Task<Redistributable> ExportAsync(Guid id)
{
var redistributable = await redistributableService.GetManifestAsync(id);
if (redistributable.Archives is null)
redistributable.Archives = new List<Archive>();
if (redistributable.Scripts is null)
redistributable.Scripts = new List<Script>();
return redistributable;
}
}