Add file visibility (PRIVATE/PUBLIC) + public files API

Adds a visibility enum to files with PRIVATE (default) and PUBLIC states.
PUBLIC files are accessible via an unauthenticated /api/files/v1/{fileID}
endpoint that redirects to a presigned S3 URL. Introduces pkg/file service
to manage file operations. Logo uploads (trust centers, organizations,
frameworks, references) are marked PUBLIC; other files are PRIVATE.
Includes database migration and backfill for existing logos.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-18 17:28:10 +01:00
parent 9237ad8ce2
commit a5743729f7
20 changed files with 339 additions and 10 deletions

View File

@@ -534,6 +534,7 @@ func (s FrameworkService) Import(
MimeType: contentType,
FileName: filename,
FileKey: objectKey.String(),
Visibility: coredata.FileVisibilityPublic,
CreatedAt: now,
UpdatedAt: now,
}
@@ -761,6 +762,7 @@ func (s *FrameworkService) BuildAndUploadExport(ctx context.Context, exportJobID
FileName: fmt.Sprintf("Framework Export %s.zip", now.Format("2006-01-02")),
FileKey: uuid.String(),
FileSize: fileInfo.Size(),
Visibility: coredata.FileVisibilityPrivate,
CreatedAt: now,
UpdatedAt: now,
}