add language api docs
This commit is contained in:
75
controllers/languageController.go
Normal file
75
controllers/languageController.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
_ "github.com/swaggo/swag/example/celler/httputil"
|
||||
|
||||
_ "git.dynamicdiscord.de/harakat/backend/models"
|
||||
)
|
||||
|
||||
// Register godoc
|
||||
// @Summary List all languages
|
||||
// @Tags lang
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} models.Language
|
||||
// @Failure 400 {object} httputil.HTTPError
|
||||
// @Router /lang/ [get]
|
||||
func (dc *DummyController) ListLanguages(c *gin.Context) {}
|
||||
|
||||
// Register godoc
|
||||
// @Summary Create a language
|
||||
// @Tags lang
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param lang body models.LanguageRequest true "language"
|
||||
// @Success 200 {object} models.Language
|
||||
// @Failure 400 {object} httputil.HTTPError
|
||||
// @Router /lang/ [post]
|
||||
func (dc *DummyController) CreateLanguage(c *gin.Context) {}
|
||||
|
||||
// Register godoc
|
||||
// @Summary Retreive a language
|
||||
// @Tags lang
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "A unique integer value identifying this language."
|
||||
// @Success 200 {object} models.Language
|
||||
// @Failure 400 {object} httputil.HTTPError
|
||||
// @Router /lang/{id} [get]
|
||||
func (dc *DummyController) RetreiveLanguage(c *gin.Context) {}
|
||||
|
||||
// Register godoc
|
||||
// @Summary Update an existing language
|
||||
// @Tags lang
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "A unique integer value identifying this language."
|
||||
// @Param lang body models.LanguageRequest true "updated language"
|
||||
// @Success 200 {object} models.Language
|
||||
// @Failure 400 {object} httputil.HTTPError
|
||||
// @Router /lang/{id} [put]
|
||||
func (dc *DummyController) UpdateLanguage(c *gin.Context) {}
|
||||
|
||||
// Register godoc
|
||||
// @Summary Partially update an existing language
|
||||
// @Tags lang
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "A unique integer value identifying this language."
|
||||
// @Param lang body models.LanguageRequest true "partially updated language"
|
||||
// @Success 200 {object} models.Language
|
||||
// @Failure 400 {object} httputil.HTTPError
|
||||
// @Router /lang/{id} [patch]
|
||||
func (dc *DummyController) PatchLanguage(c *gin.Context) {}
|
||||
|
||||
// Register godoc
|
||||
// @Summary Delete an existing language
|
||||
// @Tags lang
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "A unique integer value identifying this language."
|
||||
// @Success 200 {object} EmptyResponse
|
||||
// @Failure 400 {object} httputil.HTTPError
|
||||
// @Router /lang/{id} [delete]
|
||||
func (dc *DummyController) DeleteLanguage(c *gin.Context) {}
|
||||
853
docs/docs.go
853
docs/docs.go
@@ -24,6 +24,727 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/category/": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "List all categories",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Create a category",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "category",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/category/{id}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Retreive a category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Update an existing category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "updated category",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Delete an existing category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.EmptyResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Partially update an existing category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "partially updated category",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/category/{id}/translation": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "List all category translations",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Create a category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "category translation",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/category/{id}/translation/{id}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Retreive a category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Update an existing category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "updated category translation",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Delete an existing category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.EmptyResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Partially update an existing category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "partially updated category translation",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/lang/": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "List all languages",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Create a language",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "language",
|
||||
"name": "lang",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.LanguageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/lang/{id}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Retreive a language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Update an existing language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "updated language",
|
||||
"name": "lang",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.LanguageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Delete an existing language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.EmptyResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Partially update an existing language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "partially updated language",
|
||||
"name": "lang",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.LanguageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/login": {
|
||||
"post": {
|
||||
"description": "Login user",
|
||||
@@ -208,6 +929,18 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"gorm.DeletedAt": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"time": {
|
||||
"type": "string"
|
||||
},
|
||||
"valid": {
|
||||
"description": "Valid is true if Time is not NULL",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"httputil.HTTPError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -220,6 +953,126 @@ const docTemplate = `{
|
||||
"example": "status bad request"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Category": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"$ref": "#/definitions/gorm.DeletedAt"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"translations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.CategoryRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"translations"
|
||||
],
|
||||
"properties": {
|
||||
"translations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.CategoryTranslation": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"categoryID": {
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"$ref": "#/definitions/gorm.DeletedAt"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"languageID": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.CategoryTranslationRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"languageId",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"languageId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Language": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"$ref": "#/definitions/gorm.DeletedAt"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.LanguageRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
@@ -18,6 +18,727 @@
|
||||
"host": "localhost:8080",
|
||||
"basePath": "/api/v0",
|
||||
"paths": {
|
||||
"/category/": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "List all categories",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Create a category",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "category",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/category/{id}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Retreive a category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Update an existing category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "updated category",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Delete an existing category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.EmptyResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Partially update an existing category",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "partially updated category",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Category"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/category/{id}/translation": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "List all category translations",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Create a category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "category translation",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/category/{id}/translation/{id}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Retreive a category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Update an existing category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "updated category translation",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Delete an existing category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.EmptyResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"category"
|
||||
],
|
||||
"summary": "Partially update an existing category translation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this category.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying the category translation.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "partially updated category translation",
|
||||
"name": "category",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/lang/": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "List all languages",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Create a language",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "language",
|
||||
"name": "lang",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.LanguageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/lang/{id}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Retreive a language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Update an existing language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "updated language",
|
||||
"name": "lang",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.LanguageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Delete an existing language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.EmptyResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"lang"
|
||||
],
|
||||
"summary": "Partially update an existing language",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "A unique integer value identifying this language.",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "partially updated language",
|
||||
"name": "lang",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.LanguageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Language"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httputil.HTTPError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/login": {
|
||||
"post": {
|
||||
"description": "Login user",
|
||||
@@ -202,6 +923,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"gorm.DeletedAt": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"time": {
|
||||
"type": "string"
|
||||
},
|
||||
"valid": {
|
||||
"description": "Valid is true if Time is not NULL",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"httputil.HTTPError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -214,6 +947,126 @@
|
||||
"example": "status bad request"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Category": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"$ref": "#/definitions/gorm.DeletedAt"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"translations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.CategoryTranslation"
|
||||
}
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.CategoryRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"translations"
|
||||
],
|
||||
"properties": {
|
||||
"translations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.CategoryTranslationRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.CategoryTranslation": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"categoryID": {
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"$ref": "#/definitions/gorm.DeletedAt"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"languageID": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.CategoryTranslationRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"languageId",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"languageId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Language": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"$ref": "#/definitions/gorm.DeletedAt"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.LanguageRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
@@ -25,6 +25,14 @@ definitions:
|
||||
- name
|
||||
- password
|
||||
type: object
|
||||
gorm.DeletedAt:
|
||||
properties:
|
||||
time:
|
||||
type: string
|
||||
valid:
|
||||
description: Valid is true if Time is not NULL
|
||||
type: boolean
|
||||
type: object
|
||||
httputil.HTTPError:
|
||||
properties:
|
||||
code:
|
||||
@@ -34,6 +42,85 @@ definitions:
|
||||
example: status bad request
|
||||
type: string
|
||||
type: object
|
||||
models.Category:
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
deletedAt:
|
||||
$ref: '#/definitions/gorm.DeletedAt'
|
||||
id:
|
||||
type: integer
|
||||
translations:
|
||||
items:
|
||||
$ref: '#/definitions/models.CategoryTranslation'
|
||||
type: array
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
models.CategoryRequest:
|
||||
properties:
|
||||
translations:
|
||||
items:
|
||||
$ref: '#/definitions/models.CategoryTranslationRequest'
|
||||
type: array
|
||||
required:
|
||||
- translations
|
||||
type: object
|
||||
models.CategoryTranslation:
|
||||
properties:
|
||||
categoryID:
|
||||
type: integer
|
||||
createdAt:
|
||||
type: string
|
||||
deletedAt:
|
||||
$ref: '#/definitions/gorm.DeletedAt'
|
||||
id:
|
||||
type: integer
|
||||
languageID:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
models.CategoryTranslationRequest:
|
||||
properties:
|
||||
languageId:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- languageId
|
||||
- name
|
||||
type: object
|
||||
models.Language:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
createdAt:
|
||||
type: string
|
||||
deletedAt:
|
||||
$ref: '#/definitions/gorm.DeletedAt'
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- name
|
||||
type: object
|
||||
models.LanguageRequest:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- name
|
||||
type: object
|
||||
externalDocs:
|
||||
description: OpenAPI
|
||||
url: https://swagger.io/resources/open-api/
|
||||
@@ -51,6 +138,479 @@ info:
|
||||
title: Harakat Rest-API
|
||||
version: "0.1"
|
||||
paths:
|
||||
/category/:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.Category'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: List all categories
|
||||
tags:
|
||||
- category
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: category
|
||||
in: body
|
||||
name: category
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Category'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Create a category
|
||||
tags:
|
||||
- category
|
||||
/category/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.EmptyResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Delete an existing category
|
||||
tags:
|
||||
- category
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Category'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Retreive a category
|
||||
tags:
|
||||
- category
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: partially updated category
|
||||
in: body
|
||||
name: category
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Category'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Partially update an existing category
|
||||
tags:
|
||||
- category
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: updated category
|
||||
in: body
|
||||
name: category
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Category'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Update an existing category
|
||||
tags:
|
||||
- category
|
||||
/category/{id}/translation:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying the category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.CategoryTranslation'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: List all category translations
|
||||
tags:
|
||||
- category
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: category translation
|
||||
in: body
|
||||
name: category
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslation'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Create a category translation
|
||||
tags:
|
||||
- category
|
||||
/category/{id}/translation/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: A unique integer value identifying the category translation.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.EmptyResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Delete an existing category translation
|
||||
tags:
|
||||
- category
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying the category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: A unique integer value identifying the category translation.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslation'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Retreive a category translation
|
||||
tags:
|
||||
- category
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: A unique integer value identifying the category translation.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: partially updated category translation
|
||||
in: body
|
||||
name: category
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslation'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Partially update an existing category translation
|
||||
tags:
|
||||
- category
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this category.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: A unique integer value identifying the category translation.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: updated category translation
|
||||
in: body
|
||||
name: category
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.CategoryTranslation'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Update an existing category translation
|
||||
tags:
|
||||
- category
|
||||
/lang/:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.Language'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: List all languages
|
||||
tags:
|
||||
- lang
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: language
|
||||
in: body
|
||||
name: lang
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.LanguageRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Language'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Create a language
|
||||
tags:
|
||||
- lang
|
||||
/lang/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this language.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.EmptyResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Delete an existing language
|
||||
tags:
|
||||
- lang
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this language.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Language'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Retreive a language
|
||||
tags:
|
||||
- lang
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this language.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: partially updated language
|
||||
in: body
|
||||
name: lang
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.LanguageRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Language'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Partially update an existing language
|
||||
tags:
|
||||
- lang
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: A unique integer value identifying this language.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: updated language
|
||||
in: body
|
||||
name: lang
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.LanguageRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Language'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/httputil.HTTPError'
|
||||
summary: Update an existing language
|
||||
tags:
|
||||
- lang
|
||||
/user/login:
|
||||
post:
|
||||
consumes:
|
||||
|
||||
15
models/language.go
Normal file
15
models/language.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type LanguageRequest struct {
|
||||
Code string `gorm:"uniqueIndex;size:5;not null" json:"code" binding:"required"`
|
||||
Name string `gorm:"not null" json:"name" binding:"required"`
|
||||
}
|
||||
|
||||
type Language struct {
|
||||
gorm.Model
|
||||
LanguageRequest
|
||||
}
|
||||
Reference in New Issue
Block a user