refactor: make exporting consistent

This commit is contained in:
Gary Sharp
2025-02-06 19:14:36 +11:00
parent f946f3250c
commit 67f1c2a5d1
69 changed files with 908 additions and 921 deletions
@@ -0,0 +1,39 @@
using Disco.Data.Repository;
using Disco.Models.Exporting;
using Disco.Models.Services.Exporting;
using Disco.Services.Tasks;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Disco.Services.Exporting
{
public interface IExportContext
{
Guid Id { get; set; }
string Name { get; set; }
string Description { get; set; }
ExportResult Export(DiscoDataContext database, IScheduledTaskStatus status);
}
public interface IExportContext<T, R>
: IExportContext
where T : IExportOptions, new()
where R : IExportRecord
{
bool TimestampSuffix { get; set; }
[JsonIgnore]
string SuggestedFilenamePrefix { get; }
[JsonIgnore]
string ExcelWorksheetName { get; }
[JsonIgnore]
string ExcelTableName { get; }
T Options { get; set; }
List<R> BuildRecords(DiscoDataContext database, IScheduledTaskStatus status);
List<ExportFieldMetadata<R>> BuildMetadata(DiscoDataContext database, List<R> records, IScheduledTaskStatus status);
}
}