From 65a05d54ba04a90def3f373c169f54eb54d3d121 Mon Sep 17 00:00:00 2001 From: Suraj Patil Date: Mon, 22 Aug 2016 21:58:13 +0530 Subject: [PATCH] Updated main.go to make it buildable and fixed #23 --- db/tasks.go | 2 +- main.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/tasks.go b/db/tasks.go index 3126f72..801140f 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -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() diff --git a/main.go b/main.go index dc2672c..2bedaf4 100644 --- a/main.go +++ b/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))