Fix upload list page
This commit is contained in:
parent
732b123342
commit
b2eb98a66c
2 changed files with 1 additions and 36 deletions
|
|
@ -6,13 +6,9 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/Gleipnir-Technology/bob"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql/sm"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/stephenafamo/scan"
|
||||
)
|
||||
|
||||
type UploadPoolDetail struct {
|
||||
|
|
@ -121,37 +117,6 @@ func getUploadPoollistDetail(ctx context.Context, file *models.FileuploadFile) (
|
|||
Status: file.Status.String(),
|
||||
}, nil
|
||||
}
|
||||
func PoolUploadList(ctx context.Context, organization_id int32) ([]Upload, error) {
|
||||
results := make([]Upload, 0)
|
||||
rows, err := bob.All(ctx, db.PGInstance.BobDB, psql.Select(
|
||||
sm.Columns(
|
||||
// fileupload.csv columns
|
||||
//"csv.file_id",
|
||||
//"csv.committed",
|
||||
//"csv.rowcount",
|
||||
//"csv.type_",
|
||||
|
||||
// fileupload.file columns
|
||||
//"file.content_type",
|
||||
"file.created AS created",
|
||||
//"file.creator_id",
|
||||
//"file.deleted",
|
||||
"file.id AS id",
|
||||
//"file.name",
|
||||
//"file.organization_id",
|
||||
"file.status AS status",
|
||||
//"file.size_bytes",
|
||||
//"file.file_uuid",
|
||||
),
|
||||
sm.From("fileupload.csv").As("csv"),
|
||||
sm.InnerJoin("fileupload.file").As("file").OnEQ(psql.Raw("csv.file_id"), psql.Raw("file.id")),
|
||||
sm.Where(psql.Raw("file.organization_id").EQ(psql.Arg(organization_id))),
|
||||
), scan.StructMapper[Upload]())
|
||||
if err != nil {
|
||||
return results, fmt.Errorf("Failed to query pool upload rows: %w", err)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
func errorsByLine(ctx context.Context, file *models.FileuploadFile) ([]UploadPoolError, map[int32][]UploadPoolError, error) {
|
||||
file_errors := make([]UploadPoolError, 0)
|
||||
errors_by_line := make(map[int32][]UploadPoolError, 0)
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func UploadSummaryList(ctx context.Context, org Organization) ([]UploadSummary,
|
|||
),
|
||||
sm.From("fileupload.csv").As("csv"),
|
||||
sm.InnerJoin("fileupload.file").As("file").OnEQ(psql.Raw("csv.file_id"), psql.Raw("file.id")),
|
||||
sm.Where(psql.Raw("file.organization_id").EQ(psql.Arg(org.ID))),
|
||||
sm.Where(psql.Quote("file", "organization_id").EQ(psql.Arg(org.ID()))),
|
||||
sm.OrderBy("created").Desc(),
|
||||
), scan.StructMapper[UploadSummary]())
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue