Cleanup: manager, make workerDBtoAPI(w)
use workerSummary(w)
This makes the `workerDBtoAPI(w)` and `workerSummary(w)` functions consistent, and makes the former use the latter.
This commit is contained in:
parent
3c1b0e0539
commit
487a31624f
@ -51,7 +51,7 @@ func (f *Flamenco) FetchWorker(e echo.Context, workerUUID string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.Debug().Msg("fetched worker")
|
logger.Debug().Msg("fetched worker")
|
||||||
apiWorker := workerDBtoAPI(dbWorker)
|
apiWorker := workerDBtoAPI(*dbWorker)
|
||||||
return e.JSON(http.StatusOK, apiWorker)
|
return e.JSON(http.StatusOK, apiWorker)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,22 +117,12 @@ func workerSummary(w persistence.Worker) api.WorkerSummary {
|
|||||||
return summary
|
return summary
|
||||||
}
|
}
|
||||||
|
|
||||||
func workerDBtoAPI(dbWorker *persistence.Worker) api.Worker {
|
func workerDBtoAPI(w persistence.Worker) api.Worker {
|
||||||
apiWorker := api.Worker{
|
apiWorker := api.Worker{
|
||||||
WorkerSummary: api.WorkerSummary{
|
WorkerSummary: workerSummary(w),
|
||||||
Id: dbWorker.UUID,
|
IpAddress: w.Address,
|
||||||
Nickname: dbWorker.Name,
|
Platform: w.Platform,
|
||||||
Status: dbWorker.Status,
|
SupportedTaskTypes: w.TaskTypes(),
|
||||||
Version: dbWorker.Software,
|
|
||||||
},
|
|
||||||
IpAddress: dbWorker.Address,
|
|
||||||
Platform: dbWorker.Platform,
|
|
||||||
SupportedTaskTypes: dbWorker.TaskTypes(),
|
|
||||||
}
|
|
||||||
|
|
||||||
if dbWorker.StatusRequested != "" {
|
|
||||||
apiWorker.StatusRequested = &dbWorker.StatusRequested
|
|
||||||
apiWorker.LazyStatusRequest = &dbWorker.LazyStatusRequest
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiWorker
|
return apiWorker
|
||||||
|
Loading…
x
Reference in New Issue
Block a user