Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files api #360

Merged
merged 34 commits into from
Nov 30, 2023
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
041e051
move api from sda-pipeline
MalinAhlberg Oct 16, 2023
2f1393a
adapt code to new repo
MalinAhlberg Oct 16, 2023
82fb61c
move in api db functions from sda-pipeline
MalinAhlberg Oct 16, 2023
9c13a40
refactor jwt verification
MalinAhlberg Oct 17, 2023
2fe97ad
refactor: use common auth
MalinAhlberg Oct 26, 2023
f45d7a7
fix: db query for get files
MalinAhlberg Oct 31, 2023
6872913
fix: avoid panic if validation token is not setup properly
MalinAhlberg Oct 31, 2023
95ece28
clean up and simplify api tests
MalinAhlberg Oct 20, 2023
c2b4906
refactor: break out auth header parsning and add test
MalinAhlberg Oct 31, 2023
2cc4ab1
refactor: merge api test files
MalinAhlberg Nov 8, 2023
e84581a
refactor: move mock authentication to helper
MalinAhlberg Nov 8, 2023
d06e0fe
fix api tests
MalinAhlberg Nov 9, 2023
4bcf9a6
update dependencies
MalinAhlberg Nov 9, 2023
3e0fef1
add api integration tests
MalinAhlberg Nov 9, 2023
ff410e0
update dependencies
MalinAhlberg Nov 9, 2023
358aa1c
fix linter complaints
MalinAhlberg Nov 9, 2023
08f2846
break out api test
MalinAhlberg Nov 13, 2023
b20b3e6
tests: update env var to integration tests
MalinAhlberg Nov 13, 2023
466645e
Update sda/cmd/api/api.go
MalinAhlberg Nov 14, 2023
70a334a
refactor: prettify, clean up etc
MalinAhlberg Nov 14, 2023
6636457
fix: update test conf for mq
MalinAhlberg Nov 14, 2023
983c328
refactor: clean up go mod file
MalinAhlberg Nov 14, 2023
7e18b71
remove newline
MalinAhlberg Nov 14, 2023
010c7e8
Add api readme
MalinAhlberg Nov 14, 2023
2b29bda
Update sda/cmd/api/api.md
MalinAhlberg Nov 23, 2023
fb710c3
fix: list all relevant files in files api
MalinAhlberg Nov 23, 2023
c371b79
Update sda/cmd/api/api.md
MalinAhlberg Nov 24, 2023
3670a72
Update sda/cmd/api/api.go
MalinAhlberg Nov 27, 2023
9ca18d6
Update sda/cmd/api/api.go
MalinAhlberg Nov 27, 2023
8d10f96
purge all containers if oidc fails
MalinAhlberg Nov 27, 2023
153ab99
refactor: make all tests part of testsuite
MalinAhlberg Nov 27, 2023
f384cdd
feat: add file size to files api
MalinAhlberg Nov 27, 2023
ece5d66
add test for db getuserfiles
MalinAhlberg Nov 27, 2023
61b4cb1
Revert "feat: add file size to files api"
MalinAhlberg Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "feat: add file size to files api"
This reverts commit ca3185e.
MalinAhlberg committed Nov 30, 2023
commit 61b4cb13c69852584e3ada951b151cf08e96027a
7 changes: 3 additions & 4 deletions sda/internal/database/database.go
Original file line number Diff line number Diff line change
@@ -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"`
MalinAhlberg marked this conversation as resolved.
Show resolved Hide resolved
}

// SchemaName is the name of the remote database schema to query
4 changes: 2 additions & 2 deletions sda/internal/database/db_functions.go
Original file line number Diff line number Diff line change
@@ -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
}