Migrate audit reports to the files table

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
Ludovic Vielle
2026-06-03 22:19:17 +02:00
parent b0a0f0efc9
commit 0e4d73bb0f
31 changed files with 517 additions and 947 deletions

View File

@@ -349,14 +349,9 @@ func (s *Service) loadDocumentsReportsAndFilesFromAccesses(
)
}
if access.ReportID != nil {
rep := &coredata.Report{}
if err := rep.LoadByID(ctx, conn, scope, *access.ReportID); err != nil {
return nil, nil, nil, fmt.Errorf("cannot load report: %w", err)
}
if access.ReportFileID != nil {
audit := &coredata.Audit{}
if err := audit.LoadByReportID(ctx, conn, scope, *access.ReportID); err != nil {
if err := audit.LoadByReportFileID(ctx, conn, scope, *access.ReportFileID); err != nil {
return nil, nil, nil, fmt.Errorf("cannot load audit: %w", err)
}
@@ -373,7 +368,7 @@ func (s *Service) loadDocumentsReportsAndFilesFromAccesses(
reports = append(
reports,
SlackMessageReport{
ID: access.ReportID.String(),
ID: access.ReportFileID.String(),
Title: label,
AuditID: audit.ID.String(),
Status: access.Status.String(),