Add organization to file upload

So everyone in the org can see it.
This commit is contained in:
Eli Ribble 2026-02-08 05:00:14 +00:00
parent e3535391dd
commit f9c8f37cec
No known key found for this signature in database
10 changed files with 812 additions and 127 deletions

View file

@ -4,6 +4,8 @@ import (
"context"
"encoding/csv"
"fmt"
"io"
"github.com/Gleipnir-Technology/nidus-sync/db"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/userfile"
@ -31,6 +33,9 @@ func ProcessJob(ctx context.Context, file_id int32) error {
for {
row, err := reader.Read()
if err != nil {
if err == io.EOF {
return nil
}
return fmt.Errorf("Failed to read all CSV records for file %d: %w", file_id, err)
}
log.Debug().Strs("row", row).Msg("Line")

View file

@ -24,14 +24,15 @@ func NewPoolUpload(ctx context.Context, u *models.User, upload userfile.FileUplo
}
file, err := models.FileuploadFiles.Insert(&models.FileuploadFileSetter{
ContentType: omit.From(upload.ContentType),
Created: omit.From(time.Now()),
CreatorID: omit.From(u.ID),
Deleted: omitnull.FromPtr[time.Time](nil),
Name: omit.From(upload.Name),
Status: omit.From(enums.FileuploadFilestatustypeUploaded),
SizeBytes: omit.From(int32(upload.SizeBytes)),
FileUUID: omit.From(upload.UUID),
ContentType: omit.From(upload.ContentType),
Created: omit.From(time.Now()),
CreatorID: omit.From(u.ID),
Deleted: omitnull.FromPtr[time.Time](nil),
Name: omit.From(upload.Name),
OrganizationID: omit.From(u.OrganizationID),
Status: omit.From(enums.FileuploadFilestatustypeUploaded),
SizeBytes: omit.From(int32(upload.SizeBytes)),
FileUUID: omit.From(upload.UUID),
}).One(ctx, txn)
if err != nil {
return PoolUpload{}, fmt.Errorf("Failed to create file upload: %w", err)