From 0643f8c9cf91ea72dd6a9b6750fdb268ab2cc312 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Mon, 2 Sep 2024 10:26:15 +0200 Subject: [PATCH] allow defining an id in backup job --- web/backupjob.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/backupjob.go b/web/backupjob.go index 5fdf070c..1809e465 100644 --- a/web/backupjob.go +++ b/web/backupjob.go @@ -34,6 +34,7 @@ const ( ) type CreateBackupJob struct { + ID string `json:"id"` Type BackupJobType `json:"type"` Host string `json:"host"` Port int `json:"port"` @@ -110,12 +111,15 @@ func (a *Api) CreateBackupJob(w http.ResponseWriter, r *http.Request, c *types.C return } - id := uuid.NewString() + if job.ID == "" { + job.ID = uuid.NewString() + } + info := &BackupJobInfo{ Status: BackupJobRunning, - ID: id, + ID: job.ID, } - backupjobs[id] = info + backupjobs[job.ID] = info go backupJob(a.app, job, info, c) SendJson(w, info)