feat(docs): First model for swagger
This commit is contained in:
parent
7d571ad46b
commit
13e9c88a8e
58
docs/docs.go
58
docs/docs.go
@ -28,9 +28,67 @@ const docTemplate = `{
|
|||||||
"contracts"
|
"contracts"
|
||||||
],
|
],
|
||||||
"summary": "Generate a contract",
|
"summary": "Generate a contract",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Contract data",
|
||||||
|
"name": "data",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Contract"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"models.Contract": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"runners": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Runner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.Group": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"parent_group": {
|
||||||
|
"$ref": "#/definitions/models.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.Runner": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"first_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"$ref": "#/definitions/models.Group"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"last_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"middle_name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
@ -19,8 +19,66 @@
|
|||||||
"contracts"
|
"contracts"
|
||||||
],
|
],
|
||||||
"summary": "Generate a contract",
|
"summary": "Generate a contract",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Contract data",
|
||||||
|
"name": "data",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Contract"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"models.Contract": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"runners": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Runner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.Group": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"parent_group": {
|
||||||
|
"$ref": "#/definitions/models.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.Runner": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"first_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"$ref": "#/definitions/models.Group"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"last_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"middle_name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,33 @@
|
|||||||
|
definitions:
|
||||||
|
models.Contract:
|
||||||
|
properties:
|
||||||
|
runners:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.Runner'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
models.Group:
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
parent_group:
|
||||||
|
$ref: '#/definitions/models.Group'
|
||||||
|
type: object
|
||||||
|
models.Runner:
|
||||||
|
properties:
|
||||||
|
first_name:
|
||||||
|
type: string
|
||||||
|
group:
|
||||||
|
$ref: '#/definitions/models.Group'
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
last_name:
|
||||||
|
type: string
|
||||||
|
middle_name:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
info:
|
info:
|
||||||
contact: {}
|
contact: {}
|
||||||
description: This is the API documentation for the LfK Document Server - a tool
|
description: This is the API documentation for the LfK Document Server - a tool
|
||||||
@ -9,6 +39,13 @@ paths:
|
|||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: Generate a contract based on the provided data
|
description: Generate a contract based on the provided data
|
||||||
|
parameters:
|
||||||
|
- description: Contract data
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.Contract'
|
||||||
produces:
|
produces:
|
||||||
- application/pdf
|
- application/pdf
|
||||||
responses: {}
|
responses: {}
|
||||||
|
@ -7,6 +7,7 @@ import "github.com/gofiber/fiber/v2"
|
|||||||
// @Description Generate a contract based on the provided data
|
// @Description Generate a contract based on the provided data
|
||||||
// @Tags contracts
|
// @Tags contracts
|
||||||
// @Accept json
|
// @Accept json
|
||||||
|
// @Param data body models.Contract true "Contract data"
|
||||||
// @Produce application/pdf
|
// @Produce application/pdf
|
||||||
// @Router /contracts [post]
|
// @Router /contracts [post]
|
||||||
func GenerateContract(c *fiber.Ctx) error {
|
func GenerateContract(c *fiber.Ctx) error {
|
||||||
|
19
models/contract.go
Normal file
19
models/contract.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Contract struct {
|
||||||
|
Runners []Runner `json:"runners"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Runner struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
FirstName string `json:"first_name"`
|
||||||
|
MiddleName string `json:"middle_name"`
|
||||||
|
LastName string `json:"last_name"`
|
||||||
|
Group Group `json:"group"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Group struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ParentGroup *Group `json:"parent_group"`
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user