Fix missing organization ID on reports

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-04 19:03:18 +04:00
parent 54ca8cc0f3
commit 5b3fca4de8
2 changed files with 16 additions and 7 deletions

View File

@@ -0,0 +1,8 @@
UPDATE
reports
SET
organization_id = a.organization_id
FROM
audits a
WHERE
reports.tenant_id = a.tenant_id;

View File

@@ -346,13 +346,14 @@ func (s AuditService) UploadReport(
}
report := &coredata.Report{
ID: reportID,
ObjectKey: objectKey.String(),
MimeType: req.File.ContentType,
Filename: req.File.Filename,
Size: req.File.Size,
CreatedAt: now,
UpdatedAt: now,
ID: reportID,
OrganizationID: audit.OrganizationID,
ObjectKey: objectKey.String(),
MimeType: req.File.ContentType,
Filename: req.File.Filename,
Size: req.File.Size,
CreatedAt: now,
UpdatedAt: now,
}
if err := report.Insert(ctx, conn, s.svc.scope); err != nil {