feat(daemon): timestamps

This commit is contained in:
2024-02-27 02:00:07 +00:00
parent e633fd2e79
commit c909c2a352
7 changed files with 116 additions and 38 deletions
+15
View File
@@ -10,6 +10,7 @@ import (
"os/exec"
"path/filepath"
"sync"
"time"
"github.com/davecgh/go-spew/spew"
"github.com/google/uuid"
@@ -122,6 +123,18 @@ func listJobs(req *api.Req, resp *api.Resp, e cmdenv) (err error) {
if params.Status != "" && j.Status != params.Status {
continue
}
if params.Time.After != 0 {
if time.Unix(params.Time.After, 0).
After(j.Created) {
continue
}
}
if params.Time.Before != 0 {
if time.Unix(params.Time.Before, 0).
Before(j.Created) {
continue
}
}
result = append(result, j)
}
@@ -139,6 +152,8 @@ func addJob(req *api.Req, resp *api.Resp, e cmdenv) (err error) {
job.GenUUID()
job.Created = time.Now()
var repos []api.Repo
repos, err = db.Repos(e.DB)
if err != nil {