added more functions to db abstraction

This commit is contained in:
Johannes Bülow 2025-06-15 21:13:49 +02:00
parent b6265586e2
commit 197c6041d9
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
3 changed files with 21 additions and 0 deletions

View file

@ -70,3 +70,13 @@ func GetFileMime(fileID pgtype.UUID) (string, error) {
} }
return mimeType, nil return mimeType, nil
} }
func GetFileProperties(fileID pgtype.UUID) (sqlc.FileProperty, error) {
query := sqlc.New(pool)
fileProperties, err := query.GetFileProperties(context.Background(), fileID)
if err != nil {
slog.Error("Error in GetFileProperties", "file-uuid", fileID, "error", err)
}
return fileProperties, err
}

View file

@ -70,3 +70,12 @@ func AddProcessingJobMessage(jobid int64, message string) error {
} }
return err return err
} }
func ALlProcessingJobs() ([]sqlc.ProcessingJob, error) {
query := sqlc.New(pool)
jobs, err := query.GetAllJobs(context.Background())
if err != nil {
slog.Error("Unable to retrieve processing jobs", "error", err)
}
return jobs, err
}

View file

@ -32,3 +32,5 @@ SET completed = NOW(),
error = $1 error = $1
WHERE id = $2; WHERE id = $2;
-- name: GetAllJobs :many
SELECT * FROM processing_jobs;