Chore: Move SearchOrgs to org service (#55416)

* Chore: Move SearchOrgs to org service

* Fix lint

* Fix lint 2
This commit is contained in:
idafurjes
2022-09-20 09:55:40 +02:00
committed by GitHub
parent e25612092b
commit 7ce7c9b64c
17 changed files with 122 additions and 60 deletions
+4 -3
View File
@@ -320,18 +320,19 @@ func (hs *HTTPServer) SearchOrgs(c *models.ReqContext) response.Response {
page := c.QueryInt("page")
query := models.SearchOrgsQuery{
query := org.SearchOrgsQuery{
Query: c.Query("query"),
Name: c.Query("name"),
Page: page,
Limit: perPage,
}
if err := hs.SQLStore.SearchOrgs(c.Req.Context(), &query); err != nil {
result, err := hs.orgService.Search(c.Req.Context(), &query)
if err != nil {
return response.Error(http.StatusInternalServerError, "Failed to search orgs", err)
}
return response.JSON(http.StatusOK, query.Result)
return response.JSON(http.StatusOK, result)
}
// swagger:parameters updateCurrentOrgAddress