From 778b88d0e8c2382c208d4350a4151238503b2912 Mon Sep 17 00:00:00 2001 From: vsumit89 Date: Wed, 7 Sep 2022 12:13:11 +0530 Subject: [PATCH] removed the organisation endpoint --- server/action/organisation/all.go | 80 ++++++++++++++--------------- server/action/organisation/route.go | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/server/action/organisation/all.go b/server/action/organisation/all.go index ad56843b..792390e2 100644 --- a/server/action/organisation/all.go +++ b/server/action/organisation/all.go @@ -1,42 +1,42 @@ package organisation -import ( - "fmt" - "net/http" - - "github.com/factly/kavach-server/model" - "github.com/factly/x/renderx" -) - -type paging struct { - Nodes []model.Organisation `json:"nodes"` - Total int64 `json:"total"` -} - -// all - Get all organisations -// @Summary Show all organisations -// @Description Get all organisations -// @Tags Organisation -// @ID get-all-organisations -// @Produce json -// @Param X-User header string true "User ID" -// @Param q query string false "Query" -// @Success 200 {array} model.Organisation -// @Router /organisations [get] -func all(w http.ResponseWriter, r *http.Request) { - result := paging{} - result.Nodes = make([]model.Organisation, 0) - - searchQuery := r.URL.Query().Get("q") - - tx := model.DB.Model(&model.Organisation{}) - - if searchQuery != "" { - query := fmt.Sprint("%", searchQuery, "%") - tx.Where("title ILIKE ?", query) - } - - tx.Count(&result.Total).Preload("Medium").Find(&result.Nodes) - - renderx.JSON(w, http.StatusOK, result) -} +// import ( +// "fmt" +// "net/http" + +// "github.com/factly/kavach-server/model" +// "github.com/factly/x/renderx" +// ) + +// type paging struct { +// Nodes []model.Organisation `json:"nodes"` +// Total int64 `json:"total"` +// } + +// // all - Get all organisations +// // @Summary Show all organisations +// // @Description Get all organisations +// // @Tags Organisation +// // @ID get-all-organisations +// // @Produce json +// // @Param X-User header string true "User ID" +// // @Param q query string false "Query" +// // @Success 200 {array} model.Organisation +// // @Router /organisations [get] +// func all(w http.ResponseWriter, r *http.Request) { +// result := paging{} +// result.Nodes = make([]model.Organisation, 0) + +// searchQuery := r.URL.Query().Get("q") + +// tx := model.DB.Model(&model.Organisation{}) + +// if searchQuery != "" { +// query := fmt.Sprint("%", searchQuery, "%") +// tx.Where("title ILIKE ?", query) +// } + +// tx.Count(&result.Total).Preload("Medium").Find(&result.Nodes) + +// renderx.JSON(w, http.StatusOK, result) +// } diff --git a/server/action/organisation/route.go b/server/action/organisation/route.go index bad4a7c8..6c2f022d 100644 --- a/server/action/organisation/route.go +++ b/server/action/organisation/route.go @@ -24,7 +24,7 @@ func Router() chi.Router { r.Get("/my", list) r.Post("/", create) - r.Get("/", all) + // r.Get("/", all) r.Route("/{organisation_id}", func(r chi.Router) { r.Get("/", details) r.Put("/", update)