update swagger descriptions
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
package controllers
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"forge.redroom.link/yves/sqldb"
 | 
			
		||||
@@ -13,17 +14,18 @@ type SchemaController struct {
 | 
			
		||||
	beego.Controller
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// @Title GetTable
 | 
			
		||||
// @Description get list table
 | 
			
		||||
// @Title GetTablesList
 | 
			
		||||
// @Description Get database tables list
 | 
			
		||||
// @Success 200 {string} success !
 | 
			
		||||
// @Failure 403 no table
 | 
			
		||||
// @Failure 500 query error
 | 
			
		||||
// @router / [get]
 | 
			
		||||
func (s *SchemaController) GetTable() {
 | 
			
		||||
func (s *SchemaController) GetTablesList() {
 | 
			
		||||
	db := sqldb.Open(os.Getenv("driverdb"), os.Getenv("paramsdb"))
 | 
			
		||||
	data, err := db.ListTables()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error().Msg(err.Error())
 | 
			
		||||
		s.Data["json"] = map[string]string{"error": err.Error()}
 | 
			
		||||
		s.Ctx.Output.SetStatus(http.StatusInternalServerError)
 | 
			
		||||
	}
 | 
			
		||||
	s.Data["json"] = data
 | 
			
		||||
	s.ServeJSON()
 | 
			
		||||
@@ -32,10 +34,10 @@ func (s *SchemaController) GetTable() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// @Title GetSchema
 | 
			
		||||
// @Description get table schema
 | 
			
		||||
// @Description Get table schema
 | 
			
		||||
// @Param	table			path 	string	true		"Name of the table"
 | 
			
		||||
// @Success 200 success !
 | 
			
		||||
// @Failure 403 no table
 | 
			
		||||
// @Failure 204 no table
 | 
			
		||||
// @router /:table [get]
 | 
			
		||||
func (s *SchemaController) GetSchema() {
 | 
			
		||||
	table := s.GetString(":table")
 | 
			
		||||
@@ -44,6 +46,7 @@ func (s *SchemaController) GetSchema() {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error().Msg(err.Error())
 | 
			
		||||
		s.Data["json"] = map[string]string{"error": err.Error()}
 | 
			
		||||
		s.Ctx.Output.SetStatus(http.StatusNoContent)
 | 
			
		||||
	}
 | 
			
		||||
	s.Data["json"] = data
 | 
			
		||||
	s.ServeJSON()
 | 
			
		||||
 
 | 
			
		||||
@@ -185,7 +185,7 @@ func (t *TableController) GetAllTableColumnRestriction() {
 | 
			
		||||
// @Param	table			path 	string	true		"Name of the table"
 | 
			
		||||
// @Param	columns			path 	string	true		"Name of the columns (separate with a comma)"
 | 
			
		||||
// @Param	restriction		path 	string	true		"SQL restriction"
 | 
			
		||||
// @param	sortkeys		path	string	true		"column name"
 | 
			
		||||
// @Param	sortkeys		path	string	true		"Order by: columns names (separate with a comma)"
 | 
			
		||||
// @Success 200 {string} success !
 | 
			
		||||
// @Failure 403 no table
 | 
			
		||||
// @router /:table/:columns/:restriction/:sortkeys [get]
 | 
			
		||||
@@ -210,8 +210,8 @@ func (t *TableController) GetAllTableColumnRestrictionSortkeys() {
 | 
			
		||||
// @Param	table			path 	string	true		"Name of the table"
 | 
			
		||||
// @Param	columns			path 	string	true		"Name of the columns (separate with a comma)"
 | 
			
		||||
// @Param	restriction		path 	string	true		"SQL restriction"
 | 
			
		||||
// @param	sortkeys		path	string	true		"column name"
 | 
			
		||||
// @param	dir				path	string	true		"asc or desc"
 | 
			
		||||
// @Param	sortkeys		path	string	true		"Order by: columns names (separate with a comma)"
 | 
			
		||||
// @Param	dir				path	string	true		"asc or desc"
 | 
			
		||||
// @Success 200 {string} success !
 | 
			
		||||
// @Failure 403 no table
 | 
			
		||||
// @router /:table/:columns/:restriction/:sortkeys/:dir [get]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user