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

27 lines
No EOL
1,010 B
C#

using LANCommander.SDK.Enums;
using LANCommander.SDK.Models.Manifest;
using LANCommander.Server.ImportExport.Models;
using LANCommander.Server.Services;
using LANCommander.Server.Services.Mappers;
namespace LANCommander.Server.ImportExport.Exporters;
public class ServerHttpPathExporter(ManifestMapper manifestMapper, ServerHttpPathService serverHttpPathService) : BaseExporter<ServerHttpPath, Data.Models.ServerHttpPath>
{
public override async Task<ExportItemInfo> GetExportInfoAsync(Data.Models.ServerHttpPath record)
{
return new ExportItemInfo
{
Id = record.Id,
Type = ImportExportRecordType.ServerHttpPath,
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(id, manifestMapper.ProjectToManifestServerHttpPath);
}
}