LANCommander/LANCommander.Server.ImportExport/Exporters/ServerHttpPathExporter.cs
Pat Hartl 6ec919d1be Separate import and export functionality
This refactor splits the import and export functionality out of the ImportContext and adds an ExportContext. This also introduced separate importer and exporter implementations.

Additionally, adding archive, save, scripts, and server files to the final export archive has been implemented at the exporter implementation for each instead of handling it in the context. This should be a good pattern if other files need to be added down the road.
2025-07-27 17:51:50 -05:00

27 lines
No EOL
917 B
C#

using AutoMapper;
using LANCommander.SDK.Enums;
using LANCommander.SDK.Models.Manifest;
using LANCommander.Server.ImportExport.Models;
using LANCommander.Server.Services;
namespace LANCommander.Server.ImportExport.Exporters;
public class ServerHttpPathExporter(ServerHttpPathService serverHttpPathService) : BaseExporter<ServerHttpPath, Data.Models.ServerHttpPath>
{
public override async Task<ExportItemInfo> GetExportInfoAsync(Data.Models.ServerHttpPath record)
{
return new ExportItemInfo
{
Id = record.Id,
Flag = ExportRecordFlags.ServerHttpPaths,
Name = record.Path,
};
}
public override bool CanExport(ServerHttpPath record) => ExportContext.DataRecord is Data.Models.Server;
public override async Task<ServerHttpPath> ExportAsync(Guid id)
{
return await serverHttpPathService.GetAsync<ServerHttpPath>(id);
}
}