This commit is contained in:
Magnus Åhall 2024-12-03 22:08:45 +01:00
parent 04c101982f
commit 13d0b15fd9
15 changed files with 507 additions and 1246 deletions

View file

@ -44,20 +44,20 @@ func AddFile(userID int, file *File) (err error) { // {{{
err = rows.Scan(&file.ID)
return
} // }}}
func Files(userID, nodeID, fileID int) (files []File, err error) { // {{{
func Files(userID int, nodeUUID string, fileID int) (files []File, err error) { // {{{
var rows *sqlx.Rows
rows, err = db.Queryx(
`SELECT *
FROM file
WHERE
user_id = $1 AND
node_id = $2 AND
node_uuid = $2 AND
CASE $3::int
WHEN 0 THEN true
ELSE id = $3
END`,
userID,
nodeID,
nodeUUID,
fileID,
)
if err != nil {