forked from OrgGo/Tasks
Updated main.go to make it buildable and fixed #23
This commit is contained in:
parent
894e4ba20f
commit
65a05d54ba
|
@ -152,7 +152,7 @@ func GetTaskByID(username string, id int) (types.Context, error) {
|
|||
var tasks []types.Task
|
||||
var task types.Task
|
||||
|
||||
getTaskSQL := "select t.id, t.title, t.content, t.priority, t.hide, 'UNCATEGORIZED' from task t join user u where t.user_id=u.id and t.cat_id=0 union select t.id, t.title, t.content, t.priority, t.hide, c.name from task t join user u left outer join category c where c.id = t.cat_id and t.user_id=u.id and t.id=? and u.username=?;"
|
||||
getTaskSQL := "select t.id, t.title, t.content, t.priority, t.hide, c.name from task t join user u left outer join category c where c.id = t.cat_id and t.user_id=u.id and t.id=? and u.username=? union select t.id, t.title, t.content, t.priority, t.hide, 'UNCATEGORIZED' from task t join user u where t.user_id=u.id and t.cat_id=0 ;"
|
||||
|
||||
rows := database.query(getTaskSQL, id, username)
|
||||
defer rows.Close()
|
||||
|
|
20
main.go
20
main.go
|
@ -71,17 +71,17 @@ func main() {
|
|||
|
||||
http.Handle("/static/", http.FileServer(http.Dir("public")))
|
||||
|
||||
http.HandleFunc("/api/get-task/", views.GetTasksFuncAPI)
|
||||
http.HandleFunc("/api/get-deleted-task/", views.GetDeletedTaskFuncAPI)
|
||||
http.HandleFunc("/api/add-task/", views.AddTaskFuncAPI)
|
||||
http.HandleFunc("/api/update-task/", views.UpdateTaskFuncAPI)
|
||||
http.HandleFunc("/api/delete-task/", views.DeleteTaskFuncAPI)
|
||||
// http.HandleFunc("/api/get-task/", views.GetTasksFuncAPI)
|
||||
// http.HandleFunc("/api/get-deleted-task/", views.GetDeletedTaskFuncAPI)
|
||||
// http.HandleFunc("/api/add-task/", views.AddTaskFuncAPI)
|
||||
// http.HandleFunc("/api/update-task/", views.UpdateTaskFuncAPI)
|
||||
// http.HandleFunc("/api/delete-task/", views.DeleteTaskFuncAPI)
|
||||
|
||||
http.HandleFunc("/api/get-token/", views.GetTokenHandler)
|
||||
http.HandleFunc("/api/get-category/", views.GetCategoryFuncAPI)
|
||||
http.HandleFunc("/api/add-category/", views.AddCategoryFuncAPI)
|
||||
http.HandleFunc("/api/update-category/", views.UpdateCategoryFuncAPI)
|
||||
http.HandleFunc("/api/delete-category/", views.DeleteCategoryFuncAPI)
|
||||
// http.HandleFunc("/api/get-token/", views.GetTokenHandler)
|
||||
// http.HandleFunc("/api/get-category/", views.GetCategoryFuncAPI)
|
||||
// http.HandleFunc("/api/add-category/", views.AddCategoryFuncAPI)
|
||||
// http.HandleFunc("/api/update-category/", views.UpdateCategoryFuncAPI)
|
||||
// http.HandleFunc("/api/delete-category/", views.DeleteCategoryFuncAPI)
|
||||
|
||||
log.Println("running server on ", values.ServerPort)
|
||||
log.Fatal(http.ListenAndServe(values.ServerPort, nil))
|
||||
|
|
Loading…
Reference in New Issue