func ShowController(w http.ResponseWriter, r *http.Request) { // TODO if the job doesn't exist, return 404 id := getId(r) d := make(map[string]interface{}) d["job"] = job.Find(id, helpers.CurrentUser(r).Id) w.Write(util.JSON(d)) }
func UpdateController(w http.ResponseWriter, r *http.Request) { r.ParseForm() j := job.Find(getId(r), helpers.CurrentUser(r).Id) updateAttributes(j, r) j.Save() d := make(map[string]interface{}) if j.Save() { d["job"] = j } w.Write(util.JSON(d)) }
func DeleteController(w http.ResponseWriter, r *http.Request) { // TODO 404 if no job j := job.Find(getId(r), helpers.CurrentUser(r).Id) j.Delete() w.Write(util.JSON(make(map[string]interface{}))) }