Updated main.go to make it buildable and fixed #23

This commit is contained in:
Suraj Patil 2016-08-22 21:58:13 +05:30
parent 894e4ba20f
commit 65a05d54ba
2 changed files with 11 additions and 11 deletions

View File

@ -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
View File

@ -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))