ui get form new and edit mode
This commit is contained in:
parent
be4545e603
commit
82012d36af
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
|
||||||
|
// Pointez pour afficher la description des attributs existants.
|
||||||
|
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Debug",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "debug",
|
||||||
|
"program": "main.go"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -6,6 +6,8 @@ Some special tables can be used for defining database access restrictions based
|
|||||||
> export GOPRIVATE=forge.redroom.link
|
> export GOPRIVATE=forge.redroom.link
|
||||||
before doing go mod tidy.
|
before doing go mod tidy.
|
||||||
|
|
||||||
|
bee generate routers
|
||||||
|
|
||||||
Running in debug mode
|
Running in debug mode
|
||||||
---------------------
|
---------------------
|
||||||
> bee run -downdoc=true -gendoc=true
|
> bee run -downdoc=true -gendoc=true
|
||||||
|
@ -59,7 +59,7 @@ func (t *TableController) Put() {
|
|||||||
} else {
|
} else {
|
||||||
t.Ctx.Output.SetStatus(http.StatusOK)
|
t.Ctx.Output.SetStatus(http.StatusOK)
|
||||||
}
|
}
|
||||||
t.Data["json"] = map[string]int{"uid": uid}
|
t.Data["json"] = map[string]int64{"uid": uid}
|
||||||
t.ServeJSON()
|
t.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
210
controllers/ui.go
Normal file
210
controllers/ui.go
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"forge.redroom.link/yves/sqldb"
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Operations about table
|
||||||
|
type UiController struct {
|
||||||
|
beego.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title form
|
||||||
|
// @Description create access form
|
||||||
|
// @Param fid path string true "The fid of the form"
|
||||||
|
// @Param uid path string true "The uid you want to edit"
|
||||||
|
// @Success 200 json form
|
||||||
|
// @Failure 403 body is empty
|
||||||
|
// @router /:fid/:uid [get]
|
||||||
|
func (u *UiController) GetEditForm() {
|
||||||
|
fid := u.Ctx.Input.Query(":fid")
|
||||||
|
uid := u.Ctx.Input.Query(":uid")
|
||||||
|
|
||||||
|
u.buildForm(fid, uid)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title form
|
||||||
|
// @Description create access form
|
||||||
|
// @Param fid path string true "The fid of the form"
|
||||||
|
// @Success 200 json form
|
||||||
|
// @Failure 403 body is empty
|
||||||
|
// @router /:fid [get]
|
||||||
|
func (u *UiController) GetEmptyForm() {
|
||||||
|
fid := u.Ctx.Input.Query(":fid")
|
||||||
|
u.buildForm(fid, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UiController) buildForm(fid string, uid string) {
|
||||||
|
|
||||||
|
db := sqldb.Open(os.Getenv("driverdb"), os.Getenv("paramsdb"))
|
||||||
|
// Get form data
|
||||||
|
formdesc, err := getFormDesc(db, fid)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
form := make(map[string]interface{})
|
||||||
|
form["title"] = formdesc[0]["title"].(string)
|
||||||
|
form["description"] = formdesc[0]["header"].(string)
|
||||||
|
|
||||||
|
formfields, err := getFormFields(db, fid)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
var fields []interface{}
|
||||||
|
columnnames := []string{"id"}
|
||||||
|
for _, f := range formfields {
|
||||||
|
columnnames = append(columnnames, f["columnname"].(string))
|
||||||
|
}
|
||||||
|
// Get table schema
|
||||||
|
schema, err := db.Table(formdesc[0]["tablename"].(string)).GetSchema()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
var data []sqldb.AssRow
|
||||||
|
//Get edited Item data if item id is provided
|
||||||
|
if uid != "" {
|
||||||
|
data, err = getData(db, formdesc[0]["tablename"].(string), columnnames, uid)
|
||||||
|
}
|
||||||
|
for _, f := range formfields {
|
||||||
|
if f["columnname"].(string) != "id" {
|
||||||
|
field := make(map[string]interface{})
|
||||||
|
field["key"] = f["columnname"].(string)
|
||||||
|
if uid != "" {
|
||||||
|
field["value"] = fmt.Sprintf("%v", data[0][f["columnname"].(string)])
|
||||||
|
}
|
||||||
|
field["type"] = f["fieldtype"].(string)
|
||||||
|
field["label"] = f["label"].(string)
|
||||||
|
dbType := schema.Columns[f["columnname"].(string)][:strings.Index(schema.Columns[f["columnname"].(string)], "|")]
|
||||||
|
// foreign keys
|
||||||
|
if f["columnname"].(string)[len(f["columnname"].(string))-3:] == "_id" {
|
||||||
|
fklist := []map[string]interface{}{}
|
||||||
|
// Query FK
|
||||||
|
columns := strings.Split(f["linkcolumns"].(string), ",")
|
||||||
|
sortkeys := strings.Split(f["linkorder"].(string), ",")
|
||||||
|
restriction := f["linkrestriction"].(string)
|
||||||
|
dir := ""
|
||||||
|
fk, err := db.Table(f["columnname"].(string)[:len(f["columnname"].(string))-3]).GetAssociativeArray(columns, restriction, sortkeys, dir)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
for _, v := range fk {
|
||||||
|
item := make(map[string]interface{})
|
||||||
|
item["value"] = fmt.Sprintf("%v", v["id"])
|
||||||
|
item["label"] = v["label"]
|
||||||
|
fklist = append(fklist, item)
|
||||||
|
}
|
||||||
|
field["items"] = fklist
|
||||||
|
}
|
||||||
|
// other
|
||||||
|
switch dbType {
|
||||||
|
case "integer":
|
||||||
|
|
||||||
|
case "float", "double":
|
||||||
|
|
||||||
|
case "varchar":
|
||||||
|
|
||||||
|
}
|
||||||
|
if uid != "" {
|
||||||
|
// Force data values to the right type if required
|
||||||
|
switch field["type"] {
|
||||||
|
case "Radio":
|
||||||
|
field["value"] = data[0][f["columnname"].(string)]
|
||||||
|
// force string for all text fields, whatever data type
|
||||||
|
default:
|
||||||
|
field["value"] = fmt.Sprintf("%v", data[0][f["columnname"].(string)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fields = append(fields, field)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
form["fields"] = fields
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
} else {
|
||||||
|
u.Data["json"] = form
|
||||||
|
}
|
||||||
|
u.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Access form data post
|
||||||
|
// @Description insert access
|
||||||
|
// @Param uid path string true "The uid you want to edit"
|
||||||
|
// @Param body body form data "body of jsonform data"
|
||||||
|
// @Success 200 json
|
||||||
|
// @Failure 403 body is empty
|
||||||
|
// @router /:uid [post]
|
||||||
|
func (u *UiController) PostAccessForm() {
|
||||||
|
var err error
|
||||||
|
uid := u.Ctx.Input.Query(":uid")
|
||||||
|
var formdata map[string]interface{}
|
||||||
|
json.Unmarshal(u.Ctx.Input.RequestBody, &formdata)
|
||||||
|
db := sqldb.Open(os.Getenv("driverdb"), os.Getenv("paramsdb"))
|
||||||
|
accesslist := formdata["fields"].([]interface{})
|
||||||
|
switcheslist := accesslist[:len(accesslist)-3]
|
||||||
|
families := []string{}
|
||||||
|
for _, accessif := range switcheslist {
|
||||||
|
access := accessif.(map[string]interface{})
|
||||||
|
basefamily := fmt.Sprint(access["key"].(float64))
|
||||||
|
if access["value"].(bool) {
|
||||||
|
_, err = db.QueryAssociativeArray("insert ignore into user_basefamily(user_id, family_id) values(" + uid + "," + basefamily + ")")
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
families = append(families, basefamily)
|
||||||
|
} else {
|
||||||
|
// remove off
|
||||||
|
_, err = db.QueryAssociativeArray("delete from user_basefamily where user_id=" + uid + " and family_id=" + basefamily)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msg(err.Error())
|
||||||
|
u.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||||
|
} else {
|
||||||
|
u.Data["json"] = "ok"
|
||||||
|
}
|
||||||
|
u.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFormDesc(db *sqldb.Db, fid string) ([]sqldb.AssRow, error) {
|
||||||
|
columns := []string{"*"}
|
||||||
|
restriction := "id=" + fid
|
||||||
|
sortkeys := []string{}
|
||||||
|
dir := ""
|
||||||
|
return db.Table("dbform").GetAssociativeArray(columns, restriction, sortkeys, dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFormFields(db *sqldb.Db, fid string) ([]sqldb.AssRow, error) {
|
||||||
|
columns := []string{"*"}
|
||||||
|
restriction := "form_id=" + fid
|
||||||
|
sortkeys := []string{"columnorder"}
|
||||||
|
dir := ""
|
||||||
|
return db.Table("dbformfields").GetAssociativeArray(columns, restriction, sortkeys, dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getData(db *sqldb.Db, table string, columns []string, uid string) ([]sqldb.AssRow, error) {
|
||||||
|
restriction := "id=" + uid
|
||||||
|
sortkeys := []string{}
|
||||||
|
dir := ""
|
||||||
|
return db.Table(table).GetAssociativeArray(columns, restriction, sortkeys, dir)
|
||||||
|
}
|
@ -7,13 +7,13 @@ CREATE SEQUENCE sq_dbtableaccess;
|
|||||||
CREATE SEQUENCE sq_dbuser;
|
CREATE SEQUENCE sq_dbuser;
|
||||||
CREATE SEQUENCE sq_dbuserrole;
|
CREATE SEQUENCE sq_dbuserrole;
|
||||||
CREATE SEQUENCE sq_dbentity;
|
CREATE SEQUENCE sq_dbentity;
|
||||||
|
CREATE SEQUENCE sq_dbform;
|
||||||
|
CREATE SEQUENCE sq_dbformfields;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.dbrole
|
CREATE TABLE IF NOT EXISTS public.dbrole
|
||||||
(
|
(
|
||||||
id integer NOT NULL DEFAULT nextval('sq_dbrole'),
|
id integer NOT NULL DEFAULT nextval('sq_dbrole'),
|
||||||
name character varying,
|
name character varying(255),
|
||||||
description text,
|
description text,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
@ -56,6 +56,32 @@ CREATE TABLE IF NOT EXISTS public.dbentity
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS public.dbform
|
||||||
|
(
|
||||||
|
id integer NOT NULL DEFAULT nextval('sq_dbform'),
|
||||||
|
tablename character varying(255),
|
||||||
|
formname character varying(255),
|
||||||
|
title character varying(255),
|
||||||
|
header character varying(2000),
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS public.dbformfields
|
||||||
|
(
|
||||||
|
id integer NOT NULL DEFAULT nextval('sq_dbformfields'),
|
||||||
|
form_id integer,
|
||||||
|
columnname character varying(255),
|
||||||
|
columnorder integer,
|
||||||
|
fieldtype character varying(255),
|
||||||
|
label character varying(255),
|
||||||
|
placeholder character varying(255),
|
||||||
|
defaultvalue character varying(255),
|
||||||
|
linkcolumns character varying(255),
|
||||||
|
linkrestriction character varying(255),
|
||||||
|
linkorder character varying(255),
|
||||||
|
required bool,
|
||||||
|
description text,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
END;
|
END;
|
@ -5,51 +5,16 @@ BEGIN;
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.axis
|
CREATE TABLE IF NOT EXISTS public.axis
|
||||||
(
|
(
|
||||||
id integer NOT NULL SERIAL,
|
id SERIAL,
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
entity_id integer,
|
entity_id integer,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.dbrole
|
|
||||||
(
|
|
||||||
id integer NOT NULL SERIAL,
|
|
||||||
name character varying,
|
|
||||||
description text,
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.dbtableaccess
|
|
||||||
(
|
|
||||||
id integer NOT NULL SERIAL,
|
|
||||||
tableaccess character varying(255),
|
|
||||||
dbrole_id integer,
|
|
||||||
userrolerestrictions character varying(255),
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.dbuser
|
|
||||||
(
|
|
||||||
id integer NOT NULL SERIAL,
|
|
||||||
login character varying(255) UNIQUE,
|
|
||||||
password character varying(255),
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.dbuserrole
|
|
||||||
(
|
|
||||||
id integer NOT NULL SERIAL,
|
|
||||||
dbuser_id integer,
|
|
||||||
entity_id integer,
|
|
||||||
dbrole_id integer,
|
|
||||||
startdate timestamp without time zone,
|
|
||||||
enddate timestamp without time zone,
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.employee
|
CREATE TABLE IF NOT EXISTS public.employee
|
||||||
(
|
(
|
||||||
id bigint NOT NULL SERIAL,
|
id SERIAL,
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
firstname character varying(255),
|
firstname character varying(255),
|
||||||
mail character varying(255),
|
mail character varying(255),
|
||||||
@ -72,7 +37,7 @@ CREATE TABLE IF NOT EXISTS public.employee
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.entity
|
CREATE TABLE IF NOT EXISTS public.entity
|
||||||
(
|
(
|
||||||
id integer NOT NULL SERIAL,
|
id SERIAL,
|
||||||
type character varying(255),
|
type character varying(255),
|
||||||
parent_id bigint,
|
parent_id bigint,
|
||||||
description text,
|
description text,
|
||||||
@ -81,7 +46,7 @@ CREATE TABLE IF NOT EXISTS public.entity
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.project
|
CREATE TABLE IF NOT EXISTS public.project
|
||||||
(
|
(
|
||||||
id integer NOT NULL SERIAL,
|
id SERIAL,
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
entity_id integer,
|
entity_id integer,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
@ -93,28 +58,6 @@ ALTER TABLE public.axis
|
|||||||
NOT VALID;
|
NOT VALID;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE public.dbtableaccess
|
|
||||||
ADD FOREIGN KEY (dbrole_id)
|
|
||||||
REFERENCES public.dbrole (id)
|
|
||||||
NOT VALID;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE public.dbuserrole
|
|
||||||
ADD FOREIGN KEY (dbrole_id)
|
|
||||||
REFERENCES public.dbrole (id)
|
|
||||||
NOT VALID;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE public.dbuserrole
|
|
||||||
ADD FOREIGN KEY (dbuser_id)
|
|
||||||
REFERENCES public.dbuser (id)
|
|
||||||
NOT VALID;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE public.dbuserrole
|
|
||||||
ADD FOREIGN KEY (entity_id)
|
|
||||||
REFERENCES public.entity (id)
|
|
||||||
NOT VALID;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE public.employee
|
ALTER TABLE public.employee
|
21
db/docker-compose.yml
Normal file
21
db/docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
pg:
|
||||||
|
image: postgres:alpine
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./autoload:/docker-entrypoint-initdb.d
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: test
|
||||||
|
POSTGRES_USER: test
|
||||||
|
POSTGRES_PASSWORD: test
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8888:8080
|
BIN
db/swagger/favicon-16x16.png
Normal file
BIN
db/swagger/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 B |
BIN
db/swagger/favicon-32x32.png
Normal file
BIN
db/swagger/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 628 B |
60
db/swagger/index.html
Normal file
60
db/swagger/index.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!-- HTML for static distribution bundle build -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Swagger UI</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||||
|
<style>
|
||||||
|
html
|
||||||
|
{
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: -moz-scrollbars-vertical;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after
|
||||||
|
{
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
body
|
||||||
|
{
|
||||||
|
margin:0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
|
||||||
|
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
// Begin Swagger UI call region
|
||||||
|
const ui = SwaggerUIBundle({
|
||||||
|
url: "https://petstore.swagger.io/v2/swagger.json",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
});
|
||||||
|
// End Swagger UI call region
|
||||||
|
|
||||||
|
window.ui = ui;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
79
db/swagger/oauth2-redirect.html
Normal file
79
db/swagger/oauth2-redirect.html
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<head>
|
||||||
|
<title>Swagger UI: OAuth2 Redirect</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
function run () {
|
||||||
|
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||||
|
var sentState = oauth2.state;
|
||||||
|
var redirectUrl = oauth2.redirectUrl;
|
||||||
|
var isValid, qp, arr;
|
||||||
|
|
||||||
|
if (/code|token|error/.test(window.location.hash)) {
|
||||||
|
qp = window.location.hash.substring(1);
|
||||||
|
} else {
|
||||||
|
qp = location.search.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
arr = qp.split("&");
|
||||||
|
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
||||||
|
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||||
|
function (key, value) {
|
||||||
|
return key === "" ? value : decodeURIComponent(value);
|
||||||
|
}
|
||||||
|
) : {};
|
||||||
|
|
||||||
|
isValid = qp.state === sentState;
|
||||||
|
|
||||||
|
if ((
|
||||||
|
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||||
|
) && !oauth2.auth.code) {
|
||||||
|
if (!isValid) {
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "warning",
|
||||||
|
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qp.code) {
|
||||||
|
delete oauth2.state;
|
||||||
|
oauth2.auth.code = qp.code;
|
||||||
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
|
} else {
|
||||||
|
let oauthErrorMsg;
|
||||||
|
if (qp.error) {
|
||||||
|
oauthErrorMsg = "["+qp.error+"]: " +
|
||||||
|
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||||
|
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "error",
|
||||||
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState !== 'loading') {
|
||||||
|
run();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
run();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
3
db/swagger/swagger-ui-bundle.js
Normal file
3
db/swagger/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
db/swagger/swagger-ui-bundle.js.map
Normal file
1
db/swagger/swagger-ui-bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
2
db/swagger/swagger-ui-es-bundle-core.js
Normal file
2
db/swagger/swagger-ui-es-bundle-core.js
Normal file
File diff suppressed because one or more lines are too long
3
db/swagger/swagger-ui-es-bundle.js
Normal file
3
db/swagger/swagger-ui-es-bundle.js
Normal file
File diff suppressed because one or more lines are too long
3
db/swagger/swagger-ui-standalone-preset.js
Normal file
3
db/swagger/swagger-ui-standalone-preset.js
Normal file
File diff suppressed because one or more lines are too long
1
db/swagger/swagger-ui-standalone-preset.js.map
Normal file
1
db/swagger/swagger-ui-standalone-preset.js.map
Normal file
File diff suppressed because one or more lines are too long
4
db/swagger/swagger-ui.css
Normal file
4
db/swagger/swagger-ui.css
Normal file
File diff suppressed because one or more lines are too long
1
db/swagger/swagger-ui.css.map
Normal file
1
db/swagger/swagger-ui.css.map
Normal file
File diff suppressed because one or more lines are too long
2
db/swagger/swagger-ui.js
Normal file
2
db/swagger/swagger-ui.js
Normal file
File diff suppressed because one or more lines are too long
1
db/swagger/swagger-ui.js.map
Normal file
1
db/swagger/swagger-ui.js.map
Normal file
File diff suppressed because one or more lines are too long
54
go.mod
54
go.mod
@ -2,24 +2,48 @@ module sqldb-ws
|
|||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require github.com/beego/beego/v2 v2.0.2
|
require github.com/beego/beego/v2 v2.1.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
forge.redroom.link/yves/sqldb v0.0.0-20220520131204-4e17758e157e
|
forge.redroom.link/yves/sqldb v0.0.0-20230707071522-c362b6bc33d0
|
||||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a // indirect
|
||||||
github.com/lib/pq v1.10.6
|
github.com/aws/aws-lambda-go v1.13.3 // indirect
|
||||||
github.com/matthewhartstonge/argon2 v0.2.1
|
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||||
|
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec // indirect
|
||||||
|
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
|
||||||
|
github.com/hashicorp/go.net v0.0.1 // indirect
|
||||||
|
github.com/lib/pq v1.10.9
|
||||||
|
github.com/lightstep/lightstep-tracer-go v0.18.1 // indirect
|
||||||
|
github.com/matthewhartstonge/argon2 v0.3.3
|
||||||
|
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||||
|
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
|
||||||
|
github.com/mitchellh/gox v0.4.0 // indirect
|
||||||
|
github.com/mitchellh/iochan v1.0.0 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/nats-io/jwt v0.3.2 // indirect
|
||||||
|
github.com/oklog/oklog v0.3.2 // indirect
|
||||||
|
github.com/oklog/run v1.0.0 // indirect
|
||||||
|
github.com/opentracing/basictracer-go v1.0.0 // indirect
|
||||||
|
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5 // indirect
|
||||||
|
github.com/pact-foundation/pact-go v1.0.4 // indirect
|
||||||
|
github.com/pborman/uuid v1.2.0 // indirect
|
||||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
|
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
|
||||||
github.com/prometheus/client_golang v1.12.2 // indirect
|
github.com/performancecopilot/speed v3.0.0+incompatible // indirect
|
||||||
github.com/prometheus/common v0.34.0 // indirect
|
github.com/prometheus/client_golang v1.16.0 // indirect
|
||||||
github.com/rs/zerolog v1.26.1
|
github.com/prometheus/common v0.44.0 // indirect
|
||||||
|
github.com/prometheus/procfs v0.11.0 // indirect
|
||||||
|
github.com/rs/zerolog v1.29.1
|
||||||
|
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da // indirect
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
|
||||||
github.com/smartystreets/goconvey v1.6.4
|
github.com/smartystreets/goconvey v1.6.4
|
||||||
github.com/spf13/cast v1.5.0 // indirect
|
github.com/spf13/viper v1.16.0
|
||||||
github.com/spf13/viper v1.11.0
|
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 // indirect
|
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 // indirect
|
||||||
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
|
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect
|
||||||
golang.org/x/sys v0.0.0-20220519141025-dcacdad47464 // indirect
|
golang.org/x/net v0.12.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99 // indirect
|
golang.org/x/sys v0.10.0 // indirect
|
||||||
|
golang.org/x/text v0.11.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
|
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect
|
||||||
)
|
)
|
||||||
|
154
routers/commentsRouter.go
Normal file
154
routers/commentsRouter.go
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
package routers
|
||||||
|
|
||||||
|
import (
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
"github.com/beego/beego/v2/server/web/context/param"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:LoginController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:LoginController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "AddUser",
|
||||||
|
Router: `/adduser`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:LoginController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:LoginController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Login",
|
||||||
|
Router: `/login`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:LoginController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:LoginController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Logout",
|
||||||
|
Router: `/logout`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:SchemaController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:SchemaController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetTable",
|
||||||
|
Router: `/`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:SchemaController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:SchemaController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetSchema",
|
||||||
|
Router: `/:table`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Put",
|
||||||
|
Router: `/:table`,
|
||||||
|
AllowHTTPMethods: []string{"put"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Delete",
|
||||||
|
Router: `/:table`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAllTable",
|
||||||
|
Router: `/:table`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "TablePost",
|
||||||
|
Router: `/:table`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAllTableColumn",
|
||||||
|
Router: `/:table/:columns`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAllTableColumnRestriction",
|
||||||
|
Router: `/:table/:columns/:restriction`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAllTableColumnRestrictionSortkeys",
|
||||||
|
Router: `/:table/:columns/:restriction/:sortkeys`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:TableController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAllTableColumnRestrictionSortkeysDir",
|
||||||
|
Router: `/:table/:columns/:restriction/:sortkeys/:dir`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:UiController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:UiController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetEmptyForm",
|
||||||
|
Router: `/:fid`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:UiController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:UiController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetEditForm",
|
||||||
|
Router: `/:fid/:uid`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["sqldb-ws/controllers:UiController"] = append(beego.GlobalControllerRouter["sqldb-ws/controllers:UiController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "PostAccessForm",
|
||||||
|
Router: `/:uid`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
// @APIVersion 1.0.0
|
// @APIVersion 1.0.0
|
||||||
// @Title beego Test API
|
// @Title SqlDB WS API
|
||||||
// @Description beego has a very cool tools to autogenerate documents for your API
|
// @Description Generic database access API
|
||||||
// @Contact astaxie@gmail.com
|
// @Contact yves.cerezal@irt-saintexupery.com
|
||||||
// @TermsOfServiceUrl http://beego.me/
|
// @TermsOfServiceUrl https://www.irt-saintexupery.com/
|
||||||
// @License Apache 2.0
|
// @License Apache 2.0
|
||||||
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
package routers
|
package routers
|
||||||
@ -42,6 +42,11 @@ func init() {
|
|||||||
&controllers.LoginController{},
|
&controllers.LoginController{},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
beego.NSNamespace("/ui",
|
||||||
|
beego.NSInclude(
|
||||||
|
&controllers.UiController{},
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
beego.AddNamespace(ns)
|
beego.AddNamespace(ns)
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "beego Test API",
|
"title": "SqlDB WS API",
|
||||||
"description": "beego has a very cool tools to autogenerate documents for your API",
|
"description": "Generic database access API\n",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"termsOfService": "http://beego.me/",
|
"termsOfService": "https://www.irt-saintexupery.com/",
|
||||||
"contact": {
|
"contact": {
|
||||||
"email": "astaxie@gmail.com"
|
"email": "yves.cerezal@irt-saintexupery.com"
|
||||||
},
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"name": "Apache 2.0",
|
"name": "Apache 2.0",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"l"
|
"l"
|
||||||
],
|
],
|
||||||
"description": "Add user",
|
"description": "Add user\n\u003cbr\u003e",
|
||||||
"operationId": "LoginController.AddUser",
|
"operationId": "LoginController.AddUser",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"l"
|
"l"
|
||||||
],
|
],
|
||||||
"description": "User login",
|
"description": "User login\n\u003cbr\u003e",
|
||||||
"operationId": "LoginController.Login",
|
"operationId": "LoginController.Login",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"l"
|
"l"
|
||||||
],
|
],
|
||||||
"description": "Logs user",
|
"description": "Logs user\n\u003cbr\u003e",
|
||||||
"operationId": "LoginController.Logout",
|
"operationId": "LoginController.Logout",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
@ -101,7 +101,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"s"
|
"s"
|
||||||
],
|
],
|
||||||
"description": "get list table",
|
"description": "get list table\n\u003cbr\u003e",
|
||||||
"operationId": "SchemaController.GetTable",
|
"operationId": "SchemaController.GetTable",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
@ -118,7 +118,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"s"
|
"s"
|
||||||
],
|
],
|
||||||
"description": "get table schema",
|
"description": "get table schema\n\u003cbr\u003e",
|
||||||
"operationId": "SchemaController.GetSchema",
|
"operationId": "SchemaController.GetSchema",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -144,7 +144,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "get all Datas",
|
"description": "get all Datas\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.GetAllTable",
|
"operationId": "TableController.GetAllTable",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -168,7 +168,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "put data in table",
|
"description": "put data in table\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.Put data in table",
|
"operationId": "TableController.Put data in table",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "get all Datas",
|
"description": "get all Datas\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.TablePost",
|
"operationId": "TableController.TablePost",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -234,7 +234,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "delete the data in table",
|
"description": "delete the data in table\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.Delete",
|
"operationId": "TableController.Delete",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -268,7 +268,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "get all Datas",
|
"description": "get all Datas\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.GetAllTableColumn",
|
"operationId": "TableController.GetAllTableColumn",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -301,7 +301,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "get all Datas",
|
"description": "get all Datas\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.GetAllTableColumnRestriction",
|
"operationId": "TableController.GetAllTableColumnRestriction",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -341,7 +341,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "get all Datas",
|
"description": "get all Datas\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.GetAllTableColumnRestrictionSortkeys",
|
"operationId": "TableController.GetAllTableColumnRestrictionSortkeys",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -381,7 +381,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
"description": "get all Datas",
|
"description": "get all Datas\n\u003cbr\u003e",
|
||||||
"operationId": "TableController.GetAllTableColumnRestrictionSortkeysDir",
|
"operationId": "TableController.GetAllTableColumnRestrictionSortkeysDir",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@ -415,6 +415,99 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/ui/{fid}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"ui"
|
||||||
|
],
|
||||||
|
"description": "create access form\n\u003cbr\u003e",
|
||||||
|
"operationId": "UiController.form",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "fid",
|
||||||
|
"description": "The fid of the form",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "json form"
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "body is empty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/ui/{fid}/{uid}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"ui"
|
||||||
|
],
|
||||||
|
"description": "create access form\n\u003cbr\u003e",
|
||||||
|
"operationId": "UiController.form",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "fid",
|
||||||
|
"description": "The fid of the form",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "uid",
|
||||||
|
"description": "The uid you want to edit",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "json form"
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "body is empty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/ui/{uid}": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"ui"
|
||||||
|
],
|
||||||
|
"description": "insert access\n\u003cbr\u003e",
|
||||||
|
"operationId": "UiController.Access form data post",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "uid",
|
||||||
|
"description": "The uid you want to edit",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "body of jsonform data",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/form"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "json"
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "body is empty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
@ -426,6 +519,10 @@
|
|||||||
"title": "TableQuery",
|
"title": "TableQuery",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"form": {
|
||||||
|
"title": "form",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"json": {
|
"json": {
|
||||||
"title": "json",
|
"title": "json",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@ -447,6 +544,10 @@
|
|||||||
{
|
{
|
||||||
"name": "l",
|
"name": "l",
|
||||||
"description": "Operations about login\n"
|
"description": "Operations about login\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ui",
|
||||||
|
"description": "Operations about table\n"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
info:
|
info:
|
||||||
title: beego Test API
|
title: SqlDB WS API
|
||||||
description: beego has a very cool tools to autogenerate documents for your API
|
description: |
|
||||||
|
Generic database access API
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
termsOfService: http://beego.me/
|
termsOfService: https://www.irt-saintexupery.com/
|
||||||
contact:
|
contact:
|
||||||
email: astaxie@gmail.com
|
email: yves.cerezal@irt-saintexupery.com
|
||||||
license:
|
license:
|
||||||
name: Apache 2.0
|
name: Apache 2.0
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
@ -15,7 +16,9 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- l
|
- l
|
||||||
description: Add user
|
description: |-
|
||||||
|
Add user
|
||||||
|
<br>
|
||||||
operationId: LoginController.AddUser
|
operationId: LoginController.AddUser
|
||||||
parameters:
|
parameters:
|
||||||
- in: query
|
- in: query
|
||||||
@ -37,7 +40,9 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- l
|
- l
|
||||||
description: User login
|
description: |-
|
||||||
|
User login
|
||||||
|
<br>
|
||||||
operationId: LoginController.Login
|
operationId: LoginController.Login
|
||||||
parameters:
|
parameters:
|
||||||
- in: body
|
- in: body
|
||||||
@ -57,7 +62,9 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- l
|
- l
|
||||||
description: Logs user
|
description: |-
|
||||||
|
Logs user
|
||||||
|
<br>
|
||||||
operationId: LoginController.Logout
|
operationId: LoginController.Logout
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@ -68,7 +75,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- s
|
- s
|
||||||
description: get list table
|
description: |-
|
||||||
|
get list table
|
||||||
|
<br>
|
||||||
operationId: SchemaController.GetTable
|
operationId: SchemaController.GetTable
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@ -79,7 +88,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- s
|
- s
|
||||||
description: get table schema
|
description: |-
|
||||||
|
get table schema
|
||||||
|
<br>
|
||||||
operationId: SchemaController.GetSchema
|
operationId: SchemaController.GetSchema
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -96,7 +107,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: get all Datas
|
description: |-
|
||||||
|
get all Datas
|
||||||
|
<br>
|
||||||
operationId: TableController.GetAllTable
|
operationId: TableController.GetAllTable
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -112,7 +125,9 @@ paths:
|
|||||||
put:
|
put:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: put data in table
|
description: |-
|
||||||
|
put data in table
|
||||||
|
<br>
|
||||||
operationId: TableController.Put data in table
|
operationId: TableController.Put data in table
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -134,7 +149,9 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: get all Datas
|
description: |-
|
||||||
|
get all Datas
|
||||||
|
<br>
|
||||||
operationId: TableController.TablePost
|
operationId: TableController.TablePost
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -156,7 +173,9 @@ paths:
|
|||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: delete the data in table
|
description: |-
|
||||||
|
delete the data in table
|
||||||
|
<br>
|
||||||
operationId: TableController.Delete
|
operationId: TableController.Delete
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -178,7 +197,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: get all Datas
|
description: |-
|
||||||
|
get all Datas
|
||||||
|
<br>
|
||||||
operationId: TableController.GetAllTableColumn
|
operationId: TableController.GetAllTableColumn
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -200,7 +221,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: get all Datas
|
description: |-
|
||||||
|
get all Datas
|
||||||
|
<br>
|
||||||
operationId: TableController.GetAllTableColumnRestriction
|
operationId: TableController.GetAllTableColumnRestriction
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -227,7 +250,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: get all Datas
|
description: |-
|
||||||
|
get all Datas
|
||||||
|
<br>
|
||||||
operationId: TableController.GetAllTableColumnRestrictionSortkeys
|
operationId: TableController.GetAllTableColumnRestrictionSortkeys
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -254,7 +279,9 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- t
|
- t
|
||||||
description: get all Datas
|
description: |-
|
||||||
|
get all Datas
|
||||||
|
<br>
|
||||||
operationId: TableController.GetAllTableColumnRestrictionSortkeysDir
|
operationId: TableController.GetAllTableColumnRestrictionSortkeysDir
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
@ -277,6 +304,73 @@ paths:
|
|||||||
description: '{string} success !'
|
description: '{string} success !'
|
||||||
"403":
|
"403":
|
||||||
description: no table
|
description: no table
|
||||||
|
/ui/{fid}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- ui
|
||||||
|
description: |-
|
||||||
|
create access form
|
||||||
|
<br>
|
||||||
|
operationId: UiController.form
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: fid
|
||||||
|
description: The fid of the form
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: json form
|
||||||
|
"403":
|
||||||
|
description: body is empty
|
||||||
|
/ui/{fid}/{uid}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- ui
|
||||||
|
description: |-
|
||||||
|
create access form
|
||||||
|
<br>
|
||||||
|
operationId: UiController.form
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: fid
|
||||||
|
description: The fid of the form
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: uid
|
||||||
|
description: The uid you want to edit
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: json form
|
||||||
|
"403":
|
||||||
|
description: body is empty
|
||||||
|
/ui/{uid}:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- ui
|
||||||
|
description: |-
|
||||||
|
insert access
|
||||||
|
<br>
|
||||||
|
operationId: UiController.Access form data post
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: uid
|
||||||
|
description: The uid you want to edit
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: body of jsonform data
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/form'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: json
|
||||||
|
"403":
|
||||||
|
description: body is empty
|
||||||
definitions:
|
definitions:
|
||||||
Credential:
|
Credential:
|
||||||
title: Credential
|
title: Credential
|
||||||
@ -284,6 +378,9 @@ definitions:
|
|||||||
TableQuery:
|
TableQuery:
|
||||||
title: TableQuery
|
title: TableQuery
|
||||||
type: object
|
type: object
|
||||||
|
form:
|
||||||
|
title: form
|
||||||
|
type: object
|
||||||
json:
|
json:
|
||||||
title: json
|
title: json
|
||||||
type: object
|
type: object
|
||||||
@ -300,3 +397,6 @@ tags:
|
|||||||
- name: l
|
- name: l
|
||||||
description: |
|
description: |
|
||||||
Operations about login
|
Operations about login
|
||||||
|
- name: ui
|
||||||
|
description: |
|
||||||
|
Operations about table
|
||||||
|
Loading…
Reference in New Issue
Block a user