From 4f8255dc06c951538305faae06c1fe2d43146590 Mon Sep 17 00:00:00 2001 From: MalinAhlberg Date: Thu, 30 Nov 2023 09:55:32 +0100 Subject: [PATCH] Revert "feat: add file size to files api" This reverts commit ca3185e185d84ab7e4ee99cbe8ac164c2503a911. --- sda/internal/database/database.go | 7 +++---- sda/internal/database/db_functions.go | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sda/internal/database/database.go b/sda/internal/database/database.go index f245bcdbf..0a0ab3c95 100644 --- a/sda/internal/database/database.go +++ b/sda/internal/database/database.go @@ -49,10 +49,9 @@ type SyncData struct { } type SubmissionFileInfo struct { - InboxPath string `json:"inboxPath"` - Status string `json:"fileStatus"` - CreateAt string `json:"createAt"` - FileSize sql.NullInt64 `json:"submission_file_size"` + InboxPath string `json:"inboxPath"` + Status string `json:"fileStatus"` + CreateAt string `json:"createAt"` } // SchemaName is the name of the remote database schema to query diff --git a/sda/internal/database/db_functions.go b/sda/internal/database/db_functions.go index 58399367c..d6e045f96 100644 --- a/sda/internal/database/db_functions.go +++ b/sda/internal/database/db_functions.go @@ -649,7 +649,7 @@ func (dbs *SDAdb) getUserFiles(userID string) ([]*SubmissionFileInfo, error) { db := dbs.DB // select all files of the user, each one annotated with its latest event - const query = "SELECT f.submission_file_path, e.event, f.created_at, f.submission_file_size " + + const query = "SELECT f.submission_file_path, e.event, f.created_at " + "FROM sda.files f " + "LEFT JOIN ( " + "SELECT DISTINCT ON (file_id) file_id, started_at, event " + @@ -669,7 +669,7 @@ func (dbs *SDAdb) getUserFiles(userID string) ([]*SubmissionFileInfo, error) { for rows.Next() { // Read rows into struct fi := &SubmissionFileInfo{} - err := rows.Scan(&fi.InboxPath, &fi.Status, &fi.CreateAt, &fi.FileSize) + err := rows.Scan(&fi.InboxPath, &fi.Status, &fi.CreateAt) if err != nil { return nil, err }