Compare commits
79 Commits
145ebd8346
...
1.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
c09c00ec68
|
|||
|
1f4981b0a9
|
|||
|
c9f28612be
|
|||
|
c2d192d8a3
|
|||
|
31734596f6
|
|||
|
850fa0a760
|
|||
|
1c0a9860fa
|
|||
|
7c32f1aad2
|
|||
|
b9e550d6f5
|
|||
|
2a4f126377
|
|||
|
5c932158e9
|
|||
|
1296c9e399
|
|||
|
0f2452eca0
|
|||
|
b6cc98a165
|
|||
|
c5da33f10f
|
|||
|
69f4de6739
|
|||
|
649ac2a3c2
|
|||
|
5587fdaaa8
|
|||
|
8f676f08a9
|
|||
| 28de60d375 | |||
|
d19029b5ad
|
|||
|
1dfd96869d
|
|||
|
a1ba28cacb
|
|||
|
d2bace87af
|
|||
|
9d507b9572
|
|||
|
e89c17806f
|
|||
|
924f76a100
|
|||
|
99ec0933ea
|
|||
|
cceca7f5e1
|
|||
|
54d294a8b4
|
|||
|
41291b9200
|
|||
|
4faf76a073
|
|||
|
715eb8e1cb
|
|||
|
2686bee1d1
|
|||
|
57a3777891
|
|||
|
f6dc33edb4
|
|||
|
e2cd445aeb
|
|||
|
f5debf58fc
|
|||
|
11a9b51197
|
|||
|
c5dc4f7e79
|
|||
|
f9f30e96c7
|
|||
|
eff3354867
|
|||
|
2bfff006ed
|
|||
|
53eab5db94
|
|||
|
af73b35b18
|
|||
|
692f378eab
|
|||
|
12f61e373f
|
|||
|
79a0062f60
|
|||
|
561e7151c6
|
|||
|
2108c88001
|
|||
|
2537235ce6
|
|||
|
4deda8adf1
|
|||
|
d910a722df
|
|||
|
e10448f1e3
|
|||
|
f880e9f10c
|
|||
|
b179541532
|
|||
|
5098d27ae9
|
|||
|
d8fb9ea2fd
|
|||
|
5dbe7816cd
|
|||
|
1657a10dec
|
|||
|
7d22a32cb4
|
|||
|
ed4941b403
|
|||
|
c227c291c9
|
|||
|
389922f22d
|
|||
|
670290b60b
|
|||
|
3345571bd8
|
|||
|
d51e78a442
|
|||
|
bd70ac4542
|
|||
|
62f04f7d1c
|
|||
|
8812bf2410
|
|||
|
323c0b0ff9
|
|||
|
e9c28efd47
|
|||
|
e5f9eff54f
|
|||
|
382a799038
|
|||
|
f4f5c8b63a
|
|||
|
c0dd30f08c
|
|||
|
3eb914d640
|
|||
|
ba7e02fa30
|
|||
|
56e09dafb9
|
46
.air.linux.toml
Normal file
46
.air.linux.toml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
root = "."
|
||||||
|
testdata_dir = "testdata"
|
||||||
|
tmp_dir = "tmp"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
args_bin = []
|
||||||
|
bin = "tmp\\main"
|
||||||
|
cmd = "go build -o ./tmp/main ."
|
||||||
|
delay = 1000
|
||||||
|
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = ["_test.go"]
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
full_bin = ""
|
||||||
|
include_dir = []
|
||||||
|
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||||
|
include_file = []
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
poll = false
|
||||||
|
poll_interval = 0
|
||||||
|
post_cmd = []
|
||||||
|
pre_cmd = []
|
||||||
|
rerun = false
|
||||||
|
rerun_delay = 500
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = false
|
||||||
|
|
||||||
|
[color]
|
||||||
|
app = ""
|
||||||
|
build = "yellow"
|
||||||
|
main = "magenta"
|
||||||
|
runner = "green"
|
||||||
|
watcher = "cyan"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
main_only = false
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = false
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
|
keep_scroll = true
|
||||||
46
.air.windows.toml
Normal file
46
.air.windows.toml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
root = "."
|
||||||
|
testdata_dir = "testdata"
|
||||||
|
tmp_dir = "tmp"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
args_bin = []
|
||||||
|
bin = "tmp\\main.exe"
|
||||||
|
cmd = "go build -o ./tmp/main.exe ."
|
||||||
|
delay = 1000
|
||||||
|
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = ["_test.go"]
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
full_bin = ""
|
||||||
|
include_dir = []
|
||||||
|
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||||
|
include_file = []
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
poll = false
|
||||||
|
poll_interval = 0
|
||||||
|
post_cmd = []
|
||||||
|
pre_cmd = []
|
||||||
|
rerun = false
|
||||||
|
rerun_delay = 500
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = false
|
||||||
|
|
||||||
|
[color]
|
||||||
|
app = ""
|
||||||
|
build = "yellow"
|
||||||
|
main = "magenta"
|
||||||
|
runner = "green"
|
||||||
|
watcher = "cyan"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
main_only = false
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = false
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
|
keep_scroll = true
|
||||||
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
tmp
|
||||||
|
docker-compose.yaml
|
||||||
|
.air*.toml
|
||||||
18
.env
Normal file
18
.env
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
PORT=3000
|
||||||
|
PRODUCION=false
|
||||||
|
APIKEY=lfk
|
||||||
|
EVENTNAME=Lauf für Kaya! 2025
|
||||||
|
CURRENCYSYMBOL=€
|
||||||
|
GOTENBERG_BASEURL=http://localhost:3001
|
||||||
|
REDIS_ADDR=localhost:6379
|
||||||
|
|
||||||
|
CARD_SUBTITLE=Kaya ist cool
|
||||||
|
CARD_BARCODEFORMAT=ean13
|
||||||
|
# CARD_BARCODEPREFIX=
|
||||||
|
|
||||||
|
SPONSOING_RECEIPTMINIMUM=10
|
||||||
|
SPONSORING_DISCLAIMER=Kaya ist cool, aber pass auf, dass du nicht zu viel Geld sammelst!
|
||||||
|
SPONSORING_BARCODEFORMAT=code128
|
||||||
|
# SPONSORING_BARCODEPREFIX=
|
||||||
|
|
||||||
|
CERTIFICATE_FOOTER=Kaya ist cool, danke für deine Unterstützung!
|
||||||
18
.woodpecker/build.yml
Normal file
18
.woodpecker/build.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
steps:
|
||||||
|
- name: build latest
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
repo: registry.odit.services/lfk/document-server
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
registry: registry.odit.services
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
cache_from: registry.odit.services/lfk/document-server:latest
|
||||||
|
username:
|
||||||
|
from_secret: odit-registry-builder-username
|
||||||
|
password:
|
||||||
|
from_secret: odit-registry-builder-password
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
17
.woodpecker/release.yml
Normal file
17
.woodpecker/release.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
steps:
|
||||||
|
- name: build tag
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
repo: registry.odit.services/lfk/document-server
|
||||||
|
tags:
|
||||||
|
- "${CI_COMMIT_TAG}"
|
||||||
|
registry: registry.odit.services
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
cache_from: registry.odit.services/lfk/document-server:latest
|
||||||
|
username:
|
||||||
|
from_secret: odit-registry-builder-username
|
||||||
|
password:
|
||||||
|
from_secret: odit-registry-builder-password
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM golang:1.23-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -o server
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=builder /app/server /server
|
||||||
|
COPY static /static
|
||||||
|
ADD https://curl.haxx.se/ca/cacert.pem /etc/ssl/certs/ca-certificates.crt
|
||||||
|
ENTRYPOINT [ "/server" ]
|
||||||
73
README.md
73
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- 📝 HTML pdf templates
|
- 📝 HTML templates for pdf generation
|
||||||
- 📚 OpenAPI/Swagger documentation
|
- 📚 OpenAPI/Swagger documentation
|
||||||
- ⚡ High-performance with go and gotenberg
|
- ⚡ High-performance with go and gotenberg
|
||||||
|
|
||||||
@@ -12,9 +12,6 @@
|
|||||||
# Install dependencies
|
# Install dependencies
|
||||||
go mod download
|
go mod download
|
||||||
|
|
||||||
# Generate the swagger docs
|
|
||||||
swag init
|
|
||||||
|
|
||||||
# Run the server
|
# Run the server
|
||||||
air
|
air
|
||||||
```
|
```
|
||||||
@@ -29,3 +26,71 @@ The project uses:
|
|||||||
|
|
||||||
- 🏃♂️ go as the language and build tool
|
- 🏃♂️ go as the language and build tool
|
||||||
- 🌐 gofiber for the web framework
|
- 🌐 gofiber for the web framework
|
||||||
|
- 📦 air for live reload
|
||||||
|
- 📝 swaggo for API documentation
|
||||||
|
- 📄 gotenberg for HTML to PDF conversion
|
||||||
|
|
||||||
|
### 📦 Use docker compose for external dependencies
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker compose -f docker-compose.dev.yaml up
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🏃 Run via air
|
||||||
|
|
||||||
|
> Install air via `go install github.com/air-verse/air@latest`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# With the default air config
|
||||||
|
air
|
||||||
|
|
||||||
|
# With the config for linux/macOS
|
||||||
|
air -c .air.linux.toml
|
||||||
|
|
||||||
|
# With the config for windows
|
||||||
|
air -c .air.windows.toml
|
||||||
|
```
|
||||||
|
|
||||||
|
### ✒️ Update the swagger docs
|
||||||
|
|
||||||
|
> Install swag via `go install github.com/swaggo/swag/cmd/swag@latest`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
swag init
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🐋 Build container
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# single arch
|
||||||
|
docker build -t registry.odit.services/lfk/document-server:latest .
|
||||||
|
|
||||||
|
# multiarch
|
||||||
|
docker buildx build --platform=linux/amd64,linux/arm64 -t registry.odit.services/lfk/document-server:latest --push .
|
||||||
|
```
|
||||||
|
|
||||||
|
## ⏱️ Benchmarks
|
||||||
|
|
||||||
|
### Barcode Generation
|
||||||
|
|
||||||
|
- Requests: 10000
|
||||||
|
- Concurrency: Unlimited
|
||||||
|
- Data: `123456789123`
|
||||||
|
- Width: 1000
|
||||||
|
- Height: 500
|
||||||
|
|
||||||
|
#### No cache (cold start)
|
||||||
|
|
||||||
|
| Format | Data | Requests/sec | Slowest | Fastest | Average |
|
||||||
|
| ------- | -------------- | ------------ | ------- | ------- | ------- |
|
||||||
|
| Code128 | `123456789123` | 763.3996 | 0.7995 | 0.0172 | 0.0654 |
|
||||||
|
| EAN13 | `123456789123` | 767.1170 | 0.7607 | 0.0171 | 0.0651 |
|
||||||
|
| QR | `123456789123` | 683.8472 | 0.6528 | 0.0178 | 0.0730 |
|
||||||
|
|
||||||
|
#### Redis cache (warm start)
|
||||||
|
|
||||||
|
| Format | Data | Requests/sec | Slowest | Fastest | Average |
|
||||||
|
| ------- | -------------- | ------------ | ------- | ------- | ------- |
|
||||||
|
| Code128 | `123456789123` | 15611.5521 | 0.0965 | 0.0006 | 0.0032 |
|
||||||
|
| EAN13 | `123456789123` | 14985.4401 | 0.0925 | 0.0006 | 0.0033 |
|
||||||
|
| QR | `123456789123` | 14306.2540 | 0.1143 | 0.0005 | 0.0035 |
|
||||||
9
docker-compose.dev.yaml
Normal file
9
docker-compose.dev.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
gotenberg:
|
||||||
|
image: gotenberg/gotenberg:8
|
||||||
|
ports:
|
||||||
|
- "3001:3000"
|
||||||
|
redis:
|
||||||
|
image: docker.dragonflydb.io/dragonflydb/dragonfly
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
15
docker-compose.yaml
Normal file
15
docker-compose.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
services:
|
||||||
|
document-server:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
volumes:
|
||||||
|
- ./docker.env:/.env
|
||||||
|
gotenberg:
|
||||||
|
image: gotenberg/gotenberg:8
|
||||||
|
ports:
|
||||||
|
- "3001:3000"
|
||||||
|
redis:
|
||||||
|
image: docker.dragonflydb.io/dragonflydb/dragonfly
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
18
docker.env
Normal file
18
docker.env
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
PORT=3000
|
||||||
|
PRODUCION=false
|
||||||
|
APIKEY=lfk
|
||||||
|
EVENTNAME=Lauf für Kaya! 2025
|
||||||
|
CURRENCYSYMBOL=€
|
||||||
|
GOTENBERG_BASEURL=http://gotenberg:3000
|
||||||
|
REDIS_ADDR=redis:6379
|
||||||
|
|
||||||
|
CARD_SUBTITLE=Kaya ist cool
|
||||||
|
CARD_BARCODEFORMAT=ean13
|
||||||
|
# CARD_BARCODEPREFIX=
|
||||||
|
|
||||||
|
SPONSOING_RECEIPTMINIMUM=10
|
||||||
|
SPONSORING_DISCLAIMER=Kaya ist cool, aber pass auf, dass du nicht zu viel Geld sammelst!
|
||||||
|
SPONSORING_BARCODEFORMAT=code128
|
||||||
|
# SPONSORING_BARCODEPREFIX=
|
||||||
|
|
||||||
|
CERTIFICATE_FOOTER=Kaya ist cool, danke für deine Unterstützung!
|
||||||
323
docs/docs.go
323
docs/docs.go
@@ -9,14 +9,143 @@ const docTemplate = `{
|
|||||||
"info": {
|
"info": {
|
||||||
"description": "{{escape .Description}}",
|
"description": "{{escape .Description}}",
|
||||||
"title": "{{.Title}}",
|
"title": "{{.Title}}",
|
||||||
"contact": {},
|
"termsOfService": "https://lauf-fuer-kaya.de/datenschutz",
|
||||||
|
"contact": {
|
||||||
|
"name": "ODIT.Services UG (haftungsbeschränkt)",
|
||||||
|
"url": "https://odit.services",
|
||||||
|
"email": "info@odit.services"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "CC BY-NC-SA 4.0"
|
||||||
|
},
|
||||||
"version": "{{.Version}}"
|
"version": "{{.Version}}"
|
||||||
},
|
},
|
||||||
"host": "{{.Host}}",
|
"host": "{{.Host}}",
|
||||||
"basePath": "{{.BasePath}}",
|
"basePath": "{{.BasePath}}",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/contracts": {
|
"/v1/barcodes/{type}/{content}": {
|
||||||
|
"get": {
|
||||||
|
"description": "Generate barcodes based on the provided data",
|
||||||
|
"produces": [
|
||||||
|
"image/png"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"barcodes"
|
||||||
|
],
|
||||||
|
"summary": "Generate barcodes",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"ean13",
|
||||||
|
"code128"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "Barcode type",
|
||||||
|
"name": "type",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minLength": 1,
|
||||||
|
"type": "string",
|
||||||
|
"description": "Barcode content",
|
||||||
|
"name": "content",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 10000,
|
||||||
|
"minimum": 1,
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1000,
|
||||||
|
"description": "Barcode width",
|
||||||
|
"name": "width",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 10000,
|
||||||
|
"minimum": 1,
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1000,
|
||||||
|
"description": "Barcode height",
|
||||||
|
"name": "height",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/pdfs/cards": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generate cards based on the provided data",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/pdf"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"pdfs"
|
||||||
|
],
|
||||||
|
"summary": "Generate runner cards",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Card data",
|
||||||
|
"name": "data",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.CardRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/pdfs/certificates": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generate certificates based on the provided data",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/pdf"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"pdfs"
|
||||||
|
],
|
||||||
|
"summary": "Generate runner certificates",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Certificate data",
|
||||||
|
"name": "data",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.CertificateRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/pdfs/contracts": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
"description": "Generate a contract based on the provided data",
|
"description": "Generate a contract based on the provided data",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
@@ -25,7 +154,7 @@ const docTemplate = `{
|
|||||||
"application/pdf"
|
"application/pdf"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"contracts"
|
"pdfs"
|
||||||
],
|
],
|
||||||
"summary": "Generate a contract",
|
"summary": "Generate a contract",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -35,7 +164,7 @@ const docTemplate = `{
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/models.Contract"
|
"$ref": "#/definitions/models.ContractRequest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -44,9 +173,87 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"models.Contract": {
|
"models.Card": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"code",
|
||||||
|
"id",
|
||||||
|
"runner"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"runner": {
|
||||||
|
"$ref": "#/definitions/models.Runner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.CardRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cards",
|
||||||
|
"locale"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"cards": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Card"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locale": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"de"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.CertificateRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"locale": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"de"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"runners": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.RunnerWithDonations"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.ContractRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"locale": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"de"
|
||||||
|
]
|
||||||
|
},
|
||||||
"runners": {
|
"runners": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@@ -55,8 +262,59 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.DistanceDonation": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"amount_per_distance",
|
||||||
|
"donor",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"amount": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"amount_per_distance": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"donor": {
|
||||||
|
"$ref": "#/definitions/models.Donor"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"paid_amount": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.Donor": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"first_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"last_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"middle_name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.Group": {
|
"models.Group": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -71,6 +329,12 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.Runner": {
|
"models.Runner": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"first_name": {
|
"first_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -88,6 +352,55 @@ const docTemplate = `{
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"models.RunnerWithDonations": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"distance",
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"distance": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"distance_donations": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.DistanceDonation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"first_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"$ref": "#/definitions/models.Group"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"last_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"middle_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"total_donations": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total_per_distance": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securityDefinitions": {
|
||||||
|
"ApiKeyAuth": {
|
||||||
|
"type": "apiKey",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|||||||
@@ -3,11 +3,140 @@
|
|||||||
"info": {
|
"info": {
|
||||||
"description": "This is the API documentation for the LfK Document Server - a tool for pdf generation.",
|
"description": "This is the API documentation for the LfK Document Server - a tool for pdf generation.",
|
||||||
"title": "LfK Document Server API",
|
"title": "LfK Document Server API",
|
||||||
"contact": {}
|
"termsOfService": "https://lauf-fuer-kaya.de/datenschutz",
|
||||||
|
"contact": {
|
||||||
|
"name": "ODIT.Services UG (haftungsbeschränkt)",
|
||||||
|
"url": "https://odit.services",
|
||||||
|
"email": "info@odit.services"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "CC BY-NC-SA 4.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"paths": {
|
"paths": {
|
||||||
"/contracts": {
|
"/v1/barcodes/{type}/{content}": {
|
||||||
|
"get": {
|
||||||
|
"description": "Generate barcodes based on the provided data",
|
||||||
|
"produces": [
|
||||||
|
"image/png"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"barcodes"
|
||||||
|
],
|
||||||
|
"summary": "Generate barcodes",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"ean13",
|
||||||
|
"code128"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "Barcode type",
|
||||||
|
"name": "type",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minLength": 1,
|
||||||
|
"type": "string",
|
||||||
|
"description": "Barcode content",
|
||||||
|
"name": "content",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 10000,
|
||||||
|
"minimum": 1,
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1000,
|
||||||
|
"description": "Barcode width",
|
||||||
|
"name": "width",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 10000,
|
||||||
|
"minimum": 1,
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1000,
|
||||||
|
"description": "Barcode height",
|
||||||
|
"name": "height",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/pdfs/cards": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generate cards based on the provided data",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/pdf"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"pdfs"
|
||||||
|
],
|
||||||
|
"summary": "Generate runner cards",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Card data",
|
||||||
|
"name": "data",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.CardRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/pdfs/certificates": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generate certificates based on the provided data",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/pdf"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"pdfs"
|
||||||
|
],
|
||||||
|
"summary": "Generate runner certificates",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Certificate data",
|
||||||
|
"name": "data",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.CertificateRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/pdfs/contracts": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
"description": "Generate a contract based on the provided data",
|
"description": "Generate a contract based on the provided data",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
@@ -16,7 +145,7 @@
|
|||||||
"application/pdf"
|
"application/pdf"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"contracts"
|
"pdfs"
|
||||||
],
|
],
|
||||||
"summary": "Generate a contract",
|
"summary": "Generate a contract",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -26,7 +155,7 @@
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/models.Contract"
|
"$ref": "#/definitions/models.ContractRequest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -35,9 +164,87 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"models.Contract": {
|
"models.Card": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"code",
|
||||||
|
"id",
|
||||||
|
"runner"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"runner": {
|
||||||
|
"$ref": "#/definitions/models.Runner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.CardRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cards",
|
||||||
|
"locale"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"cards": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Card"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locale": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"de"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.CertificateRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"locale": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"de"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"runners": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.RunnerWithDonations"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.ContractRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"locale": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"de"
|
||||||
|
]
|
||||||
|
},
|
||||||
"runners": {
|
"runners": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@@ -46,8 +253,59 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"models.DistanceDonation": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"amount_per_distance",
|
||||||
|
"donor",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"amount": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"amount_per_distance": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"donor": {
|
||||||
|
"$ref": "#/definitions/models.Donor"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"paid_amount": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models.Donor": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"first_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"last_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"middle_name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"models.Group": {
|
"models.Group": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -62,6 +320,12 @@
|
|||||||
},
|
},
|
||||||
"models.Runner": {
|
"models.Runner": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"first_name": {
|
"first_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -79,6 +343,55 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"models.RunnerWithDonations": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"distance",
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"distance": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"distance_donations": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.DistanceDonation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"first_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"$ref": "#/definitions/models.Group"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"last_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"middle_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"total_donations": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total_per_distance": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securityDefinitions": {
|
||||||
|
"ApiKeyAuth": {
|
||||||
|
"type": "apiKey",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,96 @@
|
|||||||
definitions:
|
definitions:
|
||||||
models.Contract:
|
models.Card:
|
||||||
properties:
|
properties:
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
enabled:
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
runner:
|
||||||
|
$ref: '#/definitions/models.Runner'
|
||||||
|
required:
|
||||||
|
- code
|
||||||
|
- id
|
||||||
|
- runner
|
||||||
|
type: object
|
||||||
|
models.CardRequest:
|
||||||
|
properties:
|
||||||
|
cards:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.Card'
|
||||||
|
type: array
|
||||||
|
locale:
|
||||||
|
enum:
|
||||||
|
- en
|
||||||
|
- de
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- cards
|
||||||
|
- locale
|
||||||
|
type: object
|
||||||
|
models.CertificateRequest:
|
||||||
|
properties:
|
||||||
|
locale:
|
||||||
|
enum:
|
||||||
|
- en
|
||||||
|
- de
|
||||||
|
type: string
|
||||||
|
runners:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.RunnerWithDonations'
|
||||||
|
type: array
|
||||||
|
required:
|
||||||
|
- locale
|
||||||
|
- runners
|
||||||
|
type: object
|
||||||
|
models.ContractRequest:
|
||||||
|
properties:
|
||||||
|
locale:
|
||||||
|
enum:
|
||||||
|
- en
|
||||||
|
- de
|
||||||
|
type: string
|
||||||
runners:
|
runners:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Runner'
|
$ref: '#/definitions/models.Runner'
|
||||||
type: array
|
type: array
|
||||||
|
required:
|
||||||
|
- locale
|
||||||
|
- runners
|
||||||
|
type: object
|
||||||
|
models.DistanceDonation:
|
||||||
|
properties:
|
||||||
|
amount:
|
||||||
|
type: integer
|
||||||
|
amount_per_distance:
|
||||||
|
type: integer
|
||||||
|
donor:
|
||||||
|
$ref: '#/definitions/models.Donor'
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
paid_amount:
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- amount_per_distance
|
||||||
|
- donor
|
||||||
|
- id
|
||||||
|
type: object
|
||||||
|
models.Donor:
|
||||||
|
properties:
|
||||||
|
first_name:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
last_name:
|
||||||
|
type: string
|
||||||
|
middle_name:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- first_name
|
||||||
|
- id
|
||||||
|
- last_name
|
||||||
type: object
|
type: object
|
||||||
models.Group:
|
models.Group:
|
||||||
properties:
|
properties:
|
||||||
@@ -14,6 +100,9 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
parent_group:
|
parent_group:
|
||||||
$ref: '#/definitions/models.Group'
|
$ref: '#/definitions/models.Group'
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- name
|
||||||
type: object
|
type: object
|
||||||
models.Runner:
|
models.Runner:
|
||||||
properties:
|
properties:
|
||||||
@@ -27,14 +116,132 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
middle_name:
|
middle_name:
|
||||||
type: string
|
type: string
|
||||||
|
required:
|
||||||
|
- first_name
|
||||||
|
- group
|
||||||
|
- id
|
||||||
|
- last_name
|
||||||
|
type: object
|
||||||
|
models.RunnerWithDonations:
|
||||||
|
properties:
|
||||||
|
distance:
|
||||||
|
type: integer
|
||||||
|
distance_donations:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.DistanceDonation'
|
||||||
|
type: array
|
||||||
|
first_name:
|
||||||
|
type: string
|
||||||
|
group:
|
||||||
|
$ref: '#/definitions/models.Group'
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
last_name:
|
||||||
|
type: string
|
||||||
|
middle_name:
|
||||||
|
type: string
|
||||||
|
total_donations:
|
||||||
|
type: integer
|
||||||
|
total_per_distance:
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- distance
|
||||||
|
- first_name
|
||||||
|
- group
|
||||||
|
- id
|
||||||
|
- last_name
|
||||||
type: object
|
type: object
|
||||||
info:
|
info:
|
||||||
contact: {}
|
contact:
|
||||||
|
email: info@odit.services
|
||||||
|
name: ODIT.Services UG (haftungsbeschränkt)
|
||||||
|
url: https://odit.services
|
||||||
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
|
||||||
for pdf generation.
|
for pdf generation.
|
||||||
|
license:
|
||||||
|
name: CC BY-NC-SA 4.0
|
||||||
|
termsOfService: https://lauf-fuer-kaya.de/datenschutz
|
||||||
title: LfK Document Server API
|
title: LfK Document Server API
|
||||||
paths:
|
paths:
|
||||||
/contracts:
|
/v1/barcodes/{type}/{content}:
|
||||||
|
get:
|
||||||
|
description: Generate barcodes based on the provided data
|
||||||
|
parameters:
|
||||||
|
- description: Barcode type
|
||||||
|
enum:
|
||||||
|
- ean13
|
||||||
|
- code128
|
||||||
|
in: path
|
||||||
|
name: type
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Barcode content
|
||||||
|
in: path
|
||||||
|
minLength: 1
|
||||||
|
name: content
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- default: 1000
|
||||||
|
description: Barcode width
|
||||||
|
in: query
|
||||||
|
maximum: 10000
|
||||||
|
minimum: 1
|
||||||
|
name: width
|
||||||
|
type: integer
|
||||||
|
- default: 1000
|
||||||
|
description: Barcode height
|
||||||
|
in: query
|
||||||
|
maximum: 10000
|
||||||
|
minimum: 1
|
||||||
|
name: height
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- image/png
|
||||||
|
responses: {}
|
||||||
|
summary: Generate barcodes
|
||||||
|
tags:
|
||||||
|
- barcodes
|
||||||
|
/v1/pdfs/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: {}
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Generate runner cards
|
||||||
|
tags:
|
||||||
|
- pdfs
|
||||||
|
/v1/pdfs/certificates:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Generate certificates based on the provided data
|
||||||
|
parameters:
|
||||||
|
- description: Certificate data
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.CertificateRequest'
|
||||||
|
produces:
|
||||||
|
- application/pdf
|
||||||
|
responses: {}
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Generate runner certificates
|
||||||
|
tags:
|
||||||
|
- pdfs
|
||||||
|
/v1/pdfs/contracts:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -45,11 +252,18 @@ paths:
|
|||||||
name: data
|
name: data
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.Contract'
|
$ref: '#/definitions/models.ContractRequest'
|
||||||
produces:
|
produces:
|
||||||
- application/pdf
|
- application/pdf
|
||||||
responses: {}
|
responses: {}
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
summary: Generate a contract
|
summary: Generate a contract
|
||||||
tags:
|
tags:
|
||||||
- contracts
|
- pdfs
|
||||||
|
securityDefinitions:
|
||||||
|
ApiKeyAuth:
|
||||||
|
in: query
|
||||||
|
name: key
|
||||||
|
type: apiKey
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
|
|||||||
43
go.mod
43
go.mod
@@ -1,35 +1,60 @@
|
|||||||
module git.odit.services/lfk/document-server
|
module git.odit.services/lfk/document-server
|
||||||
|
|
||||||
go 1.22.1
|
go 1.23.2
|
||||||
|
|
||||||
|
toolchain go1.23.3
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/gofiber/fiber/v2 v2.52.5
|
||||||
|
github.com/gofiber/swagger v1.1.0
|
||||||
|
github.com/swaggo/swag v1.16.4
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||||
github.com/PuerkitoBio/purell v1.2.1 // indirect
|
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
|
||||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||||
|
github.com/boombuler/barcode v1.0.2 // indirect
|
||||||
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
|
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||||
github.com/go-openapi/spec v0.21.0 // indirect
|
github.com/go-openapi/spec v0.21.0 // indirect
|
||||||
github.com/go-openapi/swag v0.23.0 // indirect
|
github.com/go-openapi/swag v0.23.0 // indirect
|
||||||
github.com/gofiber/fiber/v2 v2.52.5 // indirect
|
|
||||||
github.com/gofiber/swagger v1.1.0 // indirect
|
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.11 // indirect
|
github.com/klauspost/compress v1.17.11 // indirect
|
||||||
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.7.7 // indirect
|
||||||
|
github.com/makiuchi-d/gozxing v0.1.1 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/oxplot/papersizes v0.0.0-20181201065918-90a3a5ae1915 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||||
|
github.com/redis/go-redis/v9 v9.7.0 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
|
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||||
|
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||||
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
|
github.com/spf13/afero v1.11.0 // indirect
|
||||||
|
github.com/spf13/cast v1.6.0 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
|
github.com/spf13/viper v1.19.0 // indirect
|
||||||
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
github.com/swaggo/files/v2 v2.0.1 // indirect
|
github.com/swaggo/files/v2 v2.0.1 // indirect
|
||||||
github.com/swaggo/swag v1.16.4 // indirect
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasthttp v1.57.0 // indirect
|
github.com/valyala/fasthttp v1.57.0 // indirect
|
||||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
golang.org/x/net v0.31.0 // indirect
|
go.uber.org/atomic v1.9.0 // indirect
|
||||||
|
go.uber.org/multierr v1.9.0 // indirect
|
||||||
|
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||||
golang.org/x/sys v0.27.0 // indirect
|
golang.org/x/sys v0.27.0 // indirect
|
||||||
golang.org/x/text v0.20.0 // indirect
|
golang.org/x/text v0.19.0 // indirect
|
||||||
golang.org/x/tools v0.27.0 // indirect
|
golang.org/x/tools v0.27.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||||
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
100
go.sum
100
go.sum
@@ -1,14 +1,18 @@
|
|||||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||||
github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28=
|
|
||||||
github.com/PuerkitoBio/purell v1.2.1/go.mod h1:ZwHcC/82TOaovDi//J/804umJFFmbOHPngi8iYYv/Eo=
|
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
|
||||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
|
||||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
|
||||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||||
|
github.com/boombuler/barcode v1.0.2 h1:79yrbttoZrLGkL/oOI8hBrUKucwOL0oOjUgEguGMcJ4=
|
||||||
|
github.com/boombuler/barcode v1.0.2/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||||
|
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||||
|
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||||
|
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||||
|
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
||||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
||||||
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
||||||
@@ -21,60 +25,110 @@ github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yG
|
|||||||
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||||
github.com/gofiber/swagger v1.1.0 h1:ff3rg1fB+Rp5JN/N8jfxTiZtMKe/9tB9QDc79fPiJKQ=
|
github.com/gofiber/swagger v1.1.0 h1:ff3rg1fB+Rp5JN/N8jfxTiZtMKe/9tB9QDc79fPiJKQ=
|
||||||
github.com/gofiber/swagger v1.1.0/go.mod h1:pRZL0Np35sd+lTODTE5The0G+TMHfNY+oC4hM2/i5m8=
|
github.com/gofiber/swagger v1.1.0/go.mod h1:pRZL0Np35sd+lTODTE5The0G+TMHfNY+oC4hM2/i5m8=
|
||||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
|
||||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||||
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||||
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
|
|
||||||
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
|
||||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||||
|
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||||
|
github.com/makiuchi-d/gozxing v0.1.1 h1:xxqijhoedi+/lZlhINteGbywIrewVdVv2wl9r5O9S1I=
|
||||||
|
github.com/makiuchi-d/gozxing v0.1.1/go.mod h1:eRIHbOjX7QWxLIDJoQuMLhuXg9LAuw6znsUtRkNw9DU=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
|
||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
|
||||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
|
github.com/oxplot/papersizes v0.0.0-20181201065918-90a3a5ae1915 h1:4WzMzgExTgBfuUQ/HegMf+jcHtH+c3fl7eySUQUbfzg=
|
||||||
|
github.com/oxplot/papersizes v0.0.0-20181201065918-90a3a5ae1915/go.mod h1:LJRTnhoARxQgMyT7T9L+ZzwR4OrmyHTy5LPxZEzE1CM=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
|
||||||
|
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
|
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||||
|
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||||
|
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||||
|
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||||
|
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||||
|
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||||
|
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||||
|
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||||
|
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||||
|
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||||
|
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||||
|
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||||
|
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||||
|
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||||
github.com/swaggo/files/v2 v2.0.1 h1:XCVJO/i/VosCDsJu1YLpdejGsGnBE9deRMpjN4pJLHk=
|
github.com/swaggo/files/v2 v2.0.1 h1:XCVJO/i/VosCDsJu1YLpdejGsGnBE9deRMpjN4pJLHk=
|
||||||
github.com/swaggo/files/v2 v2.0.1/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM=
|
github.com/swaggo/files/v2 v2.0.1/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM=
|
||||||
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
|
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
|
||||||
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
|
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
|
||||||
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
|
|
||||||
github.com/valyala/fasthttp v1.57.0 h1:Xw8SjWGEP/+wAAgyy5XTvgrWlOD1+TxbbvNADYCm1Tg=
|
github.com/valyala/fasthttp v1.57.0 h1:Xw8SjWGEP/+wAAgyy5XTvgrWlOD1+TxbbvNADYCm1Tg=
|
||||||
github.com/valyala/fasthttp v1.57.0/go.mod h1:h6ZBaPRlzpZ6O3H5t2gEk1Qi33+TmLvfwgLLp0t9CpE=
|
github.com/valyala/fasthttp v1.57.0/go.mod h1:h6ZBaPRlzpZ6O3H5t2gEk1Qi33+TmLvfwgLLp0t9CpE=
|
||||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||||
|
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||||
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
|
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
||||||
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
|
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||||
|
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
|
||||||
|
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
|
||||||
|
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||||
|
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||||
|
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||||
|
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||||
|
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||||
|
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
|
||||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||||
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||||
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
|
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
|
||||||
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
|
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||||
|
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
55
handlers/barcode.go
Normal file
55
handlers/barcode.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GenerateBarcode godoc
|
||||||
|
//
|
||||||
|
// @Summary Generate barcodes
|
||||||
|
// @Description Generate barcodes based on the provided data
|
||||||
|
// @Tags barcodes
|
||||||
|
// @Param type path string true "Barcode type" Enums(ean13, code128)
|
||||||
|
// @Param content path string true "Barcode content" MinLength(1)
|
||||||
|
// @Param width query int false "Barcode width" Minimum(1) Maximum(10000) default(1000)
|
||||||
|
// @Param height query int false "Barcode height" Minimum(1) Maximum(10000) default(1000)
|
||||||
|
// @Produce image/png
|
||||||
|
// @Router /v1/barcodes/{type}/{content} [get]
|
||||||
|
func (h *DefaultHandler) GenerateBarcode(c *fiber.Ctx) error {
|
||||||
|
|
||||||
|
// Get the type and content from the URL
|
||||||
|
barcodeType := c.Params("type")
|
||||||
|
barcodeContent := c.Params("content")
|
||||||
|
|
||||||
|
// Get the width and height from the query parameters
|
||||||
|
widthStr := c.Query("width", "1000")
|
||||||
|
heightStr := c.Query("height", "1000")
|
||||||
|
|
||||||
|
// Convert width and height to integers
|
||||||
|
width, err := strconv.Atoi(widthStr)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Invalid width parameter",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
height, err := strconv.Atoi(heightStr)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Invalid height parameter",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the barcode
|
||||||
|
barcode, err := h.BarcodeService.GenerateBarcode(barcodeType, barcodeContent, width, height)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Set(fiber.HeaderContentType, "image/png")
|
||||||
|
return c.Send(barcode.Bytes())
|
||||||
|
}
|
||||||
110
handlers/card.go
Normal file
110
handlers/card.go
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"slices"
|
||||||
|
|
||||||
|
"git.odit.services/lfk/document-server/models"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GenerateCard godoc
|
||||||
|
//
|
||||||
|
// @Summary Generate runner cards
|
||||||
|
// @Description Generate cards based on the provided data
|
||||||
|
// @Tags pdfs
|
||||||
|
// @Accept json
|
||||||
|
// @Param data body models.CardRequest true "Card data"
|
||||||
|
// @Produce application/pdf
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Router /v1/pdfs/cards [post]
|
||||||
|
func (h *DefaultHandler) GenerateCard(c *fiber.Ctx) error {
|
||||||
|
cardRequest := new(models.CardRequest)
|
||||||
|
if err := c.BodyParser(cardRequest); err != nil {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if !slices.Contains([]string{"en", "de"}, cardRequest.Locale) {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Invalid locale",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
templateString, err := h.StaticService.GetTemplate(cardRequest.Locale, "card")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Template not found",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
template, err := h.Templater.StringToTemplate(templateString)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
genConfig := &models.CardTemplateOptions{
|
||||||
|
CardSegments: splitCardSegments(cardRequest.Cards),
|
||||||
|
EventName: h.Config.EventName,
|
||||||
|
CardSubtitle: h.Config.CardSubtitle,
|
||||||
|
BarcodeFormat: h.Config.CardBarcodeFormat,
|
||||||
|
BarcodePrefix: h.Config.CardBarcodePrefix,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := h.Templater.Execute(template, genConfig)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
c.Set(fiber.HeaderContentType, "text/html")
|
||||||
|
|
||||||
|
pdf, err := h.Converter.ToPdf(result, "a4", false)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Set(fiber.HeaderContentType, "application/pdf")
|
||||||
|
c.Set(fiber.HeaderContentDisposition, "attachment; filename=runner-cards.pdf")
|
||||||
|
return c.Send(pdf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func invertCardArrayItemPairs(cards []models.Card) []models.Card {
|
||||||
|
inverted := make([]models.Card, 0)
|
||||||
|
for i := 0; i < len(cards); i += 2 {
|
||||||
|
if i+1 < len(cards) {
|
||||||
|
inverted = append(inverted, cards[i+1])
|
||||||
|
}
|
||||||
|
inverted = append(inverted, cards[i])
|
||||||
|
}
|
||||||
|
return inverted
|
||||||
|
}
|
||||||
|
|
||||||
|
func splitCardSegments(cards []models.Card) []models.CardTemplateSegment {
|
||||||
|
cardSegments := make([]models.CardTemplateSegment, 0)
|
||||||
|
const currentCards = 0
|
||||||
|
for i := 0; i < len(cards); i += 10 {
|
||||||
|
segmentLength := 10
|
||||||
|
if len(cards)-i < 10 {
|
||||||
|
segmentLength = len(cards) - i
|
||||||
|
}
|
||||||
|
segment := cards[i : i+segmentLength]
|
||||||
|
if segmentLength%2 != 0 {
|
||||||
|
segment = append(segment, models.Card{
|
||||||
|
ID: 0,
|
||||||
|
Enabled: false,
|
||||||
|
Runner: models.Runner{},
|
||||||
|
Code: "",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
cardSegments = append(cardSegments, models.CardTemplateSegment{
|
||||||
|
Cards: segment,
|
||||||
|
CardsSwapped: invertCardArrayItemPairs(segment),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return cardSegments
|
||||||
|
}
|
||||||
84
handlers/certificate.go
Normal file
84
handlers/certificate.go
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"slices"
|
||||||
|
|
||||||
|
"git.odit.services/lfk/document-server/models"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GenerateCertificate godoc
|
||||||
|
//
|
||||||
|
// @Summary Generate runner certificates
|
||||||
|
// @Description Generate certificates based on the provided data
|
||||||
|
// @Tags pdfs
|
||||||
|
// @Accept json
|
||||||
|
// @Param data body models.CertificateRequest true "Certificate data"
|
||||||
|
// @Produce application/pdf
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Router /v1/pdfs/certificates [post]
|
||||||
|
func (h *DefaultHandler) GenerateCertificate(c *fiber.Ctx) error {
|
||||||
|
certificateRequest := new(models.CertificateRequest)
|
||||||
|
if err := c.BodyParser(certificateRequest); err != nil {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if !slices.Contains([]string{"en", "de"}, certificateRequest.Locale) {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Invalid locale",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
templateString, err := h.StaticService.GetTemplate(certificateRequest.Locale, "certificate")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Template not found",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
template, err := h.Templater.StringToTemplate(templateString)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
genConfig := &models.CertificateTemplateOptions{
|
||||||
|
Runners: addUpRunnerDonations(certificateRequest.Runners),
|
||||||
|
EventName: h.Config.EventName,
|
||||||
|
Footer: h.Config.CertificateFooter,
|
||||||
|
CurrencySymbol: h.Config.CurrencySymbol,
|
||||||
|
Locale: certificateRequest.Locale,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := h.Templater.Execute(template, genConfig)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
c.Set(fiber.HeaderContentType, "text/html")
|
||||||
|
|
||||||
|
pdf, err := h.Converter.ToPdf(result, "a4", false)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Set(fiber.HeaderContentType, "application/pdf")
|
||||||
|
c.Set(fiber.HeaderContentDisposition, "attachment; filename=certificate.pdf")
|
||||||
|
return c.Send(pdf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func addUpRunnerDonations(runners []models.RunnerWithDonations) []models.RunnerWithDonations {
|
||||||
|
for i := 0; i < len(runners); i++ {
|
||||||
|
for j := 0; j < len(runners[i].DistanceDonations); j++ {
|
||||||
|
runners[i].TotalDonations += runners[i].DistanceDonations[j].Amount
|
||||||
|
runners[i].TotalPerDistance += runners[i].DistanceDonations[j].AmountPerDistance
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return runners
|
||||||
|
}
|
||||||
@@ -2,26 +2,86 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"slices"
|
||||||
|
|
||||||
"git.odit.services/lfk/document-server/models"
|
"git.odit.services/lfk/document-server/models"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenerateContract godoc
|
// GenerateContract godoc
|
||||||
|
//
|
||||||
// @Summary Generate a contract
|
// @Summary Generate a contract
|
||||||
// @Description Generate a contract based on the provided data
|
// @Description Generate a contract based on the provided data
|
||||||
// @Tags contracts
|
// @Tags pdfs
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param data body models.Contract true "Contract data"
|
// @Param data body models.ContractRequest true "Contract data"
|
||||||
// @Produce application/pdf
|
// @Produce application/pdf
|
||||||
// @Router /contracts [post]
|
// @Security ApiKeyAuth
|
||||||
func GenerateContract(c *fiber.Ctx) error {
|
// @Router /v1/pdfs/contracts [post]
|
||||||
contract := new(models.Contract)
|
func (h *DefaultHandler) GenerateContract(c *fiber.Ctx) error {
|
||||||
|
contract := new(models.ContractRequest)
|
||||||
if err := c.BodyParser(contract); err != nil {
|
if err := c.BodyParser(contract); err != nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
log.Println(contract.Runners[0].Group.ParentGroup)
|
if !slices.Contains([]string{"en", "de"}, contract.Locale) {
|
||||||
return c.SendString("Contract generated")
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Invalid locale",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
contract.Runners = repeatRunnerArrayItems(contract.Runners, 2)
|
||||||
|
|
||||||
|
templateString, err := h.StaticService.GetTemplate(contract.Locale, "contract")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||||
|
"error": "Template not found",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
template, err := h.Templater.StringToTemplate(templateString)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
genConfig := &models.ContractTemplateOptions{
|
||||||
|
Runners: contract.Runners,
|
||||||
|
CurrencySymbol: h.Config.CurrencySymbol,
|
||||||
|
Disclaimer: h.Config.SponosringDisclaimer,
|
||||||
|
ReceiptMinimumAmount: h.Config.SponsoringReceiptMinimum,
|
||||||
|
EventName: h.Config.EventName,
|
||||||
|
BarcodeFormat: h.Config.SponsoringBarcodeFormat,
|
||||||
|
BarcodePrefix: h.Config.SponsoringBarcodePrefix,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := h.Templater.Execute(template, genConfig)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pdf, err := h.Converter.ToPdf(result, "a5", true)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Set(fiber.HeaderContentType, "application/pdf")
|
||||||
|
c.Set(fiber.HeaderContentDisposition, "attachment; filename=runner-contracts.pdf")
|
||||||
|
return c.Send(pdf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func repeatRunnerArrayItems(runners []models.Runner, duplicates int) []models.Runner {
|
||||||
|
var duplicatedRunners []models.Runner
|
||||||
|
for _, runner := range runners {
|
||||||
|
for i := 0; i < duplicates; i++ {
|
||||||
|
duplicatedRunners = append(duplicatedRunners, runner)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return duplicatedRunners
|
||||||
}
|
}
|
||||||
|
|||||||
22
handlers/handlers.go
Normal file
22
handlers/handlers.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.odit.services/lfk/document-server/models"
|
||||||
|
"git.odit.services/lfk/document-server/services"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Handler interface {
|
||||||
|
GenerateCard(*fiber.Ctx) error
|
||||||
|
GenerateContract(*fiber.Ctx) error
|
||||||
|
GenerateCertificate(*fiber.Ctx) error
|
||||||
|
GenerateBarcode(*fiber.Ctx) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type DefaultHandler struct {
|
||||||
|
Config *models.Config
|
||||||
|
BarcodeService services.BarcodeService
|
||||||
|
Templater services.Templater
|
||||||
|
Converter services.Converter
|
||||||
|
StaticService services.StaticService
|
||||||
|
}
|
||||||
@@ -2,6 +2,6 @@ package handlers
|
|||||||
|
|
||||||
import "github.com/gofiber/fiber/v2"
|
import "github.com/gofiber/fiber/v2"
|
||||||
|
|
||||||
func NotFoundHandler(c *fiber.Ctx) error {
|
func (h *DefaultHandler) NotFoundHandler(c *fiber.Ctx) error {
|
||||||
return c.Status(404).SendString("Not Found")
|
return c.Status(404).SendString("Not Found")
|
||||||
}
|
}
|
||||||
|
|||||||
111
main.go
111
main.go
@@ -1,29 +1,109 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"crypto/sha256"
|
||||||
|
"crypto/subtle"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"git.odit.services/lfk/document-server/docs" // Correct import path for docs
|
"git.odit.services/lfk/document-server/docs" // Correct import path for docs
|
||||||
"git.odit.services/lfk/document-server/handlers"
|
"git.odit.services/lfk/document-server/handlers"
|
||||||
|
"git.odit.services/lfk/document-server/models"
|
||||||
|
"git.odit.services/lfk/document-server/services"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/gofiber/fiber/v2/middleware/keyauth"
|
||||||
"github.com/gofiber/swagger"
|
"github.com/gofiber/swagger"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
port = flag.String("port", ":3000", "Port to listen on")
|
config *models.Config
|
||||||
prod = flag.Bool("prod", false, "Enable prefork in Production")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func validateAPIKey(c *fiber.Ctx, key string) (bool, error) {
|
||||||
|
hashedAPIKey := sha256.Sum256([]byte(config.APIKey))
|
||||||
|
hashedKey := sha256.Sum256([]byte(key))
|
||||||
|
|
||||||
|
if subtle.ConstantTimeCompare(hashedAPIKey[:], hashedKey[:]) == 1 {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return false, keyauth.ErrMissingOrMalformedAPIKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadEnv() error {
|
||||||
|
|
||||||
|
viper.SetDefault("PORT", "3000")
|
||||||
|
viper.SetDefault("CARD_BARCODEFORMAT", "ean13")
|
||||||
|
viper.SetDefault("CARD_BARCODEPREFIX", "")
|
||||||
|
viper.SetDefault("SPONSORING_BARCODEFORMAT", "code128")
|
||||||
|
viper.SetDefault("SPONSORING_BARCODEPREFIX", "")
|
||||||
|
|
||||||
|
// Load .env file
|
||||||
|
viper.SetConfigFile(".env")
|
||||||
|
|
||||||
|
// Load environment variables
|
||||||
|
viper.AutomaticEnv()
|
||||||
|
err := viper.ReadInConfig()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("No .env file found")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unmarshal the config from file and env into the config struct
|
||||||
|
err = viper.Unmarshal(&config)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// @title LfK Document Server API
|
// @title LfK Document Server API
|
||||||
// @description This is the API documentation for the LfK Document Server - a tool for pdf generation.
|
// @description This is the API documentation for the LfK Document Server - a tool for pdf generation.
|
||||||
|
// @license.name CC BY-NC-SA 4.0
|
||||||
|
// @termsOfService https://lauf-fuer-kaya.de/datenschutz
|
||||||
|
// @contact.name ODIT.Services UG (haftungsbeschränkt)
|
||||||
|
// @contact.url https://odit.services
|
||||||
|
// @contact.email info@odit.services
|
||||||
|
// @securityDefinitions.apiKey ApiKeyAuth
|
||||||
|
// @in query
|
||||||
|
// @name key
|
||||||
func main() {
|
func main() {
|
||||||
// Parse command-line flags
|
|
||||||
flag.Parse()
|
err := loadEnv()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var redisClient *redis.Client
|
||||||
|
if config.RedisAddr != "" {
|
||||||
|
log.Println("Using redis at", config.RedisAddr)
|
||||||
|
redisClient = redis.NewClient(&redis.Options{
|
||||||
|
Addr: config.RedisAddr,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
barcodeGenerator := &services.DefaultBarcodeService{
|
||||||
|
RedisClient: redisClient,
|
||||||
|
}
|
||||||
|
staticService := &services.DefaultStaticService{
|
||||||
|
Cache: make(map[string]string),
|
||||||
|
}
|
||||||
|
handler := handlers.DefaultHandler{
|
||||||
|
Config: config,
|
||||||
|
BarcodeService: barcodeGenerator,
|
||||||
|
StaticService: staticService,
|
||||||
|
Templater: &services.DefaultTemplater{
|
||||||
|
BarcodeService: barcodeGenerator,
|
||||||
|
StaticService: staticService,
|
||||||
|
},
|
||||||
|
Converter: &services.GotenbergConverter{
|
||||||
|
BaseUrl: config.GotenbergBaseUrl,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new Fiber instance
|
// Create a new Fiber instance
|
||||||
app := fiber.New(fiber.Config{
|
app := fiber.New(fiber.Config{
|
||||||
Prefork: *prod,
|
Prefork: config.Prod,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Swagger documentation route
|
// Swagger documentation route
|
||||||
@@ -31,13 +111,20 @@ func main() {
|
|||||||
|
|
||||||
v1 := app.Group("/v1")
|
v1 := app.Group("/v1")
|
||||||
|
|
||||||
v1.Get("/", func(c *fiber.Ctx) error {
|
pdfv1 := v1.Group("/pdfs")
|
||||||
return c.SendString("Hello, World!")
|
pdfv1.Use(keyauth.New(keyauth.Config{
|
||||||
})
|
KeyLookup: "query:key",
|
||||||
v1.Post("/contracts", handlers.GenerateContract)
|
Validator: validateAPIKey,
|
||||||
|
}))
|
||||||
|
|
||||||
app.Use(handlers.NotFoundHandler)
|
pdfv1.Post("/contracts", handler.GenerateContract)
|
||||||
|
pdfv1.Post("/cards", handler.GenerateCard)
|
||||||
|
pdfv1.Post("/certificates", handler.GenerateCertificate)
|
||||||
|
|
||||||
|
v1.Get("/barcodes/:type/:content", handler.GenerateBarcode)
|
||||||
|
|
||||||
|
app.Use(handler.NotFoundHandler)
|
||||||
docs.SwaggerInfo.BasePath = "/"
|
docs.SwaggerInfo.BasePath = "/"
|
||||||
|
|
||||||
log.Fatal(app.Listen(*port))
|
log.Fatal(app.Listen("0.0.0.0:" + config.Port))
|
||||||
}
|
}
|
||||||
|
|||||||
26
models/card.go
Normal file
26
models/card.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type CardRequest struct {
|
||||||
|
Cards []Card `json:"cards" validate:"required"`
|
||||||
|
Locale string `json:"locale" enums:"en,de" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Card struct {
|
||||||
|
ID int `json:"id" validate:"required"`
|
||||||
|
Enabled bool `json:"enabled" default:"true"`
|
||||||
|
Runner Runner `json:"runner" validate:"required"`
|
||||||
|
Code string `json:"code" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CardTemplateOptions struct {
|
||||||
|
CardSegments []CardTemplateSegment `json:"card_segments"`
|
||||||
|
EventName string `json:"event_name"`
|
||||||
|
CardSubtitle string `json:"card_subtitle"`
|
||||||
|
BarcodeFormat string `json:"barcode_format"`
|
||||||
|
BarcodePrefix string `json:"barcode_prefix"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CardTemplateSegment struct {
|
||||||
|
Cards []Card `json:"cards"`
|
||||||
|
CardsSwapped []Card `json:"cards_swapped"`
|
||||||
|
}
|
||||||
41
models/certificate.go
Normal file
41
models/certificate.go
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type CertificateRequest struct {
|
||||||
|
Runners []RunnerWithDonations `json:"runners" validate:"required"`
|
||||||
|
Locale string `json:"locale" enums:"en,de" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RunnerWithDonations struct {
|
||||||
|
ID int `json:"id" validate:"required"`
|
||||||
|
FirstName string `json:"first_name" validate:"required"`
|
||||||
|
MiddleName string `json:"middle_name" validate:"optional"`
|
||||||
|
LastName string `json:"last_name" validate:"required"`
|
||||||
|
Group Group `json:"group" validate:"required"`
|
||||||
|
Distance int `json:"distance" validate:"required"`
|
||||||
|
DistanceDonations []DistanceDonation `json:"distance_donations" validate:"optional"`
|
||||||
|
TotalPerDistance int `json:"total_per_distance" validate:"optional"`
|
||||||
|
TotalDonations int `json:"total_donations" validate:"optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DistanceDonation struct {
|
||||||
|
ID int `json:"id" validate:"required"`
|
||||||
|
Amount int `json:"amount"`
|
||||||
|
PaidAmount int `json:"paid_amount" validate:"optional"`
|
||||||
|
AmountPerDistance int `json:"amount_per_distance" validate:"required"`
|
||||||
|
Donor Donor `json:"donor" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Donor struct {
|
||||||
|
ID int `json:"id" validate:"required"`
|
||||||
|
FirstName string `json:"first_name" validate:"required"`
|
||||||
|
MiddleName string `json:"middle_name" validate:"optional"`
|
||||||
|
LastName string `json:"last_name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CertificateTemplateOptions struct {
|
||||||
|
Runners []RunnerWithDonations `json:"runners"`
|
||||||
|
EventName string `json:"event_name"`
|
||||||
|
Footer string `json:"footer"`
|
||||||
|
CurrencySymbol string `json:"currency_symbol"`
|
||||||
|
Locale string `json:"locale"`
|
||||||
|
}
|
||||||
19
models/config.go
Normal file
19
models/config.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
Prod bool `mapstructure:"PRODUCION"`
|
||||||
|
Port string `mapstructure:"PORT"`
|
||||||
|
APIKey string `mapstructure:"APIKEY"`
|
||||||
|
EventName string `mapstructure:"EVENTNAME"`
|
||||||
|
CurrencySymbol string `mapstructure:"CURRENCYSYMBOL"`
|
||||||
|
CardSubtitle string `mapstructure:"CARD_SUBTITLE"`
|
||||||
|
CardBarcodeFormat string `mapstructure:"CARD_BARCODEFORMAT"`
|
||||||
|
CardBarcodePrefix string `mapstructure:"CARD_BARCODEPREFIX"`
|
||||||
|
SponsoringReceiptMinimum int `mapstructure:"SPONSOING_RECEIPTMINIMUM"`
|
||||||
|
SponosringDisclaimer string `mapstructure:"SPONSORING_DISCLAIMER"`
|
||||||
|
SponsoringBarcodeFormat string `mapstructure:"SPONSORING_BARCODEFORMAT"`
|
||||||
|
SponsoringBarcodePrefix string `mapstructure:"SPONSORING_BARCODEPREFIX"`
|
||||||
|
CertificateFooter string `mapstructure:"CERTIFICATE_FOOTER"`
|
||||||
|
GotenbergBaseUrl string `mapstructure:"GOTENBERG_BASEURL"`
|
||||||
|
RedisAddr string `mapstructure:"REDIS_ADDR"`
|
||||||
|
}
|
||||||
@@ -1,19 +1,30 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Contract struct {
|
type ContractRequest struct {
|
||||||
Runners []Runner `json:"runners"`
|
Runners []Runner `json:"runners" validate:"required"`
|
||||||
|
Locale string `json:"locale" enums:"en,de" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Runner struct {
|
type Runner struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name" validate:"required"`
|
||||||
MiddleName string `json:"middle_name"`
|
MiddleName string `json:"middle_name" validate:"optional"`
|
||||||
LastName string `json:"last_name"`
|
LastName string `json:"last_name" validate:"required"`
|
||||||
Group Group `json:"group"`
|
Group Group `json:"group" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Group struct {
|
type Group struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name" validate:"required"`
|
||||||
ParentGroup *Group `json:"parent_group"`
|
ParentGroup *Group `json:"parent_group" validate:"optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContractTemplateOptions struct {
|
||||||
|
Runners []Runner `json:"runners"`
|
||||||
|
CurrencySymbol string `json:"currency_symbol"`
|
||||||
|
Disclaimer string `json:"disclaimer"`
|
||||||
|
ReceiptMinimumAmount int `json:"receipt_minimum_amount"`
|
||||||
|
EventName string `json:"event_name"`
|
||||||
|
BarcodeFormat string `json:"barcode_format"`
|
||||||
|
BarcodePrefix string `json:"barcode_prefix"`
|
||||||
}
|
}
|
||||||
|
|||||||
93
services/barcode.go
Normal file
93
services/barcode.go
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
package services
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"image/png"
|
||||||
|
"log"
|
||||||
|
"slices"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/boombuler/barcode"
|
||||||
|
"github.com/boombuler/barcode/code128"
|
||||||
|
"github.com/boombuler/barcode/ean"
|
||||||
|
"github.com/boombuler/barcode/qr"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BarcodeService interface {
|
||||||
|
GenerateBarcode(format string, content string, width int, height int) (bytes.Buffer, error)
|
||||||
|
IsTypeSupported(format string) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type DefaultBarcodeService struct {
|
||||||
|
RedisClient *redis.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *DefaultBarcodeService) GenerateBarcode(format string, content string, width int, height int) (bytes.Buffer, error) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
if !b.IsTypeSupported(format) {
|
||||||
|
return bytes.Buffer{}, fmt.Errorf("unsupported barcode type: %s", format)
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.RedisClient != nil {
|
||||||
|
cachedBarcode, err := b.RedisClient.Get(ctx, fmt.Sprintf("barcode:%s:%s:%d:%d", format, content, width, height)).Result()
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("Cache hit for barcode:%s:%s:%d:%d", format, content, width, height)
|
||||||
|
buf := bytes.Buffer{}
|
||||||
|
buf.Write([]byte(cachedBarcode))
|
||||||
|
return buf, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var generatedCode barcode.Barcode
|
||||||
|
var err error
|
||||||
|
|
||||||
|
switch format {
|
||||||
|
case "ean13":
|
||||||
|
generatedCode, err = ean.Encode(content)
|
||||||
|
if err != nil {
|
||||||
|
return bytes.Buffer{}, err
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "code128":
|
||||||
|
generatedCode, err = code128.Encode(content)
|
||||||
|
if err != nil {
|
||||||
|
return bytes.Buffer{}, err
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "qr":
|
||||||
|
generatedCode, err = qr.Encode(content, qr.M, qr.AlphaNumeric)
|
||||||
|
if err != nil {
|
||||||
|
return bytes.Buffer{}, err
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
scaledCode, err := barcode.Scale(generatedCode, width, height)
|
||||||
|
if err != nil {
|
||||||
|
return bytes.Buffer{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err = png.Encode(&buf, scaledCode)
|
||||||
|
if err != nil {
|
||||||
|
return bytes.Buffer{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.RedisClient != nil {
|
||||||
|
err = b.RedisClient.Set(ctx, fmt.Sprintf("barcode:%s:%s:%d:%d", format, content, width, height), buf.String(), 10*time.Minute).Err()
|
||||||
|
if err != nil {
|
||||||
|
return bytes.Buffer{}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *DefaultBarcodeService) IsTypeSupported(format string) bool {
|
||||||
|
supportedTypes := []string{"ean13", "code128", "qr"}
|
||||||
|
return slices.Contains(supportedTypes, format)
|
||||||
|
}
|
||||||
107
services/converter.go
Normal file
107
services/converter.go
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
package services
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"mime/multipart"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/oxplot/papersizes"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Converter interface {
|
||||||
|
ToPdf(html string, pageSize string, landscape bool) ([]byte, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type GotenbergConverter struct {
|
||||||
|
BaseUrl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GotenbergConverter) ToPdf(html string, pageSize string, landscape bool) ([]byte, error) {
|
||||||
|
client := &http.Client{}
|
||||||
|
defer client.CloseIdleConnections()
|
||||||
|
|
||||||
|
body := &bytes.Buffer{}
|
||||||
|
writer := multipart.NewWriter(body)
|
||||||
|
|
||||||
|
part, err := writer.CreateFormFile("files", "index.html")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = part.Write([]byte(html))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
size := papersizes.FromName(pageSize)
|
||||||
|
if size == nil {
|
||||||
|
return nil, fmt.Errorf("invalid page size: %s", pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("paperWidth", strconv.Itoa(size.Width)+"mm")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("paperHeight", strconv.Itoa(size.Height)+"mm")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("landscape", strconv.FormatBool(landscape))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("marginTop", "0")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("marginBottom", "0")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("marginLeft", "0")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("marginRight", "0")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteField("preferCssPageSize", "true")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Close()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := http.NewRequest("POST", g.BaseUrl+"/forms/chromium/convert/html", body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
req.Header.Set("Content-Type", writer.FormDataContentType())
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer resp.Body.Close()
|
||||||
|
data := new(bytes.Buffer)
|
||||||
|
_, err = data.ReadFrom(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.Bytes(), nil
|
||||||
|
}
|
||||||
97
services/templater.go
Normal file
97
services/templater.go
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
package services
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"html/template"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Templater interface {
|
||||||
|
Execute(template *template.Template, data interface{}) (string, error)
|
||||||
|
StringToTemplate(templateString string) (*template.Template, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DefaultTemplater struct {
|
||||||
|
BarcodeService BarcodeService
|
||||||
|
StaticService StaticService
|
||||||
|
}
|
||||||
|
|
||||||
|
func idToEan13(id string, prefix string) (string, error) {
|
||||||
|
if len(id) > 12 {
|
||||||
|
return "", errors.New("id too long")
|
||||||
|
}
|
||||||
|
|
||||||
|
for len(id) < 11 {
|
||||||
|
id = "0" + id
|
||||||
|
}
|
||||||
|
id = prefix + id
|
||||||
|
|
||||||
|
return id, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *DefaultTemplater) GenerateBarcode(code string, format string, prefix string) (string, error) {
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if format == "ean13" {
|
||||||
|
code, err = idToEan13(code, prefix)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buf, err := t.BarcodeService.GenerateBarcode(format, code, 1000, 500)
|
||||||
|
|
||||||
|
return base64.StdEncoding.EncodeToString(buf.Bytes()), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *DefaultTemplater) SelectSponsorImage(id int) (string, error) {
|
||||||
|
sponsors, err := t.StaticService.ListFilesInStaticSubFolder("images/sponsors")
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return t.StaticService.GetImage("sponsors/" + strings.TrimSuffix(sponsors[id%len(sponsors)], ".base64")), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *DefaultTemplater) LoadImage(name string) (string, error) {
|
||||||
|
return t.StaticService.GetImage(name), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *DefaultTemplater) FormatUnit(unit string, locale string, amount int) (string, error) {
|
||||||
|
var formatted string
|
||||||
|
switch unit {
|
||||||
|
case "kilometer":
|
||||||
|
formatted = fmt.Sprintf("%.3f", float64(amount)/1000)
|
||||||
|
case "euro":
|
||||||
|
formatted = fmt.Sprintf("%.2f", float64(amount)/100)
|
||||||
|
default:
|
||||||
|
return "", errors.New("unknown unit")
|
||||||
|
}
|
||||||
|
|
||||||
|
if locale == "de" {
|
||||||
|
return strings.Replace(formatted, ".", ",", -1), nil
|
||||||
|
}
|
||||||
|
return formatted, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *DefaultTemplater) StringToTemplate(templateString string) (*template.Template, error) {
|
||||||
|
return template.New("template").Funcs(template.FuncMap{
|
||||||
|
"barcode": t.GenerateBarcode,
|
||||||
|
"sponsorLogo": t.SelectSponsorImage,
|
||||||
|
"formatUnit": t.FormatUnit,
|
||||||
|
"loadImage": t.LoadImage,
|
||||||
|
}).Parse(templateString)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *DefaultTemplater) Execute(baseTemplate *template.Template, data interface{}) (string, error) {
|
||||||
|
resultBuffer := new(bytes.Buffer)
|
||||||
|
|
||||||
|
err := baseTemplate.Execute(resultBuffer, data)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultBuffer.String(), nil
|
||||||
|
}
|
||||||
63
services/templates.go
Normal file
63
services/templates.go
Normal file
File diff suppressed because one or more lines are too long
1
static/images/certificate_background.base64
Normal file
1
static/images/certificate_background.base64
Normal file
File diff suppressed because one or more lines are too long
1
static/images/certificate_footer.base64
Normal file
1
static/images/certificate_footer.base64
Normal file
File diff suppressed because one or more lines are too long
1
static/images/error.base64
Normal file
1
static/images/error.base64
Normal file
File diff suppressed because one or more lines are too long
1
static/images/sponsoringheader.base64
Normal file
1
static/images/sponsoringheader.base64
Normal file
File diff suppressed because one or more lines are too long
1
static/images/sponsors/odit.base64
Normal file
1
static/images/sponsors/odit.base64
Normal file
File diff suppressed because one or more lines are too long
1
static/images/sponsors/sparkasse.base64
Normal file
1
static/images/sponsors/sparkasse.base64
Normal file
File diff suppressed because one or more lines are too long
1
static/images/sponsors/vrbank.base64
Normal file
1
static/images/sponsors/vrbank.base64
Normal file
File diff suppressed because one or more lines are too long
80
static/templates/card/de.html
Normal file
80
static/templates/card/de.html
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
<title>Sponsoring contract</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
|
||||||
|
<style>
|
||||||
|
.sheet {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
page-break-after: always;
|
||||||
|
padding: 1.2cm 2cm 1.2cm 2cm
|
||||||
|
}
|
||||||
|
|
||||||
|
body.A4 .sheet {
|
||||||
|
width: 210mm;
|
||||||
|
height: 296mm
|
||||||
|
}
|
||||||
|
|
||||||
|
.runnercard {
|
||||||
|
border: 1px solid;
|
||||||
|
height: 5.5cm;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="A4 landscape">
|
||||||
|
{{ range .CardSegments }}
|
||||||
|
<div class="sheet">
|
||||||
|
<div class="columns is-multiline">
|
||||||
|
{{ range .Cards }}
|
||||||
|
<div class="column is-half runnercard">
|
||||||
|
{{ if ne .Code "" }}
|
||||||
|
<p class="title is-5" style="text-align: center; padding-bottom: 0; margin-top: -0.75rem;">{{ $.EventName }}</p>
|
||||||
|
<p style="text-align: center; margin-top: -1.5rem; font-size: small;">{{ $.CardSubtitle }}</p>
|
||||||
|
<p style="font-size: small;">Mit Unterstützung von:</p>
|
||||||
|
<div class="columns" style="height: 6rem; overflow: hidden;">
|
||||||
|
<div class="column is-half">
|
||||||
|
<!--SPONSOR LOGO HERE-->
|
||||||
|
<img style="vertical-align: revert; margin-top: auto; object-fit: cover; max-height: 2cm;"
|
||||||
|
src="data:image/png;base64,{{ sponsorLogo .ID }}" />
|
||||||
|
</div>
|
||||||
|
<div class="column is-half">
|
||||||
|
<!--BARCODE HERE-->
|
||||||
|
<img style="vertical-align: revert; margin-top: auto; object-fit: cover; max-height: 5rem;"
|
||||||
|
src="data:image/png;base64,{{ barcode .Code $.BarcodeFormat $.BarcodePrefix }}" />
|
||||||
|
<p style="font-size: 0.6rem; text-align: center; margin: 0; padding: 0;">{{ .Code }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>{{ .Runner.LastName }}, {{ .Runner.FirstName }} {{ .Runner.MiddleName }}</p>
|
||||||
|
<p>{{ .Runner.Group.Name }}</p>
|
||||||
|
{{ end}}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sheet">
|
||||||
|
<div class="columns is-multiline">
|
||||||
|
{{ range .CardsSwapped }}
|
||||||
|
<div class="column is-half runnercard" style="justify-content: center; align-items: center; text-align: center;">
|
||||||
|
{{ if ne .Code "" }}
|
||||||
|
<!--SPONSOR LOGO FIRST-->
|
||||||
|
<div style="height: 2cm; padding: 0 0 1cm 0">
|
||||||
|
<img style="object-fit: cover; max-height: 2cm;" src="data:image/png;base64,{{ sponsorLogo .ID }}" />
|
||||||
|
</div>
|
||||||
|
<img style="object-fit: cover; max-height: 6rem; position: relative;"
|
||||||
|
src="data:image/png;base64,{{ barcode .Code $.BarcodeFormat $.BarcodePrefix }}" />
|
||||||
|
<p style="font-size: 1rem; text-align: center; margin: 0; padding: 0;">{{ .Code }}</p>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end}}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
75
static/templates/card/en.html
Normal file
75
static/templates/card/en.html
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
<title>Sponsoring contract</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
|
||||||
|
<style>
|
||||||
|
.sheet {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
page-break-after: always;
|
||||||
|
padding: 1.2cm 2cm 1.2cm 2cm
|
||||||
|
}
|
||||||
|
|
||||||
|
body.A4 .sheet {
|
||||||
|
width: 210mm;
|
||||||
|
height: 296mm
|
||||||
|
}
|
||||||
|
|
||||||
|
.runnercard {
|
||||||
|
border: 1px solid;
|
||||||
|
height: 5.5cm;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="A4 landscape">
|
||||||
|
{{ range .CardSegments }}
|
||||||
|
<div class="sheet">
|
||||||
|
<div class="columns is-multiline">
|
||||||
|
{{ range .Cards }}
|
||||||
|
<div class="column is-half runnercard">
|
||||||
|
<p class="title is-5" style="text-align: center; padding-bottom: 0; margin-top: -0.75rem;">{{ $.EventName }}</p>
|
||||||
|
<p style="text-align: center; margin-top: -1.5rem; font-size: small;">{{ $.CardSubtitle }}</p>
|
||||||
|
<p style="font-size: small;">Supported by:</p>
|
||||||
|
<div class="columns" style="height: 6rem; overflow: hidden;">
|
||||||
|
<div class="column is-half">
|
||||||
|
<!--SPONSOR LOGO HERE-->
|
||||||
|
<img style="vertical-align: revert; margin-top: auto; object-fit: cover; max-height: 2cm;"
|
||||||
|
src="data:image/png;base64,{{ sponsorLogo .ID }}" />
|
||||||
|
</div>
|
||||||
|
<div class="column is-half">
|
||||||
|
<!--BARCODE HERE-->
|
||||||
|
<img style="vertical-align: revert; margin-top: auto; object-fit: cover; max-height: 5rem;"
|
||||||
|
src="data:image/png;base64,{{ barcode .Code $.BarcodeFormat $.BarcodePrefix }}" />
|
||||||
|
<p style="font-size: 0.6rem; text-align: center; margin: 0; padding: 0;">{{ .Code }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>{{ .Runner.LastName }}, {{ .Runner.FirstName }} {{ .Runner.MiddleName }}</p>
|
||||||
|
<p>{{ .Runner.Group.Name }}</p>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sheet">
|
||||||
|
<div class="columns is-multiline">
|
||||||
|
{{ range .CardsSwapped }}
|
||||||
|
<div class="column is-half runnercard" style="justify-content: center; align-items: center; text-align: center;">
|
||||||
|
<!--SPONSOR LOGO FIRST-->
|
||||||
|
<div style="height: 2cm; padding: 0 0 1cm 0">
|
||||||
|
<img style="object-fit: cover; max-height: 2cm;" src="data:image/png;base64,{{ sponsorLogo .ID }}" />
|
||||||
|
</div>
|
||||||
|
<img style="object-fit: cover; max-height: 6rem; position: relative;" src="data:image/png;base64,{{ barcode .Code $.BarcodeFormat $.BarcodePrefix }}" />
|
||||||
|
<p style="font-size: 1rem; text-align: center; margin: 0; padding: 0;">{{ .Code }}</p>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end}}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
102
static/templates/certificate/de.html
Normal file
102
static/templates/certificate/de.html
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
<title>Sponsoring contract</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
|
||||||
|
<style>
|
||||||
|
.sheet {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
page-break-after: always;
|
||||||
|
padding: 1.2cm 2cm 1.2cm 2cm;
|
||||||
|
background-image: url("data:image/png;base64,{{ loadImage "certificate_background" }}");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 11cm;
|
||||||
|
background-position: 5cm 5cm;
|
||||||
|
color: #000;
|
||||||
|
/* border-style: solid; */
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
p {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.A4 .sheet {
|
||||||
|
width: 210mm;
|
||||||
|
height: 296mm
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
font-size: large;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="A4 landscape">
|
||||||
|
{{ range .Runners }}
|
||||||
|
<article class="sheet">
|
||||||
|
<header class="content has-text-centered">
|
||||||
|
<p style="font-size: 3cm; font-weight: bold;">Urkunde</p>
|
||||||
|
</header>
|
||||||
|
<main class="content has-text-centered" style="padding-top: 3cm;">
|
||||||
|
<p style="width: 50%; font-size: 4vw; font-weight: bold; margin-bottom: 0; display: inline;">{{ .FirstName }}
|
||||||
|
{{ .MiddleName }} {{ .LastName }}
|
||||||
|
</p>
|
||||||
|
<p style="font-size: 1cm; margin-bottom: 0;">hat beim {{ $.EventName }}</p>
|
||||||
|
<p style="font-size: 2cm; font-weight: bold; margin-bottom: 0;">{{formatUnit "kilometer" $.Locale .Distance}}km</p>
|
||||||
|
<p style="font-size: 1cm;">für den guten Zweck zurückgelegt</p>
|
||||||
|
</main>
|
||||||
|
<footer class="certificate-footer">
|
||||||
|
<img src="data:image/png;base64,{{ loadImage "certificate_footer" }}">
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
<article class="sheet">
|
||||||
|
<header class="content has-text-centered">
|
||||||
|
<p style="font-size: 2.5cm; font-weight: bold;">Sponsorings</p>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<table style="border: solid; width: 17cm;">
|
||||||
|
<thead>
|
||||||
|
<td class=".td-head">Sponsor:in</td>
|
||||||
|
<td>Betrag/km</td>
|
||||||
|
<td>Gesamtbetrag</td>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{ range .DistanceDonations}}
|
||||||
|
<tr>
|
||||||
|
<td>{{ .Donor.FirstName }} {{ .Donor.MiddleName }} {{ .Donor.LastName }}</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .AmountPerDistance }} {{ $.CurrencySymbol }}</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .Amount }} {{ $.CurrencySymbol }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<td>Gesamt</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .TotalPerDistance }} {{ $.CurrencySymbol }}</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .TotalDonations }} {{ $.CurrencySymbol }}</td>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</main>
|
||||||
|
<footer class="certificate-footer">
|
||||||
|
<p>
|
||||||
|
{{ $.Footer }}
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
102
static/templates/certificate/en.html
Normal file
102
static/templates/certificate/en.html
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
<title>Sponsoring contract</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
|
||||||
|
<style>
|
||||||
|
.sheet {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
page-break-after: always;
|
||||||
|
padding: 1.2cm 2cm 1.2cm 2cm;
|
||||||
|
background-image: url("data:image/png;base64,{{ loadImage "certificate_background" }}");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 11cm;
|
||||||
|
background-position: 5cm 5cm;
|
||||||
|
color: #000;
|
||||||
|
/* border-style: solid; */
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
p {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.A4 .sheet {
|
||||||
|
width: 210mm;
|
||||||
|
height: 296mm
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
font-size: large;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="A4 landscape">
|
||||||
|
{{ range .Runners }}
|
||||||
|
<article class="sheet">
|
||||||
|
<header class="content has-text-centered">
|
||||||
|
<p style="font-size: 3cm; font-weight: bold;">Certificate</p>
|
||||||
|
</header>
|
||||||
|
<main class="content has-text-centered" style="padding-top: 3cm;">
|
||||||
|
<p style="width: 50%; font-size: 4vw; font-weight: bold; margin-bottom: 0; display: inline;">{{ .FirstName }}
|
||||||
|
{{ .MiddleName }} {{ .LastName }}
|
||||||
|
</p>
|
||||||
|
<p style="font-size: 1cm; margin-bottom: 0;">Ran</p>
|
||||||
|
<p style="font-size: 2cm; font-weight: bold; margin-bottom: 0;">{{formatUnit "kilometer" $.Locale .Distance}}km</p>
|
||||||
|
<p style="font-size: 1cm;">for our good cause at the {{ $.EventName }}</p>
|
||||||
|
</main>
|
||||||
|
<footer class="certificate-footer">
|
||||||
|
<img src="data:image/png;base64,{{ loadImage "certificate_footer" }}">
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
<article class="sheet">
|
||||||
|
<header class="content has-text-centered">
|
||||||
|
<p style="font-size: 2.5cm; font-weight: bold;">Donations</p>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<table style="border: solid; width: 17cm;">
|
||||||
|
<thead>
|
||||||
|
<td class=".td-head">Donor</td>
|
||||||
|
<td>Amount / km</td>
|
||||||
|
<td>Total</td>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{ range .DistanceDonations}}
|
||||||
|
<tr>
|
||||||
|
<td>{{ .Donor.FirstName }} {{ .Donor.MiddleName }} {{ .Donor.LastName }}</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .AmountPerDistance }} {{ $.CurrencySymbol }}</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .Amount }} {{ $.CurrencySymbol }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<td>Combined</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .TotalPerDistance }} {{ $.CurrencySymbol }}</td>
|
||||||
|
<td>{{ formatUnit "euro" $.Locale .TotalDonations }} {{ $.CurrencySymbol }}</td>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</main>
|
||||||
|
<footer class="certificate-footer">
|
||||||
|
<p>
|
||||||
|
{{ $.Footer }}
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
124
static/templates/contract/de.html
Normal file
124
static/templates/contract/de.html
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
<title>Sponsoring contract</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
|
||||||
|
<style>
|
||||||
|
.sheet {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
page-break-after: always;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.A5.landscape .sheet {
|
||||||
|
width: 210mm;
|
||||||
|
height: 147mm
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
margin-bottom: -20;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="A5 landscape">
|
||||||
|
{{ range .Runners }}
|
||||||
|
<div class="sheet">
|
||||||
|
<img id="header_img" width="100%" src="data:image/png;base64,{{ loadImage "sponsoringheader" }}" />
|
||||||
|
<div style=" padding: 0 1rem 0 1rem;">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-10">
|
||||||
|
<div class="columns" style="padding-bottom: 0;">
|
||||||
|
<div class="column is-two-fifths">
|
||||||
|
<p style="font-size: large; font-weight: bold;">Sponsoringerklärung</p>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<p style="font-size: x-small; vertical-align: revert; margin-top: auto;">Bitte in DRUCKBUCHSTABEN
|
||||||
|
schreiben
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>Ich bin/ Wir sind bereit anlässlich des {{ $.EventName }}</p>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-9">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .FirstName }}
|
||||||
|
{{ .MiddleName }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">Vorname</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-3">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .ID }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">ID</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<img style="vertical-align: revert; margin-top: auto; object-fit: cover; max-height: 2cm;"
|
||||||
|
src="data:image/png;base64,{{ barcode (printf "%d" .ID) $.BarcodeFormat $.BarcodePrefix }}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns" style="padding-top: 1rem;">
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .LastName }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">Nachname</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .Group.Name }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">Team/ Klasse</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="margin-top: -0.5rem">mit einem Betrag von _____ {{ $.CurrencySymbol }} pro gelaufenem Kilometer zu
|
||||||
|
unterstützen.</p>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Nachname</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Vorname</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="font-size: medium; margin-top: -0.5rem;">Adresse (Sponsor)</p>
|
||||||
|
<p style="font-size: x-small;">(Muss ausgefüllt werden, wenn Sie eine Spendenquittung benötigen -
|
||||||
|
Spendenquittungen können erst ab einem Gesamtbetrag von {{ $.ReceiptMinimumAmount }}{{ $.CurrencySymbol }}
|
||||||
|
ausgestellt werden)</p>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-8">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Straße</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-4">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Hausnummer</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-4">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Postleitzahl</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-8">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Stadt</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-7">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Ort, Datum</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-5">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Unterschrift</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="font-size: xx-small; overflow: hidden; height: 4rem; text-align: center;"> {{ $.Disclaimer }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
120
static/templates/contract/en.html
Normal file
120
static/templates/contract/en.html
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
<title>Sponsoring contract</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
|
||||||
|
<style>
|
||||||
|
.sheet {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
page-break-after: always;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.A5.landscape .sheet {
|
||||||
|
width: 210mm;
|
||||||
|
height: 147mm
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
margin-bottom: -20;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="A5 landscape">
|
||||||
|
{{ range .Runners }}
|
||||||
|
<div class="sheet">
|
||||||
|
<img id="header_img" width="100%" src="data:image/png;base64,{{ loadImage "sponsoringheader" }}" />
|
||||||
|
<div style=" padding: 0 1rem 0 1rem;">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-10">
|
||||||
|
<div class="columns" style="padding-bottom: 0;">
|
||||||
|
<div class="column is-two-fifths">
|
||||||
|
<p style="font-size: large; font-weight: bold;">Sponsoring contract</p>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<p style="font-size: x-small; vertical-align: revert; margin-top: auto;">Please write in BLOCK LETTERS.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p> On the occasion of the {{ $.EventName }} I/We want to support </p>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-9">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .FirstName }}
|
||||||
|
{{ .MiddleName }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">First name</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-3">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .ID }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">ID</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<img style="vertical-align: revert; margin-top: auto; object-fit: cover; max-height: 2cm;"
|
||||||
|
src="data:image/png;base64,{{ barcode (printf "%d" .ID) $.BarcodeFormat $.BarcodePrefix }}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns" style="padding-top: 1rem;">
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .LastName }}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">Last Name</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{ .Group.Name}}</span>
|
||||||
|
<p style="font-size: x-small; display: block;">Team/class</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="margin-top: -0.5rem">with the amount of _____{{ $.CurrencySymbol }} per kilometer run.</p>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Last name</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-6">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">First name</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="font-size: medium; margin-top: -0.5rem;">Address (Sponsor)</p>
|
||||||
|
<p style="font-size: x-small;">(You have to provide an address if you want a donation receipt - Donation receipts can't be issued for total donation amounts under {{ $.ReceiptMinimumAmount }}{{ $.CurrencySymbol }})</p>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-8">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Street</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-4">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">House number</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-4">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Postal code</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-8">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">City</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns" style="margin-top: -1rem;">
|
||||||
|
<div class="column is-7">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Location, Date</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-5">
|
||||||
|
<span style="border-bottom: 1px solid; width: 100%; display: block;"> </span>
|
||||||
|
<p style="font-size: x-small; display: block;">Signature</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="font-size: xx-small; overflow: hidden; height: 4rem; text-align: center;">{{ $.Disclaimer }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user