refactor: Switch to pdf subpath
This commit is contained in:
parent
28de60d375
commit
8f676f08a9
@ -12,11 +12,11 @@ import (
|
||||
// GenerateCard godoc
|
||||
// @Summary Generate runner cards
|
||||
// @Description Generate cards based on the provided data
|
||||
// @Tags cards
|
||||
// @Tags pdfs
|
||||
// @Accept json
|
||||
// @Param data body models.CardRequest true "Card data"
|
||||
// @Produce application/pdf
|
||||
// @Router /cards [post]
|
||||
// @Router /v1/pdfs/cards [post]
|
||||
func (h *DefaultHandler) GenerateCard(c *fiber.Ctx) error {
|
||||
cardRequest := new(models.CardRequest)
|
||||
if err := c.BodyParser(cardRequest); err != nil {
|
||||
|
@ -12,11 +12,11 @@ import (
|
||||
// GenerateCertificate godoc
|
||||
// @Summary Generate runner certificates
|
||||
// @Description Generate certificates based on the provided data
|
||||
// @Tags certificates
|
||||
// @Tags pdfs
|
||||
// @Accept json
|
||||
// @Param data body models.CertificateRequest true "Certificate data"
|
||||
// @Produce application/pdf
|
||||
// @Router /certificates [post]
|
||||
// @Router /v1/pdfs/certificates [post]
|
||||
func (h *DefaultHandler) GenerateCertificate(c *fiber.Ctx) error {
|
||||
certificateRequest := new(models.CertificateRequest)
|
||||
if err := c.BodyParser(certificateRequest); err != nil {
|
||||
|
@ -12,11 +12,11 @@ import (
|
||||
// GenerateContract godoc
|
||||
// @Summary Generate a contract
|
||||
// @Description Generate a contract based on the provided data
|
||||
// @Tags contracts
|
||||
// @Tags pdfs
|
||||
// @Accept json
|
||||
// @Param data body models.ContractRequest true "Contract data"
|
||||
// @Produce application/pdf
|
||||
// @Router /contracts [post]
|
||||
// @Router /v1/pdfs/contracts [post]
|
||||
func (h *DefaultHandler) GenerateContract(c *fiber.Ctx) error {
|
||||
contract := new(models.ContractRequest)
|
||||
if err := c.BodyParser(contract); err != nil {
|
||||
|
19
main.go
19
main.go
@ -84,19 +84,22 @@ func main() {
|
||||
// Swagger documentation route
|
||||
app.Get("/swagger/*", swagger.HandlerDefault)
|
||||
|
||||
// @Security ApiKeyAuth
|
||||
v1 := app.Group("/v1")
|
||||
v1.Use(keyauth.New(keyauth.Config{
|
||||
|
||||
// @Security ApiKeyAuth
|
||||
pdfv1 := v1.Group("/pdfs")
|
||||
pdfv1.Use(keyauth.New(keyauth.Config{
|
||||
KeyLookup: "query:key",
|
||||
Validator: validateAPIKey,
|
||||
}))
|
||||
|
||||
v1.Get("/", func(c *fiber.Ctx) error {
|
||||
return c.SendString("Hello, World!")
|
||||
})
|
||||
v1.Post("/contracts", handler.GenerateContract)
|
||||
v1.Post("/cards", handler.GenerateCard)
|
||||
v1.Post("/certificates", handler.GenerateCertificate)
|
||||
pdfv1.Post("/contracts", handler.GenerateContract)
|
||||
pdfv1.Post("/cards", handler.GenerateCard)
|
||||
pdfv1.Post("/certificates", handler.GenerateCertificate)
|
||||
|
||||
barcodev1 := v1.Group("/barcodes")
|
||||
|
||||
barcodev1.Get("/:type/:content", handler.GenerateBarcode)
|
||||
|
||||
app.Use(handler.NotFoundHandler)
|
||||
docs.SwaggerInfo.BasePath = "/"
|
||||
|
Loading…
x
Reference in New Issue
Block a user