mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-10 21:48:52 +00:00
More work on UI
This commit is contained in:
@@ -53,6 +53,7 @@ func New() *WebAPI {
|
||||
api.router.POST("/project/create", LogRequestMiddleware(api.ProjectCreate))
|
||||
api.router.GET("/project/get/:id", LogRequestMiddleware(api.ProjectGet))
|
||||
api.router.GET("/project/stats/:id", LogRequestMiddleware(api.ProjectGetStats))
|
||||
api.router.GET("/project/stats", LogRequestMiddleware(api.ProjectGetAllStats))
|
||||
|
||||
api.router.POST("/task/create", LogRequestMiddleware(api.TaskCreate))
|
||||
api.router.GET("/task/get/:project", LogRequestMiddleware(api.TaskGetFromProject))
|
||||
|
||||
@@ -33,6 +33,12 @@ type GetProjectStatsResponse struct {
|
||||
Stats *storage.ProjectStats `json:"stats,omitempty"`
|
||||
}
|
||||
|
||||
type GetAllProjectsStatsResponse struct {
|
||||
Ok bool `json:"ok"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Stats *[]storage.ProjectStats `json:"stats,omitempty"`
|
||||
}
|
||||
|
||||
func (api *WebAPI) ProjectCreate(r *Request) {
|
||||
|
||||
createReq := &CreateProjectRequest{}
|
||||
@@ -125,3 +131,13 @@ func (api *WebAPI) ProjectGetStats(r *Request) {
|
||||
}, 404)
|
||||
}
|
||||
}
|
||||
|
||||
func (api *WebAPI) ProjectGetAllStats(r *Request) {
|
||||
|
||||
stats := api.Database.GetAllProjectsStats()
|
||||
|
||||
r.OkJson(GetAllProjectsStatsResponse{
|
||||
Ok: true,
|
||||
Stats: stats,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user