mirror of
https://github.com/simon987/task_tracker.git
synced 2025-04-24 12:35:52 +00:00
Complete //todo's
This commit is contained in:
parent
3415f95337
commit
df7f91a475
@ -158,7 +158,13 @@ func (api *WebAPI) GetManagerList(r *Request) {
|
|||||||
func (api *WebAPI) GetManagerListWithRoleOn(r *Request) {
|
func (api *WebAPI) GetManagerListWithRoleOn(r *Request) {
|
||||||
|
|
||||||
pid, err := strconv.ParseInt(r.Ctx.UserValue("id").(string), 10, 64)
|
pid, err := strconv.ParseInt(r.Ctx.UserValue("id").(string), 10, 64)
|
||||||
handleErr(err, r) //todo handle invalid id
|
if err != nil || pid <= 0 {
|
||||||
|
r.Json(JsonResponse{
|
||||||
|
Ok: false,
|
||||||
|
Message: "Invalid project id",
|
||||||
|
}, 400)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
sess := api.Session.StartFasthttp(r.Ctx)
|
sess := api.Session.StartFasthttp(r.Ctx)
|
||||||
manager := sess.Get("manager")
|
manager := sess.Get("manager")
|
||||||
|
@ -27,13 +27,14 @@ func (r *Request) Json(object JsonResponse, code int) {
|
|||||||
logrus.WithError(err).WithFields(logrus.Fields{
|
logrus.WithError(err).WithFields(logrus.Fields{
|
||||||
"code": code,
|
"code": code,
|
||||||
}).Error("Error during json encoding of object")
|
}).Error("Error during json encoding of object")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
r.Ctx.Response.SetStatusCode(code)
|
r.Ctx.Response.SetStatusCode(code)
|
||||||
r.Ctx.Response.Header.Set("Content-Type", "application/json")
|
r.Ctx.Response.Header.Set("Content-Type", "application/json")
|
||||||
_, err = r.Ctx.Write(resp)
|
_, err = r.Ctx.Write(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err) //todo handle differently
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,6 @@ func (api *WebAPI) SetManagerRoleOnProject(r *Request) {
|
|||||||
func (api *WebAPI) SetSecret(r *Request) {
|
func (api *WebAPI) SetSecret(r *Request) {
|
||||||
|
|
||||||
pid, err := strconv.ParseInt(r.Ctx.UserValue("id").(string), 10, 64)
|
pid, err := strconv.ParseInt(r.Ctx.UserValue("id").(string), 10, 64)
|
||||||
handleErr(err, r) //todo handle invalid id
|
|
||||||
if err != nil || pid <= 0 {
|
if err != nil || pid <= 0 {
|
||||||
r.Json(JsonResponse{
|
r.Json(JsonResponse{
|
||||||
Ok: false,
|
Ok: false,
|
||||||
|
@ -66,7 +66,6 @@ func (api *WebAPI) SubmitTask(r *Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if createReq.UniqueString != "" {
|
if createReq.UniqueString != "" {
|
||||||
//TODO: Load key from config
|
|
||||||
createReq.Hash64 = int64(siphash.Hash(1, 2, []byte(createReq.UniqueString)))
|
createReq.Hash64 = int64(siphash.Hash(1, 2, []byte(createReq.UniqueString)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ func (database *Database) SaveTask(task *Task, project int64, hash64 int64, wid
|
|||||||
|
|
||||||
db := database.getDB()
|
db := database.getDB()
|
||||||
|
|
||||||
//TODO: For some reason it refuses to insert the 64-bit value unless I do that...
|
|
||||||
res, err := db.Exec(fmt.Sprintf(`
|
res, err := db.Exec(fmt.Sprintf(`
|
||||||
INSERT INTO task (project, max_retries, recipe, priority, max_assign_time, hash64,verification_count)
|
INSERT INTO task (project, max_retries, recipe, priority, max_assign_time, hash64,verification_count)
|
||||||
SELECT $1,$2,$3,$4,$5,NULLIF(%d, 0),$6 FROM worker_access
|
SELECT $1,$2,$3,$4,$5,NULLIF(%d, 0),$6 FROM worker_access
|
||||||
|
Loading…
x
Reference in New Issue
Block a user