feat(cards): Implement endpoint for card generation

This commit is contained in:
2024-12-03 18:44:17 +01:00
parent ed4941b403
commit 7d22a32cb4
7 changed files with 250 additions and 10 deletions

View File

@@ -15,6 +15,33 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/cards": {
"post": {
"description": "Generate cards based on the provided data",
"consumes": [
"application/json"
],
"produces": [
"application/pdf"
],
"tags": [
"cards"
],
"summary": "Generate runner cards",
"parameters": [
{
"description": "Card data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CardRequest"
}
}
],
"responses": {}
}
},
"/contracts": {
"post": {
"description": "Generate a contract based on the provided data",
@@ -35,7 +62,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Contract"
"$ref": "#/definitions/models.ContractRequest"
}
}
],
@@ -44,7 +71,42 @@ const docTemplate = `{
}
},
"definitions": {
"models.Contract": {
"models.Card": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"runner": {
"$ref": "#/definitions/models.Runner"
}
}
},
"models.CardRequest": {
"type": "object",
"properties": {
"card": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Card"
}
},
"locale": {
"type": "string",
"enum": [
"en",
"de"
]
}
}
},
"models.ContractRequest": {
"type": "object",
"properties": {
"locale": {

View File

@@ -6,6 +6,33 @@
"contact": {}
},
"paths": {
"/cards": {
"post": {
"description": "Generate cards based on the provided data",
"consumes": [
"application/json"
],
"produces": [
"application/pdf"
],
"tags": [
"cards"
],
"summary": "Generate runner cards",
"parameters": [
{
"description": "Card data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CardRequest"
}
}
],
"responses": {}
}
},
"/contracts": {
"post": {
"description": "Generate a contract based on the provided data",
@@ -26,7 +53,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Contract"
"$ref": "#/definitions/models.ContractRequest"
}
}
],
@@ -35,7 +62,42 @@
}
},
"definitions": {
"models.Contract": {
"models.Card": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"runner": {
"$ref": "#/definitions/models.Runner"
}
}
},
"models.CardRequest": {
"type": "object",
"properties": {
"card": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Card"
}
},
"locale": {
"type": "string",
"enum": [
"en",
"de"
]
}
}
},
"models.ContractRequest": {
"type": "object",
"properties": {
"locale": {

View File

@@ -1,5 +1,28 @@
definitions:
models.Contract:
models.Card:
properties:
code:
type: string
enabled:
type: boolean
id:
type: integer
runner:
$ref: '#/definitions/models.Runner'
type: object
models.CardRequest:
properties:
card:
items:
$ref: '#/definitions/models.Card'
type: array
locale:
enum:
- en
- de
type: string
type: object
models.ContractRequest:
properties:
locale:
enum:
@@ -39,6 +62,24 @@ info:
for pdf generation.
title: LfK Document Server API
paths:
/cards:
post:
consumes:
- application/json
description: Generate cards based on the provided data
parameters:
- description: Card data
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.CardRequest'
produces:
- application/pdf
responses: {}
summary: Generate runner cards
tags:
- cards
/contracts:
post:
consumes:
@@ -50,7 +91,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/models.Contract'
$ref: '#/definitions/models.ContractRequest'
produces:
- application/pdf
responses: {}