Generate presigned URL for email assets at render time

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-05 12:41:35 +04:00
parent a388aa4999
commit 6189a8ed81
18 changed files with 328 additions and 246 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"go.gearno.de/kit/pg"
"go.probo.inc/probo/pkg/filemanager"
"go.probo.inc/probo/pkg/gid"
)
@@ -44,6 +45,24 @@ type (
Files []*File
)
func (f *File) GetName() string {
return f.FileName
}
func (f *File) GetObjectKey() string {
return f.FileKey
}
func (f *File) GetBucketName() string {
return f.BucketName
}
func (f *File) GetMimeType() string {
return f.MimeType
}
var _ filemanager.File = (*File)(nil)
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
func (f *File) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
q := `SELECT organization_id FROM files WHERE id = $1 LIMIT 1;`