mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-10 21:48:52 +00:00
worker stats dashboard, fixed logs page, mobile support for navbar & project dashboard
This commit is contained in:
@@ -78,6 +78,7 @@ func New() *WebAPI {
|
||||
api.router.POST("/worker/create", LogRequestMiddleware(api.WorkerCreate))
|
||||
api.router.POST("/worker/update", LogRequestMiddleware(api.WorkerUpdate))
|
||||
api.router.GET("/worker/get/:id", LogRequestMiddleware(api.WorkerGet))
|
||||
api.router.GET("/worker/stats", LogRequestMiddleware(api.GetAllWorkerStats))
|
||||
|
||||
api.router.POST("/access/grant", LogRequestMiddleware(api.WorkerGrantAccess))
|
||||
api.router.POST("/access/remove", LogRequestMiddleware(api.WorkerRemoveAccess))
|
||||
|
||||
@@ -44,6 +44,12 @@ type WorkerAccessResponse struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type GetAllWorkerStatsResponse struct {
|
||||
Ok bool `json:"ok"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Stats *[]storage.WorkerStats `json:"stats"`
|
||||
}
|
||||
|
||||
func (api *WebAPI) WorkerCreate(r *Request) {
|
||||
|
||||
workerReq := &CreateWorkerRequest{}
|
||||
@@ -208,6 +214,16 @@ func (api *WebAPI) WorkerUpdate(r *Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func (api *WebAPI) GetAllWorkerStats(r *Request) {
|
||||
|
||||
stats := api.Database.GetAllWorkerStats()
|
||||
|
||||
r.OkJson(GetAllWorkerStatsResponse{
|
||||
Ok: true,
|
||||
Stats: stats,
|
||||
})
|
||||
}
|
||||
|
||||
func (api *WebAPI) workerCreate(request *CreateWorkerRequest, identity *storage.Identity) (*storage.Worker, error) {
|
||||
|
||||
if request.Alias == "" {
|
||||
|
||||
Reference in New Issue
Block a user