From 5857dfa62dc059ea8f9c1ae0322cdecc9e61508c Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Fri, 8 May 2026 13:46:27 -0300 Subject: [PATCH 1/8] feat: add OpenAPI/swagger, Playwright E2E, sqlc, and CI tooling upgrades --- .github/workflows/ci.yml | 91 + .gitignore | 8 +- .husky/commit-msg | 1 + .husky/pre-commit | 1 + .releaserc | 8 + Makefile | 22 +- backend/cmd/server/main.go | 28 + backend/docs/swagger/docs.go | 2549 +++++++++++++++++ backend/docs/swagger/swagger.json | 2525 ++++++++++++++++ backend/docs/swagger/swagger.yaml | 1569 ++++++++++ backend/go.mod | 30 +- backend/go.sum | 138 +- backend/internal/handlers/admin.go | 151 + backend/internal/handlers/auth.go | 56 + backend/internal/handlers/blog.go | 65 + backend/internal/handlers/coupon.go | 30 +- backend/internal/handlers/envconfig.go | 26 +- backend/internal/handlers/handler.go | 16 + backend/internal/handlers/jobs.go | 61 +- backend/internal/handlers/legal.go | 44 +- backend/internal/handlers/payment.go | 50 + backend/internal/handlers/security.go | 16 + backend/internal/handlers/store.go | 102 + backend/internal/handlers/tools.go | 6 + backend/internal/handlers/user.go | 39 + backend/internal/handlers/waitlist.go | 16 + .../infrastructure/sqlc/blog_posts.sql.go | 201 ++ .../infrastructure/sqlc/categories.sql.go | 88 + backend/internal/infrastructure/sqlc/db.go | 32 + .../internal/infrastructure/sqlc/models.go | 285 ++ .../infrastructure/sqlc/products.sql.go | 194 ++ .../internal/infrastructure/sqlc/querier.go | 42 + .../sqlc/queries/blog_posts.sql | 30 + .../sqlc/queries/categories.sql | 11 + .../infrastructure/sqlc/queries/products.sql | 29 + .../infrastructure/sqlc/queries/users.sql | 32 + .../internal/infrastructure/sqlc/users.sql.go | 244 ++ backend/sqlc.yaml | 12 + commitlint.config.js | 3 + e2e/basic.spec.ts | 11 + e2e/playwright.config.ts | 21 + frontend/bun.lock | 9 + frontend/package.json | 4 +- package-lock.json | 1264 ++++++++ package.json | 14 + renovate.json | 16 + 46 files changed, 10147 insertions(+), 43 deletions(-) create mode 100755 .husky/commit-msg create mode 100644 .husky/pre-commit create mode 100644 .releaserc create mode 100644 backend/docs/swagger/docs.go create mode 100644 backend/docs/swagger/swagger.json create mode 100644 backend/docs/swagger/swagger.yaml create mode 100644 backend/internal/infrastructure/sqlc/blog_posts.sql.go create mode 100644 backend/internal/infrastructure/sqlc/categories.sql.go create mode 100644 backend/internal/infrastructure/sqlc/db.go create mode 100644 backend/internal/infrastructure/sqlc/models.go create mode 100644 backend/internal/infrastructure/sqlc/products.sql.go create mode 100644 backend/internal/infrastructure/sqlc/querier.go create mode 100644 backend/internal/infrastructure/sqlc/queries/blog_posts.sql create mode 100644 backend/internal/infrastructure/sqlc/queries/categories.sql create mode 100644 backend/internal/infrastructure/sqlc/queries/products.sql create mode 100644 backend/internal/infrastructure/sqlc/queries/users.sql create mode 100644 backend/internal/infrastructure/sqlc/users.sql.go create mode 100644 backend/sqlc.yaml create mode 100644 commitlint.config.js create mode 100644 e2e/basic.spec.ts create mode 100644 e2e/playwright.config.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 renovate.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9539423..5a6b735 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,31 @@ env: BUN_VERSION: "1.2.21" jobs: + security: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + cache-dependency-path: backend/go.sum + + - name: govulncheck + working-directory: backend + run: | + go install golang.org/x/vuln/cmd/govulncheck@latest + govulncheck ./... + + - name: Gitleaks + uses: gitleaks/gitleaks-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build: runs-on: ubuntu-latest steps: @@ -39,6 +64,8 @@ jobs: cd backend go mod download go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2 + go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest + sqlc diff || (echo "sqlc generated code is out of date. Run 'make sqlc' to regenerate." && exit 1) go vet ./... golangci-lint run ./... go test ./... -race -count=1 @@ -51,3 +78,67 @@ jobs: bun run vue-tsc --noEmit bun run test bun run build + + e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: ${{ env.BUN_VERSION }} + cache: true + + - name: Start services + run: docker compose up -d + timeout-minutes: 3 + + - name: Wait for health + run: | + for i in $(seq 1 30); do + curl -s http://localhost/healthz && break + sleep 2 + done + + - name: Install Playwright + run: | + cd frontend + bun install --frozen-lockfile + bunx playwright install chromium + + - name: Run E2E tests + run: bunx playwright test --config e2e/playwright.config.ts + + - name: Upload report + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: e2e/playwright-report/ + + - name: Cleanup + if: always() + run: docker compose down -v + + release: + needs: [security, build, e2e] + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install semantic-release + run: npm install -g semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/github + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: semantic-release diff --git a/.gitignore b/.gitignore index dc28abd..494385f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,8 @@ backend/uploads/ backend/tmp/ build/ -# Frontend +# Node +node_modules/ frontend/node_modules/ frontend/dist/ frontend/.env.local @@ -23,3 +24,8 @@ frontend/.env.local # OS .DS_Store + +# E2E +e2e/test-results/ +e2e/playwright-report/ + diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..da99483 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +npx --no -- commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..72c4429 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm test diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..7bf05ec --- /dev/null +++ b/.releaserc @@ -0,0 +1,8 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] +} diff --git a/Makefile b/Makefile index df5e077..e92c4a4 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ fmt fmt-backend fmt-frontend \ typecheck tidy vet \ deadcode deadcode-backend deadcode-frontend \ - check ci clean help + vulncheck swagger sqlc check ci clean help # === Local Development (tudo via Docker, 1 porta) === @@ -117,6 +117,24 @@ fmt-frontend: vet: cd backend && go vet ./... +## Vulnerability scan (Go dependencies) +vulncheck: + cd backend && go run golang.org/x/vuln/cmd/govulncheck@latest ./... + +## Generate OpenAPI/Swagger docs +swagger: + cd backend && go run github.com/swaggo/swag/cmd/swag@latest init \ + --generalInfo cmd/server/main.go \ + --output docs/swagger \ + --parseDependency --parseDepth 2 + +## Generate SQL code from queries +sqlc: + cd backend && sqlc generate + +e2e: + npx playwright test --config e2e/playwright.config.ts + tidy: cd backend && go mod tidy @@ -141,7 +159,7 @@ deadcode-frontend: cd frontend && bunx --bun depcheck || true ## Aggregate checks used locally and in CI -check: fmt-backend lint test +check: fmt-backend lint sqlc test ci: lint test @echo "CI checks passed." diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index acbe865..32bab3a 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -1,3 +1,23 @@ +// Blueprint API — Full-stack starter kit +// +// @title Blueprint API +// @version 1.0.0 +// @description Full-stack starter kit with Go + Fiber backend and Vue 3 frontend. +// @termsOfService https://github.com/afa/blueprint + +// @contact.name Blueprint Maintainer +// @contact.url https://github.com/afa/blueprint + +// @license.name MIT +// @license.url https://github.com/afa/blueprint/blob/main/LICENSE + +// @host localhost:8080 +// @BasePath /api/v1 + +// @securityDefinitions.apikey BearerAuth +// @in header +// @name Authorization +// @description JWT token (Bearer ) package main import ( @@ -7,6 +27,7 @@ import ( "log" "time" + "github.com/gofiber/contrib/swagger" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/logger" @@ -98,6 +119,13 @@ func main() { return nil }) + // Swagger UI + app.Get("/swagger/*", swagger.New(swagger.Config{ + BasePath: "/", + FilePath: "docs/swagger/swagger.json", + Path: "/swagger", + })) + // Health check app.Get("/healthz", func(c *fiber.Ctx) error { if err := pool.Ping(c.Context()); err != nil { diff --git a/backend/docs/swagger/docs.go b/backend/docs/swagger/docs.go new file mode 100644 index 0000000..9d34604 --- /dev/null +++ b/backend/docs/swagger/docs.go @@ -0,0 +1,2549 @@ +// Package swagger Code generated by swaggo/swag. DO NOT EDIT +package swagger + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "termsOfService": "https://github.com/afa/blueprint", + "contact": { + "name": "Blueprint Maintainer", + "url": "https://github.com/afa/blueprint" + }, + "license": { + "name": "MIT", + "url": "https://github.com/afa/blueprint/blob/main/LICENSE" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/admin/banners": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all banners (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a banner (admin)", + "responses": {} + } + }, + "/admin/banners/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a banner (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a banner (admin)", + "responses": {} + } + }, + "/admin/blog": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all blog posts (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a blog post (admin)", + "responses": {} + } + }, + "/admin/blog/ai-generate": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Generate blog post with AI (admin)", + "responses": {} + } + }, + "/admin/blog/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a blog post (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a blog post (admin)", + "responses": {} + } + }, + "/admin/blog/{id}/cover": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Upload cover image for a blog post (admin)", + "responses": {} + } + }, + "/admin/brand-kit": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Get brand kit (admin)", + "responses": {} + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update brand kit (admin)", + "responses": {} + } + }, + "/admin/categories": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all categories (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a category (admin)", + "responses": {} + } + }, + "/admin/categories/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a category (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a category (admin)", + "responses": {} + } + }, + "/admin/config/env": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List environment variable status (admin)", + "responses": {} + } + }, + "/admin/config/export": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "text/plain" + ], + "tags": [ + "Admin" + ], + "summary": "Export configuration as .env file (admin)", + "responses": {} + } + }, + "/admin/config/import": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "text/plain" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Import configuration from .env format (admin)", + "responses": {} + } + }, + "/admin/coupons": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all coupons (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a coupon (admin)", + "responses": {} + } + }, + "/admin/coupons/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a coupon (admin)", + "responses": {} + } + }, + "/admin/email-groups": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List email groups (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create an email group (admin)", + "responses": {} + } + }, + "/admin/email-groups/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete an email group (admin)", + "responses": {} + } + }, + "/admin/email-groups/{id}/subscribers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List subscribers in a group (admin)", + "responses": {} + } + }, + "/admin/email-subscriptions": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Add an email subscription (admin)", + "responses": {} + } + }, + "/admin/email-subscriptions/{email}/deactivate": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Deactivate an email subscription (admin)", + "responses": {} + } + }, + "/admin/features/{key}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Toggle a feature flag", + "parameters": [ + { + "type": "string", + "description": "Feature flag key", + "name": "key", + "in": "path", + "required": true + }, + { + "description": "Flag state", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/jobs": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all cron jobs (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/handlers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List registered job handlers (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a cron job (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/executions": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List job execution history (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/executions/{eid}/retry": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Retry a failed job execution (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/pause": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Pause a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/resume": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Resume a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/run": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Trigger a job immediately (admin)", + "responses": {} + } + }, + "/admin/legal": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all legal pages (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a legal page (admin)", + "responses": {} + } + }, + "/admin/legal/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a legal page (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a legal page (admin)", + "responses": {} + } + }, + "/admin/linktree": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List linktree items (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a linktree item (admin)", + "responses": {} + } + }, + "/admin/linktree/reorder": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Reorder linktree items (admin)", + "responses": {} + } + }, + "/admin/linktree/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a linktree item (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a linktree item (admin)", + "responses": {} + } + }, + "/admin/orders": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all orders (admin)", + "responses": {} + } + }, + "/admin/orders/{id}/approve-pix": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Approve a PIX payment (admin)", + "responses": {} + } + }, + "/admin/orders/{id}/status": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update order status (admin)", + "responses": {} + } + }, + "/admin/pix-config": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Get PIX configuration (admin)", + "responses": {} + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update PIX configuration (admin)", + "responses": {} + } + }, + "/admin/products": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all products (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a product (admin)", + "responses": {} + } + }, + "/admin/products/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a product (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a product (admin)", + "responses": {} + } + }, + "/admin/security": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List security settings (admin)", + "responses": {} + } + }, + "/admin/security/{key}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a security setting (admin)", + "parameters": [ + { + "type": "string", + "description": "Setting key", + "name": "key", + "in": "path", + "required": true + }, + { + "description": "New value", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/tools": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List admin tools (admin)", + "responses": {} + } + }, + "/admin/upload": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Upload a file (admin)", + "parameters": [ + { + "type": "file", + "description": "File to upload", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Upload prefix (uploads/covers/banners/linktree/brand-kit/products)", + "name": "prefix", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/user-groups": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List user groups (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a user group (admin)", + "responses": {} + } + }, + "/admin/user-groups/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a user group (admin)", + "responses": {} + } + }, + "/admin/users": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all users (admin)", + "responses": {} + } + }, + "/admin/users/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a user (admin)", + "responses": {} + } + }, + "/admin/users/{id}/role": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update user role (admin)", + "responses": {} + } + }, + "/auth/forgot-password": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Request password reset email", + "parameters": [ + { + "description": "Registered email", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/login": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Login with email and password", + "parameters": [ + { + "description": "Login credentials", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/logout": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Logout and clear auth cookies", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Get current user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handlers.userResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/refresh": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Refresh access token", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/register": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Register a new user", + "parameters": [ + { + "description": "User credentials", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + } + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/reset-password": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Reset password with token", + "parameters": [ + { + "description": "Reset token and new password", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "token": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/blog": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Blog" + ], + "summary": "List published blog posts", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/blog/atom.xml": { + "get": { + "produces": [ + "text/xml" + ], + "tags": [ + "Blog" + ], + "summary": "Atom feed of published posts", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/blog/rss.xml": { + "get": { + "produces": [ + "text/xml" + ], + "tags": [ + "Blog" + ], + "summary": "RSS feed of published posts", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/blog/{slug}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Blog" + ], + "summary": "Get a blog post by slug", + "parameters": [ + { + "type": "string", + "description": "Post slug", + "name": "slug", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.BlogPost" + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/categories": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "List product categories", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.Category" + } + } + } + } + } + }, + "/coupons/validate": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Coupons" + ], + "summary": "Validate a coupon code", + "parameters": [ + { + "description": "Coupon code and subtotal", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "subtotal": { + "type": "number" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/features": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Features" + ], + "summary": "List all feature flags", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.FeatureFlag" + } + } + } + } + } + }, + "/legal": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Legal" + ], + "summary": "List active legal pages", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "title": { + "type": "string" + } + } + } + } + } + } + } + }, + "/legal/{slug}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Legal" + ], + "summary": "Get a legal page by slug", + "parameters": [ + { + "type": "string", + "description": "Page slug", + "name": "slug", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.LegalPage" + } + } + } + } + }, + "/orders": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "Create a new order", + "parameters": [ + { + "description": "Order details", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handlers.createOrderRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.Order" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/orders/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "List current user's orders", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/pix": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Create a PIX payment", + "parameters": [ + { + "description": "Order ID", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handlers.createPaymentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/pix/{order_id}/receipt": { + "post": { + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Upload PIX payment receipt", + "parameters": [ + { + "type": "string", + "description": "Order ID", + "name": "order_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/stripe": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Create a Stripe payment intent", + "parameters": [ + { + "description": "Order ID", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handlers.createPaymentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/stripe/webhook": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Handle Stripe webhook events", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/products": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "List active products", + "parameters": [ + { + "type": "string", + "description": "Filter by category", + "name": "category_id", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "Page number", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 20, + "description": "Items per page", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/products/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "Get a product by ID", + "parameters": [ + { + "type": "string", + "description": "Product ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.Product" + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/user/password": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Change user password", + "responses": {} + } + }, + "/user/profile": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Get user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handlers.profileResponse" + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Update user profile", + "responses": {} + } + }, + "/user/saved-cards": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "List saved payment cards", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Create Stripe SetupIntent for saved cards", + "responses": {} + } + }, + "/user/saved-cards/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Delete a saved payment card", + "responses": {} + } + }, + "/waitlist": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List waitlist entries (admin)", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.WaitlistEntry" + } + } + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Waitlist" + ], + "summary": "Join the waitlist", + "parameters": [ + { + "description": "Email and optional name", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "Conflict", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + } + }, + "definitions": { + "github_com_afa_blueprint_backend_internal_domain.BlogPost": { + "type": "object", + "properties": { + "author_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "excerpt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "metadata": { + "type": "array", + "items": { + "type": "integer" + } + }, + "published_at": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "status": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.Category": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parent_id": { + "type": "string" + }, + "slug": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.FeatureFlag": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "id": { + "type": "integer" + }, + "key": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.LegalPage": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "slug": { + "type": "string" + }, + "title": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.Order": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "payment_id": { + "type": "string" + }, + "payment_method": { + "type": "string" + }, + "receipt_url": { + "type": "string" + }, + "shipping_address": { + "type": "array", + "items": { + "type": "integer" + } + }, + "status": { + "type": "string" + }, + "total": { + "type": "number" + }, + "tracking_code": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.Product": { + "type": "object", + "properties": { + "category_id": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "integer" + } + }, + "is_active": { + "type": "boolean" + }, + "is_pre_sale": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "pre_sale_available_at": { + "type": "string" + }, + "price": { + "type": "number" + }, + "stock": { + "type": "integer" + }, + "updated_at": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.WaitlistEntry": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "source": { + "type": "string" + } + } + }, + "internal_handlers.createOrderItem": { + "type": "object", + "properties": { + "product_id": { + "type": "string" + }, + "quantity": { + "type": "integer" + } + } + }, + "internal_handlers.createOrderRequest": { + "type": "object", + "properties": { + "coupon_code": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/internal_handlers.createOrderItem" + } + }, + "payment_method": { + "type": "string" + }, + "shipping": { + "type": "object", + "additionalProperties": true + }, + "shipping_address": { + "type": "object", + "additionalProperties": true + } + } + }, + "internal_handlers.createPaymentRequest": { + "type": "object", + "properties": { + "order_id": { + "type": "string" + } + } + }, + "internal_handlers.profileResponse": { + "type": "object", + "properties": { + "address": { + "type": "array", + "items": { + "type": "integer" + } + }, + "avatar_url": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "role": { + "type": "string" + }, + "stripe_customer_id": { + "type": "string" + } + } + }, + "internal_handlers.userResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "BearerAuth": { + "description": "JWT token (Bearer \u003ctoken\u003e)", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0.0", + Host: "localhost:8080", + BasePath: "/api/v1", + Schemes: []string{}, + Title: "Blueprint API", + Description: "Full-stack starter kit with Go + Fiber backend and Vue 3 frontend.", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/backend/docs/swagger/swagger.json b/backend/docs/swagger/swagger.json new file mode 100644 index 0000000..5ca2d0f --- /dev/null +++ b/backend/docs/swagger/swagger.json @@ -0,0 +1,2525 @@ +{ + "swagger": "2.0", + "info": { + "description": "Full-stack starter kit with Go + Fiber backend and Vue 3 frontend.", + "title": "Blueprint API", + "termsOfService": "https://github.com/afa/blueprint", + "contact": { + "name": "Blueprint Maintainer", + "url": "https://github.com/afa/blueprint" + }, + "license": { + "name": "MIT", + "url": "https://github.com/afa/blueprint/blob/main/LICENSE" + }, + "version": "1.0.0" + }, + "host": "localhost:8080", + "basePath": "/api/v1", + "paths": { + "/admin/banners": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all banners (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a banner (admin)", + "responses": {} + } + }, + "/admin/banners/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a banner (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a banner (admin)", + "responses": {} + } + }, + "/admin/blog": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all blog posts (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a blog post (admin)", + "responses": {} + } + }, + "/admin/blog/ai-generate": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Generate blog post with AI (admin)", + "responses": {} + } + }, + "/admin/blog/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a blog post (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a blog post (admin)", + "responses": {} + } + }, + "/admin/blog/{id}/cover": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Upload cover image for a blog post (admin)", + "responses": {} + } + }, + "/admin/brand-kit": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Get brand kit (admin)", + "responses": {} + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update brand kit (admin)", + "responses": {} + } + }, + "/admin/categories": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all categories (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a category (admin)", + "responses": {} + } + }, + "/admin/categories/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a category (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a category (admin)", + "responses": {} + } + }, + "/admin/config/env": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List environment variable status (admin)", + "responses": {} + } + }, + "/admin/config/export": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "text/plain" + ], + "tags": [ + "Admin" + ], + "summary": "Export configuration as .env file (admin)", + "responses": {} + } + }, + "/admin/config/import": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "text/plain" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Import configuration from .env format (admin)", + "responses": {} + } + }, + "/admin/coupons": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all coupons (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a coupon (admin)", + "responses": {} + } + }, + "/admin/coupons/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a coupon (admin)", + "responses": {} + } + }, + "/admin/email-groups": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List email groups (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create an email group (admin)", + "responses": {} + } + }, + "/admin/email-groups/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete an email group (admin)", + "responses": {} + } + }, + "/admin/email-groups/{id}/subscribers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List subscribers in a group (admin)", + "responses": {} + } + }, + "/admin/email-subscriptions": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Add an email subscription (admin)", + "responses": {} + } + }, + "/admin/email-subscriptions/{email}/deactivate": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Deactivate an email subscription (admin)", + "responses": {} + } + }, + "/admin/features/{key}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Toggle a feature flag", + "parameters": [ + { + "type": "string", + "description": "Feature flag key", + "name": "key", + "in": "path", + "required": true + }, + { + "description": "Flag state", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/jobs": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all cron jobs (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/handlers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List registered job handlers (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a cron job (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/executions": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List job execution history (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/executions/{eid}/retry": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Retry a failed job execution (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/pause": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Pause a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/resume": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Resume a cron job (admin)", + "responses": {} + } + }, + "/admin/jobs/{id}/run": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Trigger a job immediately (admin)", + "responses": {} + } + }, + "/admin/legal": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all legal pages (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a legal page (admin)", + "responses": {} + } + }, + "/admin/legal/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a legal page (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a legal page (admin)", + "responses": {} + } + }, + "/admin/linktree": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List linktree items (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a linktree item (admin)", + "responses": {} + } + }, + "/admin/linktree/reorder": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Reorder linktree items (admin)", + "responses": {} + } + }, + "/admin/linktree/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a linktree item (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a linktree item (admin)", + "responses": {} + } + }, + "/admin/orders": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all orders (admin)", + "responses": {} + } + }, + "/admin/orders/{id}/approve-pix": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Approve a PIX payment (admin)", + "responses": {} + } + }, + "/admin/orders/{id}/status": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update order status (admin)", + "responses": {} + } + }, + "/admin/pix-config": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Get PIX configuration (admin)", + "responses": {} + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update PIX configuration (admin)", + "responses": {} + } + }, + "/admin/products": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all products (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a product (admin)", + "responses": {} + } + }, + "/admin/products/{id}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a product (admin)", + "responses": {} + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a product (admin)", + "responses": {} + } + }, + "/admin/security": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List security settings (admin)", + "responses": {} + } + }, + "/admin/security/{key}": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update a security setting (admin)", + "parameters": [ + { + "type": "string", + "description": "Setting key", + "name": "key", + "in": "path", + "required": true + }, + { + "description": "New value", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/tools": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List admin tools (admin)", + "responses": {} + } + }, + "/admin/upload": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Upload a file (admin)", + "parameters": [ + { + "type": "file", + "description": "File to upload", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Upload prefix (uploads/covers/banners/linktree/brand-kit/products)", + "name": "prefix", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/user-groups": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List user groups (admin)", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Create a user group (admin)", + "responses": {} + } + }, + "/admin/user-groups/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a user group (admin)", + "responses": {} + } + }, + "/admin/users": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List all users (admin)", + "responses": {} + } + }, + "/admin/users/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "tags": [ + "Admin" + ], + "summary": "Delete a user (admin)", + "responses": {} + } + }, + "/admin/users/{id}/role": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "Update user role (admin)", + "responses": {} + } + }, + "/auth/forgot-password": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Request password reset email", + "parameters": [ + { + "description": "Registered email", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/login": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Login with email and password", + "parameters": [ + { + "description": "Login credentials", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/logout": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Logout and clear auth cookies", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Get current user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handlers.userResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/refresh": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Refresh access token", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/register": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Register a new user", + "parameters": [ + { + "description": "User credentials", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + } + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/auth/reset-password": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "summary": "Reset password with token", + "parameters": [ + { + "description": "Reset token and new password", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "token": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/blog": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Blog" + ], + "summary": "List published blog posts", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/blog/atom.xml": { + "get": { + "produces": [ + "text/xml" + ], + "tags": [ + "Blog" + ], + "summary": "Atom feed of published posts", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/blog/rss.xml": { + "get": { + "produces": [ + "text/xml" + ], + "tags": [ + "Blog" + ], + "summary": "RSS feed of published posts", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/blog/{slug}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Blog" + ], + "summary": "Get a blog post by slug", + "parameters": [ + { + "type": "string", + "description": "Post slug", + "name": "slug", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.BlogPost" + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/categories": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "List product categories", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.Category" + } + } + } + } + } + }, + "/coupons/validate": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Coupons" + ], + "summary": "Validate a coupon code", + "parameters": [ + { + "description": "Coupon code and subtotal", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "subtotal": { + "type": "number" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/features": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Features" + ], + "summary": "List all feature flags", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.FeatureFlag" + } + } + } + } + } + }, + "/legal": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Legal" + ], + "summary": "List active legal pages", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "title": { + "type": "string" + } + } + } + } + } + } + } + }, + "/legal/{slug}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Legal" + ], + "summary": "Get a legal page by slug", + "parameters": [ + { + "type": "string", + "description": "Page slug", + "name": "slug", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.LegalPage" + } + } + } + } + }, + "/orders": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "Create a new order", + "parameters": [ + { + "description": "Order details", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handlers.createOrderRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.Order" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/orders/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "List current user's orders", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/pix": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Create a PIX payment", + "parameters": [ + { + "description": "Order ID", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handlers.createPaymentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/pix/{order_id}/receipt": { + "post": { + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Upload PIX payment receipt", + "parameters": [ + { + "type": "string", + "description": "Order ID", + "name": "order_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/stripe": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Create a Stripe payment intent", + "parameters": [ + { + "description": "Order ID", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handlers.createPaymentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/payments/stripe/webhook": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Handle Stripe webhook events", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/products": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "List active products", + "parameters": [ + { + "type": "string", + "description": "Filter by category", + "name": "category_id", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "Page number", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 20, + "description": "Items per page", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/products/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Store" + ], + "summary": "Get a product by ID", + "parameters": [ + { + "type": "string", + "description": "Product ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.Product" + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/user/password": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Change user password", + "responses": {} + } + }, + "/user/profile": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Get user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/internal_handlers.profileResponse" + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Update user profile", + "responses": {} + } + }, + "/user/saved-cards": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "List saved payment cards", + "responses": {} + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Create Stripe SetupIntent for saved cards", + "responses": {} + } + }, + "/user/saved-cards/{id}": { + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "User" + ], + "summary": "Delete a saved payment card", + "responses": {} + } + }, + "/waitlist": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin" + ], + "summary": "List waitlist entries (admin)", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.WaitlistEntry" + } + } + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Waitlist" + ], + "summary": "Join the waitlist", + "parameters": [ + { + "description": "Email and optional name", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "Conflict", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + } + }, + "definitions": { + "github_com_afa_blueprint_backend_internal_domain.BlogPost": { + "type": "object", + "properties": { + "author_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "excerpt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "metadata": { + "type": "array", + "items": { + "type": "integer" + } + }, + "published_at": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "status": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.Category": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parent_id": { + "type": "string" + }, + "slug": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.FeatureFlag": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "id": { + "type": "integer" + }, + "key": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.LegalPage": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "slug": { + "type": "string" + }, + "title": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.Order": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "payment_id": { + "type": "string" + }, + "payment_method": { + "type": "string" + }, + "receipt_url": { + "type": "string" + }, + "shipping_address": { + "type": "array", + "items": { + "type": "integer" + } + }, + "status": { + "type": "string" + }, + "total": { + "type": "number" + }, + "tracking_code": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.Product": { + "type": "object", + "properties": { + "category_id": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "integer" + } + }, + "is_active": { + "type": "boolean" + }, + "is_pre_sale": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "pre_sale_available_at": { + "type": "string" + }, + "price": { + "type": "number" + }, + "stock": { + "type": "integer" + }, + "updated_at": { + "type": "string" + } + } + }, + "github_com_afa_blueprint_backend_internal_domain.WaitlistEntry": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "source": { + "type": "string" + } + } + }, + "internal_handlers.createOrderItem": { + "type": "object", + "properties": { + "product_id": { + "type": "string" + }, + "quantity": { + "type": "integer" + } + } + }, + "internal_handlers.createOrderRequest": { + "type": "object", + "properties": { + "coupon_code": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/internal_handlers.createOrderItem" + } + }, + "payment_method": { + "type": "string" + }, + "shipping": { + "type": "object", + "additionalProperties": true + }, + "shipping_address": { + "type": "object", + "additionalProperties": true + } + } + }, + "internal_handlers.createPaymentRequest": { + "type": "object", + "properties": { + "order_id": { + "type": "string" + } + } + }, + "internal_handlers.profileResponse": { + "type": "object", + "properties": { + "address": { + "type": "array", + "items": { + "type": "integer" + } + }, + "avatar_url": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "role": { + "type": "string" + }, + "stripe_customer_id": { + "type": "string" + } + } + }, + "internal_handlers.userResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "BearerAuth": { + "description": "JWT token (Bearer \u003ctoken\u003e)", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/backend/docs/swagger/swagger.yaml b/backend/docs/swagger/swagger.yaml new file mode 100644 index 0000000..cf536ab --- /dev/null +++ b/backend/docs/swagger/swagger.yaml @@ -0,0 +1,1569 @@ +basePath: /api/v1 +definitions: + github_com_afa_blueprint_backend_internal_domain.BlogPost: + properties: + author_id: + type: string + content: + type: string + cover_image: + type: string + created_at: + type: string + excerpt: + type: string + id: + type: string + metadata: + items: + type: integer + type: array + published_at: + type: string + slug: + type: string + status: + type: string + title: + type: string + type: object + github_com_afa_blueprint_backend_internal_domain.Category: + properties: + id: + type: string + name: + type: string + parent_id: + type: string + slug: + type: string + type: object + github_com_afa_blueprint_backend_internal_domain.FeatureFlag: + properties: + enabled: + type: boolean + id: + type: integer + key: + type: string + updated_at: + type: string + type: object + github_com_afa_blueprint_backend_internal_domain.LegalPage: + properties: + content: + type: string + id: + type: string + is_active: + type: boolean + slug: + type: string + title: + type: string + updated_at: + type: string + type: object + github_com_afa_blueprint_backend_internal_domain.Order: + properties: + created_at: + type: string + id: + type: string + payment_id: + type: string + payment_method: + type: string + receipt_url: + type: string + shipping_address: + items: + type: integer + type: array + status: + type: string + total: + type: number + tracking_code: + type: string + updated_at: + type: string + user_id: + type: string + type: object + github_com_afa_blueprint_backend_internal_domain.Product: + properties: + category_id: + type: string + created_at: + type: string + description: + type: string + id: + type: string + images: + items: + type: integer + type: array + is_active: + type: boolean + is_pre_sale: + type: boolean + name: + type: string + pre_sale_available_at: + type: string + price: + type: number + stock: + type: integer + updated_at: + type: string + type: object + github_com_afa_blueprint_backend_internal_domain.WaitlistEntry: + properties: + created_at: + type: string + email: + type: string + id: + type: string + name: + type: string + source: + type: string + type: object + internal_handlers.createOrderItem: + properties: + product_id: + type: string + quantity: + type: integer + type: object + internal_handlers.createOrderRequest: + properties: + coupon_code: + type: string + items: + items: + $ref: '#/definitions/internal_handlers.createOrderItem' + type: array + payment_method: + type: string + shipping: + additionalProperties: true + type: object + shipping_address: + additionalProperties: true + type: object + type: object + internal_handlers.createPaymentRequest: + properties: + order_id: + type: string + type: object + internal_handlers.profileResponse: + properties: + address: + items: + type: integer + type: array + avatar_url: + type: string + email: + type: string + email_verified: + type: boolean + id: + type: string + name: + type: string + phone: + type: string + role: + type: string + stripe_customer_id: + type: string + type: object + internal_handlers.userResponse: + properties: + created_at: + type: string + email: + type: string + email_verified: + type: boolean + id: + type: string + name: + type: string + role: + type: string + updated_at: + type: string + type: object +host: localhost:8080 +info: + contact: + name: Blueprint Maintainer + url: https://github.com/afa/blueprint + description: Full-stack starter kit with Go + Fiber backend and Vue 3 frontend. + license: + name: MIT + url: https://github.com/afa/blueprint/blob/main/LICENSE + termsOfService: https://github.com/afa/blueprint + title: Blueprint API + version: 1.0.0 +paths: + /admin/banners: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all banners (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a banner (admin) + tags: + - Admin + /admin/banners/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a banner (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a banner (admin) + tags: + - Admin + /admin/blog: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all blog posts (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a blog post (admin) + tags: + - Admin + /admin/blog/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a blog post (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a blog post (admin) + tags: + - Admin + /admin/blog/{id}/cover: + post: + consumes: + - multipart/form-data + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Upload cover image for a blog post (admin) + tags: + - Admin + /admin/blog/ai-generate: + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Generate blog post with AI (admin) + tags: + - Admin + /admin/brand-kit: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Get brand kit (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update brand kit (admin) + tags: + - Admin + /admin/categories: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all categories (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a category (admin) + tags: + - Admin + /admin/categories/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a category (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a category (admin) + tags: + - Admin + /admin/config/env: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List environment variable status (admin) + tags: + - Admin + /admin/config/export: + get: + produces: + - text/plain + responses: {} + security: + - BearerAuth: [] + summary: Export configuration as .env file (admin) + tags: + - Admin + /admin/config/import: + post: + consumes: + - text/plain + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Import configuration from .env format (admin) + tags: + - Admin + /admin/coupons: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all coupons (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a coupon (admin) + tags: + - Admin + /admin/coupons/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a coupon (admin) + tags: + - Admin + /admin/email-groups: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List email groups (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create an email group (admin) + tags: + - Admin + /admin/email-groups/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete an email group (admin) + tags: + - Admin + /admin/email-groups/{id}/subscribers: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List subscribers in a group (admin) + tags: + - Admin + /admin/email-subscriptions: + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Add an email subscription (admin) + tags: + - Admin + /admin/email-subscriptions/{email}/deactivate: + put: + responses: {} + security: + - BearerAuth: [] + summary: Deactivate an email subscription (admin) + tags: + - Admin + /admin/features/{key}: + put: + consumes: + - application/json + parameters: + - description: Feature flag key + in: path + name: key + required: true + type: string + - description: Flag state + in: body + name: body + required: true + schema: + properties: + enabled: + type: boolean + type: object + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + security: + - BearerAuth: [] + summary: Toggle a feature flag + tags: + - Admin + /admin/jobs: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all cron jobs (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a cron job (admin) + tags: + - Admin + /admin/jobs/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a cron job (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a cron job (admin) + tags: + - Admin + /admin/jobs/{id}/executions: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List job execution history (admin) + tags: + - Admin + /admin/jobs/{id}/executions/{eid}/retry: + post: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Retry a failed job execution (admin) + tags: + - Admin + /admin/jobs/{id}/pause: + put: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Pause a cron job (admin) + tags: + - Admin + /admin/jobs/{id}/resume: + put: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Resume a cron job (admin) + tags: + - Admin + /admin/jobs/{id}/run: + post: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Trigger a job immediately (admin) + tags: + - Admin + /admin/jobs/handlers: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List registered job handlers (admin) + tags: + - Admin + /admin/legal: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all legal pages (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a legal page (admin) + tags: + - Admin + /admin/legal/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a legal page (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a legal page (admin) + tags: + - Admin + /admin/linktree: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List linktree items (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a linktree item (admin) + tags: + - Admin + /admin/linktree/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a linktree item (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a linktree item (admin) + tags: + - Admin + /admin/linktree/reorder: + put: + consumes: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Reorder linktree items (admin) + tags: + - Admin + /admin/orders: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all orders (admin) + tags: + - Admin + /admin/orders/{id}/approve-pix: + put: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Approve a PIX payment (admin) + tags: + - Admin + /admin/orders/{id}/status: + put: + consumes: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update order status (admin) + tags: + - Admin + /admin/pix-config: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Get PIX configuration (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update PIX configuration (admin) + tags: + - Admin + /admin/products: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all products (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a product (admin) + tags: + - Admin + /admin/products/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a product (admin) + tags: + - Admin + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update a product (admin) + tags: + - Admin + /admin/security: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List security settings (admin) + tags: + - Admin + /admin/security/{key}: + put: + consumes: + - application/json + parameters: + - description: Setting key + in: path + name: key + required: true + type: string + - description: New value + in: body + name: body + required: true + schema: + properties: + value: + type: string + type: object + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + security: + - BearerAuth: [] + summary: Update a security setting (admin) + tags: + - Admin + /admin/tools: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List admin tools (admin) + tags: + - Admin + /admin/upload: + post: + consumes: + - multipart/form-data + parameters: + - description: File to upload + in: formData + name: file + required: true + type: file + - description: Upload prefix (uploads/covers/banners/linktree/brand-kit/products) + in: formData + name: prefix + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + security: + - BearerAuth: [] + summary: Upload a file (admin) + tags: + - Admin + /admin/user-groups: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List user groups (admin) + tags: + - Admin + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create a user group (admin) + tags: + - Admin + /admin/user-groups/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a user group (admin) + tags: + - Admin + /admin/users: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List all users (admin) + tags: + - Admin + /admin/users/{id}: + delete: + responses: {} + security: + - BearerAuth: [] + summary: Delete a user (admin) + tags: + - Admin + /admin/users/{id}/role: + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update user role (admin) + tags: + - Admin + /auth/forgot-password: + post: + consumes: + - application/json + parameters: + - description: Registered email + in: body + name: body + required: true + schema: + properties: + email: + type: string + type: object + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Request password reset email + tags: + - Auth + /auth/login: + post: + consumes: + - application/json + parameters: + - description: Login credentials + in: body + name: body + required: true + schema: + properties: + email: + type: string + password: + type: string + type: object + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + "401": + description: Unauthorized + schema: + additionalProperties: true + type: object + summary: Login with email and password + tags: + - Auth + /auth/logout: + post: + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Logout and clear auth cookies + tags: + - Auth + /auth/me: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/internal_handlers.userResponse' + "404": + description: Not Found + schema: + additionalProperties: true + type: object + security: + - BearerAuth: [] + summary: Get current user profile + tags: + - Auth + /auth/refresh: + post: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + "401": + description: Unauthorized + schema: + additionalProperties: true + type: object + summary: Refresh access token + tags: + - Auth + /auth/register: + post: + consumes: + - application/json + parameters: + - description: User credentials + in: body + name: body + required: true + schema: + properties: + email: + type: string + name: + type: string + password: + type: string + type: object + produces: + - application/json + responses: + "201": + description: Created + schema: + additionalProperties: true + type: object + "400": + description: Bad Request + schema: + additionalProperties: true + type: object + summary: Register a new user + tags: + - Auth + /auth/reset-password: + post: + consumes: + - application/json + parameters: + - description: Reset token and new password + in: body + name: body + required: true + schema: + properties: + password: + type: string + token: + type: string + type: object + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Reset password with token + tags: + - Auth + /blog: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: List published blog posts + tags: + - Blog + /blog/{slug}: + get: + parameters: + - description: Post slug + in: path + name: slug + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.BlogPost' + "404": + description: Not Found + schema: + additionalProperties: true + type: object + summary: Get a blog post by slug + tags: + - Blog + /blog/atom.xml: + get: + produces: + - text/xml + responses: + "200": + description: OK + schema: + type: string + summary: Atom feed of published posts + tags: + - Blog + /blog/rss.xml: + get: + produces: + - text/xml + responses: + "200": + description: OK + schema: + type: string + summary: RSS feed of published posts + tags: + - Blog + /categories: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.Category' + type: array + summary: List product categories + tags: + - Store + /coupons/validate: + post: + consumes: + - application/json + parameters: + - description: Coupon code and subtotal + in: body + name: body + required: true + schema: + properties: + code: + type: string + subtotal: + type: number + type: object + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Validate a coupon code + tags: + - Coupons + /features: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.FeatureFlag' + type: array + summary: List all feature flags + tags: + - Features + /legal: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + properties: + slug: + type: string + title: + type: string + type: object + type: array + summary: List active legal pages + tags: + - Legal + /legal/{slug}: + get: + parameters: + - description: Page slug + in: path + name: slug + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.LegalPage' + summary: Get a legal page by slug + tags: + - Legal + /orders: + post: + consumes: + - application/json + parameters: + - description: Order details + in: body + name: body + required: true + schema: + $ref: '#/definitions/internal_handlers.createOrderRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.Order' + "400": + description: Bad Request + schema: + additionalProperties: true + type: object + security: + - BearerAuth: [] + summary: Create a new order + tags: + - Store + /orders/me: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + security: + - BearerAuth: [] + summary: List current user's orders + tags: + - Store + /payments/pix: + post: + consumes: + - application/json + parameters: + - description: Order ID + in: body + name: body + required: true + schema: + $ref: '#/definitions/internal_handlers.createPaymentRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Create a PIX payment + tags: + - Payments + /payments/pix/{order_id}/receipt: + post: + consumes: + - multipart/form-data + parameters: + - description: Order ID + in: path + name: order_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Upload PIX payment receipt + tags: + - Payments + /payments/stripe: + post: + consumes: + - application/json + parameters: + - description: Order ID + in: body + name: body + required: true + schema: + $ref: '#/definitions/internal_handlers.createPaymentRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Create a Stripe payment intent + tags: + - Payments + /payments/stripe/webhook: + post: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: Handle Stripe webhook events + tags: + - Payments + /products: + get: + parameters: + - description: Filter by category + in: query + name: category_id + type: string + - default: 1 + description: Page number + in: query + name: page + type: integer + - default: 20 + description: Items per page + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object + summary: List active products + tags: + - Store + /products/{id}: + get: + parameters: + - description: Product ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.Product' + "404": + description: Not Found + schema: + additionalProperties: true + type: object + summary: Get a product by ID + tags: + - Store + /user/password: + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Change user password + tags: + - User + /user/profile: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/internal_handlers.profileResponse' + security: + - BearerAuth: [] + summary: Get user profile + tags: + - User + put: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Update user profile + tags: + - User + /user/saved-cards: + get: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: List saved payment cards + tags: + - User + post: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Create Stripe SetupIntent for saved cards + tags: + - User + /user/saved-cards/{id}: + delete: + produces: + - application/json + responses: {} + security: + - BearerAuth: [] + summary: Delete a saved payment card + tags: + - User + /waitlist: + get: + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.WaitlistEntry' + type: array + security: + - BearerAuth: [] + summary: List waitlist entries (admin) + tags: + - Admin + post: + consumes: + - application/json + parameters: + - description: Email and optional name + in: body + name: body + required: true + schema: + properties: + email: + type: string + name: + type: string + type: object + produces: + - application/json + responses: + "201": + description: Created + schema: + additionalProperties: true + type: object + "409": + description: Conflict + schema: + additionalProperties: true + type: object + summary: Join the waitlist + tags: + - Waitlist +securityDefinitions: + BearerAuth: + description: JWT token (Bearer ) + in: header + name: Authorization + type: apiKey +swagger: "2.0" diff --git a/backend/go.mod b/backend/go.mod index f17e4e0..fd09a7a 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -8,7 +8,8 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.19.15 github.com/aws/aws-sdk-go-v2/service/s3 v1.100.0 github.com/aws/smithy-go v1.25.0 - github.com/gofiber/fiber/v2 v2.52.0 + github.com/gofiber/contrib/swagger v1.3.0 + github.com/gofiber/fiber/v2 v2.52.6 github.com/golang-jwt/jwt/v5 v5.3.1 github.com/golang-migrate/migrate/v4 v4.19.1 github.com/google/uuid v1.6.0 @@ -17,12 +18,15 @@ require ( github.com/redis/go-redis/v9 v9.18.0 github.com/robfig/cron/v3 v3.0.1 github.com/stripe/stripe-go/v82 v82.5.1 + github.com/swaggo/swag v1.16.6 github.com/valyala/fasthttp v1.51.0 golang.org/x/crypto v0.49.0 ) require ( - github.com/andybalholm/brotli v1.0.5 // indirect + github.com/KyleBanks/depth v1.2.1 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 // indirect @@ -39,26 +43,44 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/go-openapi/analysis v0.21.4 // indirect + github.com/go-openapi/errors v0.20.4 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/loads v0.21.2 // indirect + github.com/go-openapi/runtime v0.26.2 // indirect + github.com/go-openapi/spec v0.20.11 // indirect + github.com/go-openapi/strfmt v0.21.8 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/validate v0.22.3 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/compress v1.18.0 // indirect - github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oklog/ulid v1.3.1 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect + go.mongodb.org/mongo-driver v1.13.1 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect + golang.org/x/mod v0.33.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect + golang.org/x/tools v0.42.0 // indirect google.golang.org/protobuf v1.36.8 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/backend/go.sum b/backend/go.sum index 38693a7..4b53a20 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -1,9 +1,14 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -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.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go-v2 v1.41.6 h1:1AX0AthnBQzMx1vbmir3Y4WsnJgiydmnJjiLu+LvXOg= github.com/aws/aws-sdk-go-v2 v1.41.6/go.mod h1:dy0UzBIfwSeot4grGvY1AqFWN5zgziMmWGzysDnHFcQ= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 h1:adBsCIIpLbLmYnkQU+nAChU5yhVTvu5PerROm+/Kq2A= @@ -54,6 +59,7 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= @@ -74,16 +80,52 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE= -github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= +github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= +github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWLG6M= +github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= +github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= +github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= +github.com/go-openapi/runtime v0.26.2 h1:elWyB9MacRzvIVgAZCBJmqTi7hBzU0hlKD4IvfX0Zl0= +github.com/go-openapi/runtime v0.26.2/go.mod h1:O034jyRZ557uJKzngbMDJXkcKJVzXJiymdSfgejrcRw= +github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY= +github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-openapi/strfmt v0.21.8 h1:VYBUoKYRLAlgKDrIxR/I0lKrztDQ0tuTDrbhLVP8Erg= +github.com/go-openapi/strfmt v0.21.8/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/validate v0.22.3 h1:KxG9mu5HBRYbecRb37KRCihvGGtND2aXziBAv0NNfyI= +github.com/go-openapi/validate v0.22.3/go.mod h1:kVxh31KbfsxU8ZyoHaDbLBWU5CnMdqBUEtadQ2G4d5M= +github.com/gofiber/contrib/swagger v1.3.0 h1:J1InCTPUW/DzDlG+QwWcD5QZ4W9HlyCRHLZjKKVZd+g= +github.com/gofiber/contrib/swagger v1.3.0/go.mod h1:zlZljpjIz1VhKR25+Inxl7WaOkgyM10nITUFXn6sV5A= +github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI= +github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang-migrate/migrate/v4 v4.19.1 h1:OCyb44lFuQfYXYLx1SCxPZQGU7mcaZ7gH9yH4jSFbBA= github.com/golang-migrate/migrate/v4 v4.19.1/go.mod h1:CTcgfjxhaUtsLipnLoQRWCrjYXycRz/g5+RWDuYgPrE= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.1.1/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/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= @@ -94,33 +136,53 @@ github.com/jackc/pgx/v5 v5.9.1 h1:uwrxJXBnx76nyISkhr33kQLlUqjv7et7b9FjCen/tdc= github.com/jackc/pgx/v5 v5.9.1/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +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/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 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-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/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/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +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/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -144,23 +206,42 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +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/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/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/stripe/stripe-go/v82 v82.5.1 h1:05q6ZDKoe8PLMpQV072obF74HCgP4XJeJYoNuRSX2+8= github.com/stripe/stripe-go/v82 v82.5.1/go.mod h1:majCQX6AfObAvJiHraPi/5udwHi4ojRvJnnxckvHrX8= +github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI= +github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= 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/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= 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/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= +go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= +go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= @@ -177,23 +258,64 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= +golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k= +golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/internal/handlers/admin.go b/backend/internal/handlers/admin.go index 23ce2a0..254ce25 100644 --- a/backend/internal/handlers/admin.go +++ b/backend/internal/handlers/admin.go @@ -49,6 +49,16 @@ func NewAdminHandler( // Upload handles generic admin file uploads. The frontend sends a multipart // form with a `file` field and an optional `prefix` (subfolder) field. Only // a fixed allowlist of prefixes is accepted. +// Upload godoc +// @Summary Upload a file (admin) +// @Tags Admin +// @Accept multipart/form-data +// @Produce json +// @Param file formData file true "File to upload" +// @Param prefix formData string false "Upload prefix (uploads/covers/banners/linktree/brand-kit/products)" +// @Success 200 {object} map[string]interface{} +// @Security BearerAuth +// @Router /admin/upload [post] func (h *AdminHandler) Upload(c *fiber.Ctx) error { file, err := c.FormFile("file") if err != nil { @@ -95,6 +105,12 @@ func paginate(c *fiber.Ctx) (page, limit, offset int) { // ---- Users ---- +// ListUsers godoc +// @Summary List all users (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/users [get] func (h *AdminHandler) ListUsers(c *fiber.Ctx) error { page, limit, offset := paginate(c) users, total, err := h.users.List(c.Context(), offset, limit) @@ -104,6 +120,13 @@ func (h *AdminHandler) ListUsers(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": users, "total": total, "page": page, "limit": limit}) } +// UpdateUserRole godoc +// @Summary Update user role (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/users/{id}/role [put] func (h *AdminHandler) UpdateUserRole(c *fiber.Ctx) error { id := c.Params("id") var body struct { @@ -128,6 +151,11 @@ func (h *AdminHandler) UpdateUserRole(c *fiber.Ctx) error { return c.JSON(user) } +// DeleteUser godoc +// @Summary Delete a user (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/users/{id} [delete] func (h *AdminHandler) DeleteUser(c *fiber.Ctx) error { id := c.Params("id") if err := h.users.Delete(c.Context(), id); err != nil { @@ -138,6 +166,12 @@ func (h *AdminHandler) DeleteUser(c *fiber.Ctx) error { // ---- Banners ---- +// ListBanners godoc +// @Summary List all banners (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/banners [get] func (h *AdminHandler) ListBanners(c *fiber.Ctx) error { banners, err := h.banners.List(c.Context(), false) if err != nil { @@ -146,6 +180,13 @@ func (h *AdminHandler) ListBanners(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": banners}) } +// CreateBanner godoc +// @Summary Create a banner (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/banners [post] func (h *AdminHandler) CreateBanner(c *fiber.Ctx) error { var b domain.Banner if err := c.BodyParser(&b); err != nil { @@ -157,6 +198,13 @@ func (h *AdminHandler) CreateBanner(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(b) } +// UpdateBanner godoc +// @Summary Update a banner (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/banners/{id} [put] func (h *AdminHandler) UpdateBanner(c *fiber.Ctx) error { var b domain.Banner if err := c.BodyParser(&b); err != nil { @@ -169,6 +217,11 @@ func (h *AdminHandler) UpdateBanner(c *fiber.Ctx) error { return c.JSON(b) } +// DeleteBanner godoc +// @Summary Delete a banner (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/banners/{id} [delete] func (h *AdminHandler) DeleteBanner(c *fiber.Ctx) error { if err := h.banners.Delete(c.Context(), c.Params("id")); err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) @@ -178,6 +231,12 @@ func (h *AdminHandler) DeleteBanner(c *fiber.Ctx) error { // ---- Linktree ---- +// ListLinktree godoc +// @Summary List linktree items (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/linktree [get] func (h *AdminHandler) ListLinktree(c *fiber.Ctx) error { items, err := h.linktree.List(c.Context(), false) if err != nil { @@ -186,6 +245,13 @@ func (h *AdminHandler) ListLinktree(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": items}) } +// CreateLinktreeItem godoc +// @Summary Create a linktree item (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/linktree [post] func (h *AdminHandler) CreateLinktreeItem(c *fiber.Ctx) error { var item domain.LinktreeItem if err := c.BodyParser(&item); err != nil { @@ -197,6 +263,13 @@ func (h *AdminHandler) CreateLinktreeItem(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(item) } +// UpdateLinktreeItem godoc +// @Summary Update a linktree item (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/linktree/{id} [put] func (h *AdminHandler) UpdateLinktreeItem(c *fiber.Ctx) error { var item domain.LinktreeItem if err := c.BodyParser(&item); err != nil { @@ -209,6 +282,11 @@ func (h *AdminHandler) UpdateLinktreeItem(c *fiber.Ctx) error { return c.JSON(item) } +// DeleteLinktreeItem godoc +// @Summary Delete a linktree item (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/linktree/{id} [delete] func (h *AdminHandler) DeleteLinktreeItem(c *fiber.Ctx) error { if err := h.linktree.Delete(c.Context(), c.Params("id")); err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) @@ -216,6 +294,12 @@ func (h *AdminHandler) DeleteLinktreeItem(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusNoContent) } +// ReorderLinktree godoc +// @Summary Reorder linktree items (admin) +// @Tags Admin +// @Accept json +// @Security BearerAuth +// @Router /admin/linktree/reorder [put] func (h *AdminHandler) ReorderLinktree(c *fiber.Ctx) error { var items []domain.LinktreeItem if err := c.BodyParser(&items); err != nil { @@ -229,6 +313,12 @@ func (h *AdminHandler) ReorderLinktree(c *fiber.Ctx) error { // ---- Brand Kit ---- +// GetBrandKit godoc +// @Summary Get brand kit (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/brand-kit [get] func (h *AdminHandler) GetBrandKit(c *fiber.Ctx) error { bk, err := h.brandKit.Get(c.Context()) if err != nil { @@ -237,6 +327,13 @@ func (h *AdminHandler) GetBrandKit(c *fiber.Ctx) error { return c.JSON(bk) } +// UpsertBrandKit godoc +// @Summary Update brand kit (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/brand-kit [put] func (h *AdminHandler) UpsertBrandKit(c *fiber.Ctx) error { var bk domain.BrandKit if err := c.BodyParser(&bk); err != nil { @@ -250,6 +347,12 @@ func (h *AdminHandler) UpsertBrandKit(c *fiber.Ctx) error { // ---- Email Groups ---- +// ListEmailGroups godoc +// @Summary List email groups (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/email-groups [get] func (h *AdminHandler) ListEmailGroups(c *fiber.Ctx) error { groups, err := h.emailGroups.List(c.Context()) if err != nil { @@ -258,6 +361,13 @@ func (h *AdminHandler) ListEmailGroups(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": groups}) } +// CreateEmailGroup godoc +// @Summary Create an email group (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/email-groups [post] func (h *AdminHandler) CreateEmailGroup(c *fiber.Ctx) error { var g domain.EmailGroup if err := c.BodyParser(&g); err != nil { @@ -272,6 +382,11 @@ func (h *AdminHandler) CreateEmailGroup(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(g) } +// DeleteEmailGroup godoc +// @Summary Delete an email group (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/email-groups/{id} [delete] func (h *AdminHandler) DeleteEmailGroup(c *fiber.Ctx) error { if err := h.emailGroups.Delete(c.Context(), c.Params("id")); err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) @@ -281,6 +396,12 @@ func (h *AdminHandler) DeleteEmailGroup(c *fiber.Ctx) error { // ---- Email Subscriptions ---- +// ListSubscribers godoc +// @Summary List subscribers in a group (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/email-groups/{id}/subscribers [get] func (h *AdminHandler) ListSubscribers(c *fiber.Ctx) error { subs, err := h.emailSubs.ListByGroup(c.Context(), c.Params("id")) if err != nil { @@ -289,6 +410,13 @@ func (h *AdminHandler) ListSubscribers(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": subs}) } +// AddEmailSubscription godoc +// @Summary Add an email subscription (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/email-subscriptions [post] func (h *AdminHandler) AddEmailSubscription(c *fiber.Ctx) error { var sub domain.EmailSubscription if err := c.BodyParser(&sub); err != nil { @@ -300,6 +428,11 @@ func (h *AdminHandler) AddEmailSubscription(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(sub) } +// DeactivateEmailSubscription godoc +// @Summary Deactivate an email subscription (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/email-subscriptions/{email}/deactivate [put] func (h *AdminHandler) DeactivateEmailSubscription(c *fiber.Ctx) error { email := c.Params("email") if err := h.emailSubs.Deactivate(c.Context(), email); err != nil { @@ -310,6 +443,12 @@ func (h *AdminHandler) DeactivateEmailSubscription(c *fiber.Ctx) error { // ---- User Groups ---- +// ListUserGroups godoc +// @Summary List user groups (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/user-groups [get] func (h *AdminHandler) ListUserGroups(c *fiber.Ctx) error { groups, err := h.userGroups.List(c.Context()) if err != nil { @@ -318,6 +457,13 @@ func (h *AdminHandler) ListUserGroups(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": groups}) } +// CreateUserGroup godoc +// @Summary Create a user group (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/user-groups [post] func (h *AdminHandler) CreateUserGroup(c *fiber.Ctx) error { var g domain.UserGroup if err := c.BodyParser(&g); err != nil { @@ -329,6 +475,11 @@ func (h *AdminHandler) CreateUserGroup(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(g) } +// DeleteUserGroup godoc +// @Summary Delete a user group (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/user-groups/{id} [delete] func (h *AdminHandler) DeleteUserGroup(c *fiber.Ctx) error { if err := h.userGroups.Delete(c.Context(), c.Params("id")); err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) diff --git a/backend/internal/handlers/auth.go b/backend/internal/handlers/auth.go index 2a53c7e..55fc2ee 100644 --- a/backend/internal/handlers/auth.go +++ b/backend/internal/handlers/auth.go @@ -97,6 +97,15 @@ func (h *AuthHandler) setTokenCookies(c *fiber.Ctx, accessToken, refreshToken st }) } +// Register godoc +// @Summary Register a new user +// @Tags Auth +// @Accept json +// @Produce json +// @Param body body object{email=string,password=string,name=string} true "User credentials" +// @Success 201 {object} map[string]interface{} +// @Failure 400 {object} map[string]interface{} +// @Router /auth/register [post] func (h *AuthHandler) Register(c *fiber.Ctx) error { var req struct { Email string `json:"email"` @@ -167,6 +176,15 @@ func (h *AuthHandler) Register(c *fiber.Ctx) error { }) } +// Login godoc +// @Summary Login with email and password +// @Tags Auth +// @Accept json +// @Produce json +// @Param body body object{email=string,password=string} true "Login credentials" +// @Success 200 {object} map[string]interface{} +// @Failure 401 {object} map[string]interface{} +// @Router /auth/login [post] func (h *AuthHandler) Login(c *fiber.Ctx) error { var req struct { Email string `json:"email"` @@ -210,6 +228,14 @@ func (h *AuthHandler) Login(c *fiber.Ctx) error { }) } +// Refresh godoc +// @Summary Refresh access token +// @Tags Auth +// @Accept json +// @Produce json +// @Success 200 {object} map[string]interface{} +// @Failure 401 {object} map[string]interface{} +// @Router /auth/refresh [post] func (h *AuthHandler) Refresh(c *fiber.Ctx) error { tokenStr := c.Cookies("refresh_token") if tokenStr == "" { @@ -233,6 +259,12 @@ func (h *AuthHandler) Refresh(c *fiber.Ctx) error { return c.JSON(fiber.Map{"access_token": accessToken}) } +// Logout godoc +// @Summary Logout and clear auth cookies +// @Tags Auth +// @Produce json +// @Success 200 {object} map[string]interface{} +// @Router /auth/logout [post] func (h *AuthHandler) Logout(c *fiber.Ctx) error { c.Cookie(&fiber.Cookie{ Name: "access_token", @@ -249,6 +281,14 @@ func (h *AuthHandler) Logout(c *fiber.Ctx) error { return c.JSON(fiber.Map{"message": "logged out"}) } +// Me godoc +// @Summary Get current user profile +// @Tags Auth +// @Produce json +// @Success 200 {object} userResponse +// @Failure 404 {object} map[string]interface{} +// @Security BearerAuth +// @Router /auth/me [get] func (h *AuthHandler) Me(c *fiber.Ctx) error { userID, _ := c.Locals("user_id").(string) u, err := h.users.FindByID(c.Context(), userID) @@ -258,6 +298,14 @@ func (h *AuthHandler) Me(c *fiber.Ctx) error { return c.JSON(toUserResponse(u)) } +// ForgotPassword godoc +// @Summary Request password reset email +// @Tags Auth +// @Accept json +// @Produce json +// @Param body body object{email=string} true "Registered email" +// @Success 200 {object} map[string]interface{} +// @Router /auth/forgot-password [post] func (h *AuthHandler) ForgotPassword(c *fiber.Ctx) error { var req struct { Email string `json:"email"` @@ -269,6 +317,14 @@ func (h *AuthHandler) ForgotPassword(c *fiber.Ctx) error { return c.JSON(fiber.Map{"message": "if that email exists, a reset link has been sent"}) } +// ResetPassword godoc +// @Summary Reset password with token +// @Tags Auth +// @Accept json +// @Produce json +// @Param body body object{token=string,password=string} true "Reset token and new password" +// @Success 200 {object} map[string]interface{} +// @Router /auth/reset-password [post] func (h *AuthHandler) ResetPassword(c *fiber.Ctx) error { var req struct { Token string `json:"token"` diff --git a/backend/internal/handlers/blog.go b/backend/internal/handlers/blog.go index f6f6674..19517cb 100644 --- a/backend/internal/handlers/blog.go +++ b/backend/internal/handlers/blog.go @@ -106,6 +106,12 @@ func slugify(s string) string { // ---- Public routes ---- +// ListPublished godoc +// @Summary List published blog posts +// @Tags Blog +// @Produce json +// @Success 200 {object} map[string]interface{} +// @Router /blog [get] func (h *BlogHandler) ListPublished(c *fiber.Ctx) error { page, limit, offset := paginate(c) posts, total, err := h.blog.List(c.Context(), "published", offset, limit) @@ -115,6 +121,14 @@ func (h *BlogHandler) ListPublished(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": posts, "posts": posts, "total": total, "page": page, "limit": limit}) } +// GetBySlug godoc +// @Summary Get a blog post by slug +// @Tags Blog +// @Produce json +// @Param slug path string true "Post slug" +// @Success 200 {object} domain.BlogPost +// @Failure 404 {object} map[string]interface{} +// @Router /blog/{slug} [get] func (h *BlogHandler) GetBySlug(c *fiber.Ctx) error { slug := c.Params("slug") post, err := h.blog.FindBySlug(c.Context(), slug) @@ -127,6 +141,12 @@ func (h *BlogHandler) GetBySlug(c *fiber.Ctx) error { return c.JSON(post) } +// RSSFeed godoc +// @Summary RSS feed of published posts +// @Tags Blog +// @Produce xml +// @Success 200 {string} string +// @Router /blog/rss.xml [get] func (h *BlogHandler) RSSFeed(c *fiber.Ctx) error { posts, _, err := h.blog.List(c.Context(), "published", 0, 20) if err != nil { @@ -173,6 +193,12 @@ func (h *BlogHandler) RSSFeed(c *fiber.Ctx) error { return c.SendString(xml.Header + xmlStr) } +// AtomFeed godoc +// @Summary Atom feed of published posts +// @Tags Blog +// @Produce xml +// @Success 200 {string} string +// @Router /blog/atom.xml [get] func (h *BlogHandler) AtomFeed(c *fiber.Ctx) error { posts, _, err := h.blog.List(c.Context(), "published", 0, 20) if err != nil { @@ -237,6 +263,12 @@ func (h *BlogHandler) AtomFeed(c *fiber.Ctx) error { // ---- Admin routes ---- +// AdminListPosts godoc +// @Summary List all blog posts (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/blog [get] func (h *BlogHandler) AdminListPosts(c *fiber.Ctx) error { page, limit, offset := paginate(c) posts, total, err := h.blog.List(c.Context(), "", offset, limit) @@ -246,6 +278,13 @@ func (h *BlogHandler) AdminListPosts(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": posts, "total": total, "page": page, "limit": limit}) } +// AdminCreatePost godoc +// @Summary Create a blog post (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/blog [post] func (h *BlogHandler) AdminCreatePost(c *fiber.Ctx) error { var body struct { Title string `json:"title"` @@ -291,6 +330,13 @@ func (h *BlogHandler) AdminCreatePost(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(post) } +// AdminUpdatePost godoc +// @Summary Update a blog post (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/blog/{id} [put] func (h *BlogHandler) AdminUpdatePost(c *fiber.Ctx) error { id := c.Params("id") post, err := h.blog.FindByID(c.Context(), id) @@ -336,6 +382,11 @@ func (h *BlogHandler) AdminUpdatePost(c *fiber.Ctx) error { return c.JSON(post) } +// AdminDeletePost godoc +// @Summary Delete a blog post (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/blog/{id} [delete] func (h *BlogHandler) AdminDeletePost(c *fiber.Ctx) error { id := c.Params("id") if err := h.blog.Delete(c.Context(), id); err != nil { @@ -344,6 +395,13 @@ func (h *BlogHandler) AdminDeletePost(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusNoContent) } +// AdminUploadCover godoc +// @Summary Upload cover image for a blog post (admin) +// @Tags Admin +// @Accept multipart/form-data +// @Produce json +// @Security BearerAuth +// @Router /admin/blog/{id}/cover [post] func (h *BlogHandler) AdminUploadCover(c *fiber.Ctx) error { id := c.Params("id") post, err := h.blog.FindByID(c.Context(), id) @@ -371,6 +429,13 @@ func (h *BlogHandler) AdminUploadCover(c *fiber.Ctx) error { } return c.JSON(fiber.Map{"cover_image": url}) } +// AdminAIGenerate godoc +// @Summary Generate blog post with AI (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/blog/ai-generate [post] func (h *BlogHandler) AdminAIGenerate(c *fiber.Ctx) error { if h.cfg.OpenAIKey == "" { return fiber.NewError(fiber.StatusServiceUnavailable, "OPENAI_KEY is not configured") diff --git a/backend/internal/handlers/coupon.go b/backend/internal/handlers/coupon.go index 8b722f0..01e32cf 100644 --- a/backend/internal/handlers/coupon.go +++ b/backend/internal/handlers/coupon.go @@ -15,7 +15,14 @@ func NewCouponHandler(coupons domain.CouponRepository) *CouponHandler { return &CouponHandler{coupons: coupons} } -// POST /api/v1/coupons/validate +// ValidateCoupon godoc +// @Summary Validate a coupon code +// @Tags Coupons +// @Accept json +// @Produce json +// @Param body body object{code=string,subtotal=number} true "Coupon code and subtotal" +// @Success 200 {object} map[string]interface{} +// @Router /coupons/validate [post] func (h *CouponHandler) ValidateCoupon(c *fiber.Ctx) error { var req struct { Code string `json:"code"` @@ -58,7 +65,12 @@ func (h *CouponHandler) ValidateCoupon(c *fiber.Ctx) error { }) } -// GET /admin/coupons +// AdminListCoupons godoc +// @Summary List all coupons (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/coupons [get] func (h *CouponHandler) AdminListCoupons(c *fiber.Ctx) error { coupons, err := h.coupons.List(c.Context()) if err != nil { @@ -67,7 +79,13 @@ func (h *CouponHandler) AdminListCoupons(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": coupons}) } -// POST /admin/coupons +// AdminCreateCoupon godoc +// @Summary Create a coupon (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/coupons [post] func (h *CouponHandler) AdminCreateCoupon(c *fiber.Ctx) error { coupon := &domain.Coupon{} if err := c.BodyParser(coupon); err != nil { @@ -79,7 +97,11 @@ func (h *CouponHandler) AdminCreateCoupon(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(coupon) } -// DELETE /admin/coupons/:id +// AdminDeleteCoupon godoc +// @Summary Delete a coupon (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/coupons/{id} [delete] func (h *CouponHandler) AdminDeleteCoupon(c *fiber.Ctx) error { // CouponRepository has no Delete method; return method not allowed. return fiber.NewError(fiber.StatusMethodNotAllowed, "coupon deletion not supported") diff --git a/backend/internal/handlers/envconfig.go b/backend/internal/handlers/envconfig.go index 58be452..8c0c676 100644 --- a/backend/internal/handlers/envconfig.go +++ b/backend/internal/handlers/envconfig.go @@ -85,8 +85,12 @@ func knownEnvVars() []envEntry { } } -// GetEnvStatus returns all known ENV vars with their set/unset status. -// Secret values are masked. +// GetEnvStatus godoc +// @Summary List environment variable status (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/config/env [get] func (h *EnvConfigHandler) GetEnvStatus(c *fiber.Ctx) error { vars := knownEnvVars() for i := range vars { @@ -103,8 +107,12 @@ func (h *EnvConfigHandler) GetEnvStatus(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": vars}) } -// ExportEnv exports all DB-configurable settings (security_settings + feature_flags) -// as a .env-compatible text file. +// ExportEnv godoc +// @Summary Export configuration as .env file (admin) +// @Tags Admin +// @Produce text/plain +// @Security BearerAuth +// @Router /admin/config/export [get] func (h *EnvConfigHandler) ExportEnv(c *fiber.Ctx) error { var lines []string @@ -168,9 +176,13 @@ func (h *EnvConfigHandler) ExportEnv(c *fiber.Ctx) error { return c.SendString(strings.Join(lines, "\n") + "\n") } -// ImportEnv imports settings from a .env-format text body. -// Only updates DB-backed settings (security_settings + feature_flags). -// ENV vars are NOT updated (require server restart). +// ImportEnv godoc +// @Summary Import configuration from .env format (admin) +// @Tags Admin +// @Accept text/plain +// @Produce json +// @Security BearerAuth +// @Router /admin/config/import [post] func (h *EnvConfigHandler) ImportEnv(c *fiber.Ctx) error { body := string(c.Body()) lines := strings.Split(body, "\n") diff --git a/backend/internal/handlers/handler.go b/backend/internal/handlers/handler.go index cc27f8c..5cf9e2c 100644 --- a/backend/internal/handlers/handler.go +++ b/backend/internal/handlers/handler.go @@ -13,6 +13,12 @@ func NewFeatureFlagHandler(flags domain.FeatureFlagRepository) *FeatureFlagHandl return &FeatureFlagHandler{flags: flags} } +// GetAll godoc +// @Summary List all feature flags +// @Tags Features +// @Produce json +// @Success 200 {array} domain.FeatureFlag +// @Router /features [get] func (h *FeatureFlagHandler) GetAll(c *fiber.Ctx) error { flags, err := h.flags.GetAll(c.Context()) if err != nil { @@ -21,6 +27,16 @@ func (h *FeatureFlagHandler) GetAll(c *fiber.Ctx) error { return c.JSON(flags) } +// Toggle godoc +// @Summary Toggle a feature flag +// @Tags Admin +// @Accept json +// @Produce json +// @Param key path string true "Feature flag key" +// @Param body body object{enabled=boolean} true "Flag state" +// @Success 200 {object} map[string]interface{} +// @Security BearerAuth +// @Router /admin/features/{key} [put] func (h *FeatureFlagHandler) Toggle(c *fiber.Ctx) error { key := c.Params("key") var req struct { diff --git a/backend/internal/handlers/jobs.go b/backend/internal/handlers/jobs.go index 8bb44cf..da2d134 100644 --- a/backend/internal/handlers/jobs.go +++ b/backend/internal/handlers/jobs.go @@ -171,7 +171,11 @@ func (h *JobsHandler) unscheduleJob(jobID string) { // ---- HTTP handlers ---- // ListJobs godoc -// GET /admin/jobs +// @Summary List all cron jobs (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs [get] func (h *JobsHandler) ListJobs(c *fiber.Ctx) error { jobs, err := h.jobs.List(c.Context()) if err != nil { @@ -184,7 +188,12 @@ func (h *JobsHandler) ListJobs(c *fiber.Ctx) error { } // CreateJob godoc -// POST /admin/jobs +// @Summary Create a cron job (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs [post] func (h *JobsHandler) CreateJob(c *fiber.Ctx) error { var req struct { Name string `json:"name"` @@ -227,7 +236,12 @@ func (h *JobsHandler) CreateJob(c *fiber.Ctx) error { } // UpdateJob godoc -// PUT /admin/jobs/:id +// @Summary Update a cron job (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/{id} [put] func (h *JobsHandler) UpdateJob(c *fiber.Ctx) error { id := c.Params("id") job, err := h.jobs.FindByID(c.Context(), id) @@ -285,7 +299,11 @@ func (h *JobsHandler) UpdateJob(c *fiber.Ctx) error { } // PauseJob godoc -// PUT /admin/jobs/:id/pause +// @Summary Pause a cron job (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/{id}/pause [put] func (h *JobsHandler) PauseJob(c *fiber.Ctx) error { id := c.Params("id") job, err := h.jobs.FindByID(c.Context(), id) @@ -303,7 +321,11 @@ func (h *JobsHandler) PauseJob(c *fiber.Ctx) error { } // ResumeJob godoc -// PUT /admin/jobs/:id/resume +// @Summary Resume a cron job (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/{id}/resume [put] func (h *JobsHandler) ResumeJob(c *fiber.Ctx) error { id := c.Params("id") job, err := h.jobs.FindByID(c.Context(), id) @@ -323,7 +345,11 @@ func (h *JobsHandler) ResumeJob(c *fiber.Ctx) error { } // RunNow godoc -// POST /admin/jobs/:id/run +// @Summary Trigger a job immediately (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/{id}/run [post] func (h *JobsHandler) RunNow(c *fiber.Ctx) error { id := c.Params("id") job, err := h.jobs.FindByID(c.Context(), id) @@ -341,7 +367,11 @@ func (h *JobsHandler) RunNow(c *fiber.Ctx) error { } // ListExecutions godoc -// GET /admin/jobs/:id/executions?page=1&limit=20 +// @Summary List job execution history (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/{id}/executions [get] func (h *JobsHandler) ListExecutions(c *fiber.Ctx) error { id := c.Params("id") page, limit, offset := paginate(c) @@ -359,7 +389,11 @@ func (h *JobsHandler) ListExecutions(c *fiber.Ctx) error { } // RetryExecution godoc -// POST /admin/jobs/:id/executions/:eid/retry +// @Summary Retry a failed job execution (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/{id}/executions/{eid}/retry [post] func (h *JobsHandler) RetryExecution(c *fiber.Ctx) error { jobID := c.Params("id") eid := c.Params("eid") @@ -384,7 +418,10 @@ func (h *JobsHandler) RetryExecution(c *fiber.Ctx) error { } // DeleteJob godoc -// DELETE /admin/jobs/:id +// @Summary Delete a cron job (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/jobs/{id} [delete] func (h *JobsHandler) DeleteJob(c *fiber.Ctx) error { id := c.Params("id") @@ -397,7 +434,11 @@ func (h *JobsHandler) DeleteJob(c *fiber.Ctx) error { } // ListHandlers godoc -// GET /admin/jobs/handlers +// @Summary List registered job handlers (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/jobs/handlers [get] func (h *JobsHandler) ListHandlers(c *fiber.Ctx) error { return c.JSON(fiber.Map{"handlers": h.registry.List()}) } diff --git a/backend/internal/handlers/legal.go b/backend/internal/handlers/legal.go index 6039570..a0c0538 100644 --- a/backend/internal/handlers/legal.go +++ b/backend/internal/handlers/legal.go @@ -13,7 +13,13 @@ func NewLegalHandler(pages domain.LegalPageRepository) *LegalHandler { return &LegalHandler{pages: pages} } -// Public: get active page by slug +// GetBySlug godoc +// @Summary Get a legal page by slug +// @Tags Legal +// @Produce json +// @Param slug path string true "Page slug" +// @Success 200 {object} domain.LegalPage +// @Router /legal/{slug} [get] func (h *LegalHandler) GetBySlug(c *fiber.Ctx) error { slug := c.Params("slug") page, err := h.pages.FindBySlug(c.Context(), slug) @@ -26,7 +32,12 @@ func (h *LegalHandler) GetBySlug(c *fiber.Ctx) error { return c.JSON(page) } -// Public: list active pages (slug + title only, for footer) +// ListActive godoc +// @Summary List active legal pages +// @Tags Legal +// @Produce json +// @Success 200 {array} object{slug=string,title=string} +// @Router /legal [get] func (h *LegalHandler) ListActive(c *fiber.Ctx) error { pages, err := h.pages.List(c.Context(), true) if err != nil { @@ -44,7 +55,12 @@ func (h *LegalHandler) ListActive(c *fiber.Ctx) error { return c.JSON(links) } -// Admin: list all pages (including inactive) +// AdminList godoc +// @Summary List all legal pages (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/legal [get] func (h *LegalHandler) AdminList(c *fiber.Ctx) error { pages, err := h.pages.List(c.Context(), false) if err != nil { @@ -53,7 +69,13 @@ func (h *LegalHandler) AdminList(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": pages}) } -// Admin: create page +// AdminCreate godoc +// @Summary Create a legal page (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/legal [post] func (h *LegalHandler) AdminCreate(c *fiber.Ctx) error { var page domain.LegalPage if err := c.BodyParser(&page); err != nil { @@ -68,7 +90,13 @@ func (h *LegalHandler) AdminCreate(c *fiber.Ctx) error { return c.Status(201).JSON(page) } -// Admin: update page +// AdminUpdate godoc +// @Summary Update a legal page (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/legal/{id} [put] func (h *LegalHandler) AdminUpdate(c *fiber.Ctx) error { id := c.Params("id") var page domain.LegalPage @@ -82,7 +110,11 @@ func (h *LegalHandler) AdminUpdate(c *fiber.Ctx) error { return c.JSON(page) } -// Admin: delete page +// AdminDelete godoc +// @Summary Delete a legal page (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/legal/{id} [delete] func (h *LegalHandler) AdminDelete(c *fiber.Ctx) error { id := c.Params("id") if err := h.pages.Delete(c.Context(), id); err != nil { diff --git a/backend/internal/handlers/payment.go b/backend/internal/handlers/payment.go index 5c463fa..19bcfbc 100644 --- a/backend/internal/handlers/payment.go +++ b/backend/internal/handlers/payment.go @@ -29,6 +29,14 @@ type createPaymentRequest struct { OrderID string `json:"order_id"` } +// CreateStripePayment godoc +// @Summary Create a Stripe payment intent +// @Tags Payments +// @Accept json +// @Produce json +// @Param body body createPaymentRequest true "Order ID" +// @Success 200 {object} map[string]interface{} +// @Router /payments/stripe [post] func (h *PaymentHandler) CreateStripePayment(c *fiber.Ctx) error { if h.cfg.StripeKey == "" { return c.Status(fiber.StatusServiceUnavailable).JSON(fiber.Map{"error": "stripe not configured"}) @@ -63,6 +71,13 @@ func (h *PaymentHandler) CreateStripePayment(c *fiber.Ctx) error { return c.JSON(fiber.Map{"client_secret": pi.ClientSecret}) } +// StripeWebhook godoc +// @Summary Handle Stripe webhook events +// @Tags Payments +// @Accept json +// @Produce json +// @Success 200 {object} map[string]interface{} +// @Router /payments/stripe/webhook [post] func (h *PaymentHandler) StripeWebhook(c *fiber.Ctx) error { payload := c.Body() sigHeader := c.Get("Stripe-Signature") @@ -98,6 +113,14 @@ func (h *PaymentHandler) StripeWebhook(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusOK) } +// CreatePixPayment godoc +// @Summary Create a PIX payment +// @Tags Payments +// @Accept json +// @Produce json +// @Param body body createPaymentRequest true "Order ID" +// @Success 200 {object} map[string]interface{} +// @Router /payments/pix [post] func (h *PaymentHandler) CreatePixPayment(c *fiber.Ctx) error { var req createPaymentRequest if err := c.BodyParser(&req); err != nil || req.OrderID == "" { @@ -139,6 +162,12 @@ func (h *PaymentHandler) CreatePixPayment(c *fiber.Ctx) error { }) } +// GetPixConfig godoc +// @Summary Get PIX configuration (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/pix-config [get] func (h *PaymentHandler) GetPixConfig(c *fiber.Ctx) error { cfg, err := h.pixCfg.Get(c.Context()) if err != nil { @@ -147,6 +176,13 @@ func (h *PaymentHandler) GetPixConfig(c *fiber.Ctx) error { return c.JSON(cfg) } +// UpdatePixConfig godoc +// @Summary Update PIX configuration (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/pix-config [put] func (h *PaymentHandler) UpdatePixConfig(c *fiber.Ctx) error { var cfg domain.PixConfig if err := c.BodyParser(&cfg); err != nil { @@ -164,6 +200,14 @@ func (h *PaymentHandler) UpdatePixConfig(c *fiber.Ctx) error { return c.JSON(cfg) } +// UploadPixReceipt godoc +// @Summary Upload PIX payment receipt +// @Tags Payments +// @Accept multipart/form-data +// @Produce json +// @Param order_id path string true "Order ID" +// @Success 200 {object} map[string]interface{} +// @Router /payments/pix/{order_id}/receipt [post] func (h *PaymentHandler) UploadPixReceipt(c *fiber.Ctx) error { orderID := c.Params("order_id") userID, _ := c.Locals("user_id").(string) @@ -207,6 +251,12 @@ func (h *PaymentHandler) UploadPixReceipt(c *fiber.Ctx) error { }) } +// ApprovePixPayment godoc +// @Summary Approve a PIX payment (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/orders/{id}/approve-pix [put] func (h *PaymentHandler) ApprovePixPayment(c *fiber.Ctx) error { orderID := c.Params("id") order, err := h.orders.FindByID(c.Context(), orderID) diff --git a/backend/internal/handlers/security.go b/backend/internal/handlers/security.go index 310c184..5b293fe 100644 --- a/backend/internal/handlers/security.go +++ b/backend/internal/handlers/security.go @@ -14,6 +14,12 @@ func NewSecurityHandler(settings domain.SecuritySettingRepository) *SecurityHand return &SecurityHandler{settings: settings} } +// ListSettings godoc +// @Summary List security settings (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/security [get] func (h *SecurityHandler) ListSettings(c *fiber.Ctx) error { settings, err := h.settings.GetAll(c.Context()) if err != nil { @@ -22,6 +28,16 @@ func (h *SecurityHandler) ListSettings(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": settings}) } +// UpdateSetting godoc +// @Summary Update a security setting (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Param key path string true "Setting key" +// @Param body body object{value=string} true "New value" +// @Success 200 {object} map[string]interface{} +// @Security BearerAuth +// @Router /admin/security/{key} [put] func (h *SecurityHandler) UpdateSetting(c *fiber.Ctx) error { key := c.Params("key") var req struct { diff --git a/backend/internal/handlers/store.go b/backend/internal/handlers/store.go index 1716b7c..93a3e71 100644 --- a/backend/internal/handlers/store.go +++ b/backend/internal/handlers/store.go @@ -36,6 +36,15 @@ func NewStoreHandler( // ---- Public ---- +// ListProducts godoc +// @Summary List active products +// @Tags Store +// @Produce json +// @Param category_id query string false "Filter by category" +// @Param page query int false "Page number" default(1) +// @Param limit query int false "Items per page" default(20) +// @Success 200 {object} map[string]interface{} +// @Router /products [get] func (h *StoreHandler) ListProducts(c *fiber.Ctx) error { _, limit, offset := paginate(c) var categoryID *string @@ -49,6 +58,14 @@ func (h *StoreHandler) ListProducts(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": products, "total": total}) } +// GetProduct godoc +// @Summary Get a product by ID +// @Tags Store +// @Produce json +// @Param id path string true "Product ID" +// @Success 200 {object} domain.Product +// @Failure 404 {object} map[string]interface{} +// @Router /products/{id} [get] func (h *StoreHandler) GetProduct(c *fiber.Ctx) error { p, err := h.products.FindByID(c.Context(), c.Params("id")) if err != nil { @@ -57,6 +74,12 @@ func (h *StoreHandler) GetProduct(c *fiber.Ctx) error { return c.JSON(p) } +// ListCategories godoc +// @Summary List product categories +// @Tags Store +// @Produce json +// @Success 200 {array} domain.Category +// @Router /categories [get] func (h *StoreHandler) ListCategories(c *fiber.Ctx) error { cats, err := h.categories.List(c.Context()) if err != nil { @@ -80,6 +103,16 @@ type createOrderRequest struct { CouponCode string `json:"coupon_code"` } +// CreateOrder godoc +// @Summary Create a new order +// @Tags Store +// @Accept json +// @Produce json +// @Param body body createOrderRequest true "Order details" +// @Success 201 {object} domain.Order +// @Failure 400 {object} map[string]interface{} +// @Security BearerAuth +// @Router /orders [post] func (h *StoreHandler) CreateOrder(c *fiber.Ctx) error { userID, ok := c.Locals("user_id").(string) if !ok || userID == "" { @@ -177,6 +210,13 @@ func (h *StoreHandler) CreateOrder(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(order) } +// ListMyOrders godoc +// @Summary List current user's orders +// @Tags Store +// @Produce json +// @Success 200 {object} map[string]interface{} +// @Security BearerAuth +// @Router /orders/me [get] func (h *StoreHandler) ListMyOrders(c *fiber.Ctx) error { userID, ok := c.Locals("user_id").(string) if !ok || userID == "" { @@ -192,6 +232,12 @@ func (h *StoreHandler) ListMyOrders(c *fiber.Ctx) error { // ---- Admin ---- +// AdminListProducts godoc +// @Summary List all products (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/products [get] func (h *StoreHandler) AdminListProducts(c *fiber.Ctx) error { _, limit, offset := paginate(c) var categoryID *string @@ -207,6 +253,12 @@ func (h *StoreHandler) AdminListProducts(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": products, "total": total}) } +// AdminListCategories godoc +// @Summary List all categories (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/categories [get] func (h *StoreHandler) AdminListCategories(c *fiber.Ctx) error { categories, err := h.categories.List(c.Context()) if err != nil { @@ -216,6 +268,13 @@ func (h *StoreHandler) AdminListCategories(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": categories}) } +// AdminCreateProduct godoc +// @Summary Create a product (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/products [post] func (h *StoreHandler) AdminCreateProduct(c *fiber.Ctx) error { p := &domain.Product{} if err := c.BodyParser(p); err != nil { @@ -227,6 +286,13 @@ func (h *StoreHandler) AdminCreateProduct(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(p) } +// AdminUpdateProduct godoc +// @Summary Update a product (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/products/{id} [put] func (h *StoreHandler) AdminUpdateProduct(c *fiber.Ctx) error { existing, err := h.products.FindByID(c.Context(), c.Params("id")) if err != nil { @@ -242,6 +308,11 @@ func (h *StoreHandler) AdminUpdateProduct(c *fiber.Ctx) error { return c.JSON(existing) } +// AdminDeleteProduct godoc +// @Summary Delete a product (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/products/{id} [delete] func (h *StoreHandler) AdminDeleteProduct(c *fiber.Ctx) error { if err := h.products.Delete(c.Context(), c.Params("id")); err != nil { return err @@ -249,6 +320,13 @@ func (h *StoreHandler) AdminDeleteProduct(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusNoContent) } +// AdminCreateCategory godoc +// @Summary Create a category (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/categories [post] func (h *StoreHandler) AdminCreateCategory(c *fiber.Ctx) error { cat := &domain.Category{} if err := c.BodyParser(cat); err != nil { @@ -260,6 +338,13 @@ func (h *StoreHandler) AdminCreateCategory(c *fiber.Ctx) error { return c.Status(fiber.StatusCreated).JSON(cat) } +// AdminUpdateCategory godoc +// @Summary Update a category (admin) +// @Tags Admin +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /admin/categories/{id} [put] func (h *StoreHandler) AdminUpdateCategory(c *fiber.Ctx) error { cat := &domain.Category{} if err := c.BodyParser(cat); err != nil { @@ -272,6 +357,11 @@ func (h *StoreHandler) AdminUpdateCategory(c *fiber.Ctx) error { return c.JSON(cat) } +// AdminDeleteCategory godoc +// @Summary Delete a category (admin) +// @Tags Admin +// @Security BearerAuth +// @Router /admin/categories/{id} [delete] func (h *StoreHandler) AdminDeleteCategory(c *fiber.Ctx) error { if err := h.categories.Delete(c.Context(), c.Params("id")); err != nil { return err @@ -279,6 +369,12 @@ func (h *StoreHandler) AdminDeleteCategory(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusNoContent) } +// AdminListOrders godoc +// @Summary List all orders (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/orders [get] func (h *StoreHandler) AdminListOrders(c *fiber.Ctx) error { status := c.Query("status") orders, err := h.orders.ListByStatus(c.Context(), status) @@ -288,6 +384,12 @@ func (h *StoreHandler) AdminListOrders(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": orders}) } +// AdminUpdateOrderStatus godoc +// @Summary Update order status (admin) +// @Tags Admin +// @Accept json +// @Security BearerAuth +// @Router /admin/orders/{id}/status [put] func (h *StoreHandler) AdminUpdateOrderStatus(c *fiber.Ctx) error { var body struct { Status string `json:"status"` diff --git a/backend/internal/handlers/tools.go b/backend/internal/handlers/tools.go index 2434420..b0fa6ea 100644 --- a/backend/internal/handlers/tools.go +++ b/backend/internal/handlers/tools.go @@ -38,6 +38,12 @@ func (h *ToolsHandler) toolURL(tool domain.AdminTool) string { return "" } +// ListTools godoc +// @Summary List admin tools (admin) +// @Tags Admin +// @Produce json +// @Security BearerAuth +// @Router /admin/tools [get] func (h *ToolsHandler) ListTools(c *fiber.Ctx) error { tools, err := h.tools.List(c.Context(), true) if err != nil { diff --git a/backend/internal/handlers/user.go b/backend/internal/handlers/user.go index 3106add..211454d 100644 --- a/backend/internal/handlers/user.go +++ b/backend/internal/handlers/user.go @@ -37,6 +37,13 @@ type profileResponse struct { StripeCustomerID *string `json:"stripe_customer_id,omitempty"` } +// GetProfile godoc +// @Summary Get user profile +// @Tags User +// @Produce json +// @Success 200 {object} profileResponse +// @Security BearerAuth +// @Router /user/profile [get] func (h *UserHandler) GetProfile(c *fiber.Ctx) error { userID, _ := c.Locals("user_id").(string) u, err := h.users.FindByID(c.Context(), userID) @@ -63,6 +70,13 @@ func (h *UserHandler) GetProfile(c *fiber.Ctx) error { return c.JSON(resp) } +// UpdateProfile godoc +// @Summary Update user profile +// @Tags User +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /user/profile [put] func (h *UserHandler) UpdateProfile(c *fiber.Ctx) error { userID, _ := c.Locals("user_id").(string) @@ -124,6 +138,13 @@ func (h *UserHandler) UpdateProfile(c *fiber.Ctx) error { return c.JSON(resp) } +// ChangePassword godoc +// @Summary Change user password +// @Tags User +// @Accept json +// @Produce json +// @Security BearerAuth +// @Router /user/password [put] func (h *UserHandler) ChangePassword(c *fiber.Ctx) error { userID, _ := c.Locals("user_id").(string) @@ -160,6 +181,12 @@ func (h *UserHandler) ChangePassword(c *fiber.Ctx) error { return c.JSON(fiber.Map{"success": true}) } +// CreateSetupIntent godoc +// @Summary Create Stripe SetupIntent for saved cards +// @Tags User +// @Produce json +// @Security BearerAuth +// @Router /user/saved-cards [post] func (h *UserHandler) CreateSetupIntent(c *fiber.Ctx) error { if h.cfg.StripeKey == "" { return c.Status(503).JSON(fiber.Map{"error": "stripe not configured", "env_required": "STRIPE_KEY"}) @@ -196,6 +223,12 @@ func (h *UserHandler) CreateSetupIntent(c *fiber.Ctx) error { return c.JSON(fiber.Map{"client_secret": si.ClientSecret}) } +// ListSavedCards godoc +// @Summary List saved payment cards +// @Tags User +// @Produce json +// @Security BearerAuth +// @Router /user/saved-cards [get] func (h *UserHandler) ListSavedCards(c *fiber.Ctx) error { if h.cfg.StripeKey == "" { return c.Status(503).JSON(fiber.Map{"error": "stripe not configured", "env_required": "STRIPE_KEY"}) @@ -246,6 +279,12 @@ func (h *UserHandler) ListSavedCards(c *fiber.Ctx) error { return c.JSON(cards) } +// DeleteSavedCard godoc +// @Summary Delete a saved payment card +// @Tags User +// @Produce json +// @Security BearerAuth +// @Router /user/saved-cards/{id} [delete] func (h *UserHandler) DeleteSavedCard(c *fiber.Ctx) error { if h.cfg.StripeKey == "" { return c.Status(503).JSON(fiber.Map{"error": "stripe not configured", "env_required": "STRIPE_KEY"}) diff --git a/backend/internal/handlers/waitlist.go b/backend/internal/handlers/waitlist.go index 720ef64..8ca3f25 100644 --- a/backend/internal/handlers/waitlist.go +++ b/backend/internal/handlers/waitlist.go @@ -13,6 +13,15 @@ func NewWaitlistHandler(waitlist domain.WaitlistRepository) *WaitlistHandler { return &WaitlistHandler{waitlist: waitlist} } +// AddToWaitlist godoc +// @Summary Join the waitlist +// @Tags Waitlist +// @Accept json +// @Produce json +// @Param body body object{email=string,name=string} true "Email and optional name" +// @Success 201 {object} map[string]interface{} +// @Failure 409 {object} map[string]interface{} +// @Router /waitlist [post] func (h *WaitlistHandler) AddToWaitlist(c *fiber.Ctx) error { var req struct { Email string `json:"email"` @@ -38,6 +47,13 @@ func (h *WaitlistHandler) AddToWaitlist(c *fiber.Ctx) error { return c.Status(201).JSON(fiber.Map{"message": "added to waitlist", "email": req.Email}) } +// GetWaitlist godoc +// @Summary List waitlist entries (admin) +// @Tags Admin +// @Produce json +// @Success 200 {array} domain.WaitlistEntry +// @Security BearerAuth +// @Router /waitlist [get] func (h *WaitlistHandler) GetWaitlist(c *fiber.Ctx) error { entries, err := h.waitlist.List(c.Context()) if err != nil { diff --git a/backend/internal/infrastructure/sqlc/blog_posts.sql.go b/backend/internal/infrastructure/sqlc/blog_posts.sql.go new file mode 100644 index 0000000..d45fcbc --- /dev/null +++ b/backend/internal/infrastructure/sqlc/blog_posts.sql.go @@ -0,0 +1,201 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: blog_posts.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const countBlogPosts = `-- name: CountBlogPosts :one +SELECT COUNT(*) FROM blog_posts WHERE ($1 = '' OR status = $1) +` + +func (q *Queries) CountBlogPosts(ctx context.Context, dollar_1 interface{}) (int64, error) { + row := q.db.QueryRow(ctx, countBlogPosts, dollar_1) + var count int64 + err := row.Scan(&count) + return count, err +} + +const createBlogPost = `-- name: CreateBlogPost :one +INSERT INTO blog_posts (title, slug, content, excerpt, cover_image, status, author_id, published_at, metadata) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) +RETURNING id, created_at +` + +type CreateBlogPostParams struct { + Title string `json:"title"` + Slug string `json:"slug"` + Content pgtype.Text `json:"content"` + Excerpt pgtype.Text `json:"excerpt"` + CoverImage pgtype.Text `json:"cover_image"` + Status pgtype.Text `json:"status"` + AuthorID pgtype.UUID `json:"author_id"` + PublishedAt pgtype.Timestamp `json:"published_at"` + Metadata []byte `json:"metadata"` +} + +type CreateBlogPostRow struct { + ID pgtype.UUID `json:"id"` + CreatedAt pgtype.Timestamp `json:"created_at"` +} + +func (q *Queries) CreateBlogPost(ctx context.Context, arg CreateBlogPostParams) (CreateBlogPostRow, error) { + row := q.db.QueryRow(ctx, createBlogPost, + arg.Title, + arg.Slug, + arg.Content, + arg.Excerpt, + arg.CoverImage, + arg.Status, + arg.AuthorID, + arg.PublishedAt, + arg.Metadata, + ) + var i CreateBlogPostRow + err := row.Scan(&i.ID, &i.CreatedAt) + return i, err +} + +const deleteBlogPost = `-- name: DeleteBlogPost :exec +DELETE FROM blog_posts WHERE id = $1 +` + +func (q *Queries) DeleteBlogPost(ctx context.Context, id pgtype.UUID) error { + _, err := q.db.Exec(ctx, deleteBlogPost, id) + return err +} + +const getBlogPostByID = `-- name: GetBlogPostByID :one +SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata +FROM blog_posts WHERE id = $1 +` + +func (q *Queries) GetBlogPostByID(ctx context.Context, id pgtype.UUID) (BlogPost, error) { + row := q.db.QueryRow(ctx, getBlogPostByID, id) + var i BlogPost + err := row.Scan( + &i.ID, + &i.Title, + &i.Slug, + &i.Content, + &i.Excerpt, + &i.CoverImage, + &i.Status, + &i.AuthorID, + &i.CreatedAt, + &i.PublishedAt, + &i.Metadata, + ) + return i, err +} + +const getBlogPostBySlug = `-- name: GetBlogPostBySlug :one +SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata +FROM blog_posts WHERE slug = $1 +` + +func (q *Queries) GetBlogPostBySlug(ctx context.Context, slug string) (BlogPost, error) { + row := q.db.QueryRow(ctx, getBlogPostBySlug, slug) + var i BlogPost + err := row.Scan( + &i.ID, + &i.Title, + &i.Slug, + &i.Content, + &i.Excerpt, + &i.CoverImage, + &i.Status, + &i.AuthorID, + &i.CreatedAt, + &i.PublishedAt, + &i.Metadata, + ) + return i, err +} + +const listBlogPosts = `-- name: ListBlogPosts :many +SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata +FROM blog_posts +WHERE ($1 = '' OR status = $1) +ORDER BY created_at DESC LIMIT $2 OFFSET $3 +` + +type ListBlogPostsParams struct { + Column1 interface{} `json:"column_1"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +func (q *Queries) ListBlogPosts(ctx context.Context, arg ListBlogPostsParams) ([]BlogPost, error) { + rows, err := q.db.Query(ctx, listBlogPosts, arg.Column1, arg.Limit, arg.Offset) + if err != nil { + return nil, err + } + defer rows.Close() + items := []BlogPost{} + for rows.Next() { + var i BlogPost + if err := rows.Scan( + &i.ID, + &i.Title, + &i.Slug, + &i.Content, + &i.Excerpt, + &i.CoverImage, + &i.Status, + &i.AuthorID, + &i.CreatedAt, + &i.PublishedAt, + &i.Metadata, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateBlogPost = `-- name: UpdateBlogPost :exec +UPDATE blog_posts +SET title = $1, slug = $2, content = $3, excerpt = $4, cover_image = $5, + status = $6, author_id = $7, published_at = $8, metadata = $9 +WHERE id = $10 +` + +type UpdateBlogPostParams struct { + Title string `json:"title"` + Slug string `json:"slug"` + Content pgtype.Text `json:"content"` + Excerpt pgtype.Text `json:"excerpt"` + CoverImage pgtype.Text `json:"cover_image"` + Status pgtype.Text `json:"status"` + AuthorID pgtype.UUID `json:"author_id"` + PublishedAt pgtype.Timestamp `json:"published_at"` + Metadata []byte `json:"metadata"` + ID pgtype.UUID `json:"id"` +} + +func (q *Queries) UpdateBlogPost(ctx context.Context, arg UpdateBlogPostParams) error { + _, err := q.db.Exec(ctx, updateBlogPost, + arg.Title, + arg.Slug, + arg.Content, + arg.Excerpt, + arg.CoverImage, + arg.Status, + arg.AuthorID, + arg.PublishedAt, + arg.Metadata, + arg.ID, + ) + return err +} diff --git a/backend/internal/infrastructure/sqlc/categories.sql.go b/backend/internal/infrastructure/sqlc/categories.sql.go new file mode 100644 index 0000000..75f26e4 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/categories.sql.go @@ -0,0 +1,88 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: categories.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createCategory = `-- name: CreateCategory :one +INSERT INTO categories (name, slug, parent_id) VALUES ($1, $2, $3) RETURNING id +` + +type CreateCategoryParams struct { + Name string `json:"name"` + Slug pgtype.Text `json:"slug"` + ParentID pgtype.UUID `json:"parent_id"` +} + +func (q *Queries) CreateCategory(ctx context.Context, arg CreateCategoryParams) (pgtype.UUID, error) { + row := q.db.QueryRow(ctx, createCategory, arg.Name, arg.Slug, arg.ParentID) + var id pgtype.UUID + err := row.Scan(&id) + return id, err +} + +const deleteCategory = `-- name: DeleteCategory :exec +DELETE FROM categories WHERE id = $1 +` + +func (q *Queries) DeleteCategory(ctx context.Context, id pgtype.UUID) error { + _, err := q.db.Exec(ctx, deleteCategory, id) + return err +} + +const listCategories = `-- name: ListCategories :many +SELECT id, name, slug, parent_id FROM categories ORDER BY name +` + +func (q *Queries) ListCategories(ctx context.Context) ([]Category, error) { + rows, err := q.db.Query(ctx, listCategories) + if err != nil { + return nil, err + } + defer rows.Close() + items := []Category{} + for rows.Next() { + var i Category + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Slug, + &i.ParentID, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateCategory = `-- name: UpdateCategory :exec +UPDATE categories SET name = $1, slug = $2, parent_id = $3 WHERE id = $4 +` + +type UpdateCategoryParams struct { + Name string `json:"name"` + Slug pgtype.Text `json:"slug"` + ParentID pgtype.UUID `json:"parent_id"` + ID pgtype.UUID `json:"id"` +} + +func (q *Queries) UpdateCategory(ctx context.Context, arg UpdateCategoryParams) error { + _, err := q.db.Exec(ctx, updateCategory, + arg.Name, + arg.Slug, + arg.ParentID, + arg.ID, + ) + return err +} diff --git a/backend/internal/infrastructure/sqlc/db.go b/backend/internal/infrastructure/sqlc/db.go new file mode 100644 index 0000000..468d1fa --- /dev/null +++ b/backend/internal/infrastructure/sqlc/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/backend/internal/infrastructure/sqlc/models.go b/backend/internal/infrastructure/sqlc/models.go new file mode 100644 index 0000000..8e2c792 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/models.go @@ -0,0 +1,285 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type AdminTool struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + Description pgtype.Text `json:"description"` + Url string `json:"url"` + Icon pgtype.Text `json:"icon"` + Category pgtype.Text `json:"category"` + IsActive pgtype.Bool `json:"is_active"` + MinRole pgtype.Text `json:"min_role"` + OrderIndex pgtype.Int4 `json:"order_index"` +} + +type AppLog struct { + ID int64 `json:"id"` + Level string `json:"level"` + Message string `json:"message"` + Source pgtype.Text `json:"source"` + Metadata []byte `json:"metadata"` + CreatedAt pgtype.Timestamp `json:"created_at"` +} + +type AuditLog struct { + ID pgtype.UUID `json:"id"` + UserID pgtype.UUID `json:"user_id"` + Action string `json:"action"` + Resource pgtype.Text `json:"resource"` + ResourceID pgtype.Text `json:"resource_id"` + Details []byte `json:"details"` + IpAddress pgtype.Text `json:"ip_address"` + CreatedAt pgtype.Timestamp `json:"created_at"` +} + +type Banner struct { + ID pgtype.UUID `json:"id"` + Title pgtype.Text `json:"title"` + ImageUrl string `json:"image_url"` + LinkUrl pgtype.Text `json:"link_url"` + TargetProfile pgtype.Text `json:"target_profile"` + IsActive pgtype.Bool `json:"is_active"` + StartDate pgtype.Timestamp `json:"start_date"` + EndDate pgtype.Timestamp `json:"end_date"` + DisplayDuration pgtype.Int4 `json:"display_duration"` + CacheKey pgtype.Text `json:"cache_key"` + OrderIndex pgtype.Int4 `json:"order_index"` +} + +type BlogPost struct { + ID pgtype.UUID `json:"id"` + Title string `json:"title"` + Slug string `json:"slug"` + Content pgtype.Text `json:"content"` + Excerpt pgtype.Text `json:"excerpt"` + CoverImage pgtype.Text `json:"cover_image"` + Status pgtype.Text `json:"status"` + AuthorID pgtype.UUID `json:"author_id"` + CreatedAt pgtype.Timestamp `json:"created_at"` + PublishedAt pgtype.Timestamp `json:"published_at"` + Metadata []byte `json:"metadata"` +} + +type BrandKit struct { + ID pgtype.UUID `json:"id"` + PrimaryColor pgtype.Text `json:"primary_color"` + SecondaryColor pgtype.Text `json:"secondary_color"` + LogoUrl pgtype.Text `json:"logo_url"` + FaviconUrl pgtype.Text `json:"favicon_url"` + FontFamily pgtype.Text `json:"font_family"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` + AccentColor pgtype.Text `json:"accent_color"` + AccentBg pgtype.Text `json:"accent_bg"` + AccentBorder pgtype.Text `json:"accent_border"` + TextColor pgtype.Text `json:"text_color"` + TextHeadingColor pgtype.Text `json:"text_heading_color"` + BgColor pgtype.Text `json:"bg_color"` + BorderColor pgtype.Text `json:"border_color"` + CodeBgColor pgtype.Text `json:"code_bg_color"` + DarkAccentColor pgtype.Text `json:"dark_accent_color"` + DarkAccentBg pgtype.Text `json:"dark_accent_bg"` + DarkAccentBorder pgtype.Text `json:"dark_accent_border"` + DarkTextColor pgtype.Text `json:"dark_text_color"` + DarkTextHeadingColor pgtype.Text `json:"dark_text_heading_color"` + DarkBgColor pgtype.Text `json:"dark_bg_color"` + DarkBorderColor pgtype.Text `json:"dark_border_color"` + DarkCodeBgColor pgtype.Text `json:"dark_code_bg_color"` + HeadingFont pgtype.Text `json:"heading_font"` + MonoFont pgtype.Text `json:"mono_font"` + BaseFontSize pgtype.Text `json:"base_font_size"` +} + +type Category struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + Slug pgtype.Text `json:"slug"` + ParentID pgtype.UUID `json:"parent_id"` +} + +type Coupon struct { + ID pgtype.UUID `json:"id"` + Code string `json:"code"` + DiscountType pgtype.Text `json:"discount_type"` + DiscountValue pgtype.Numeric `json:"discount_value"` + MinPurchase pgtype.Numeric `json:"min_purchase"` + ValidFrom pgtype.Timestamp `json:"valid_from"` + ValidUntil pgtype.Timestamp `json:"valid_until"` + MaxUses pgtype.Int4 `json:"max_uses"` + UsedCount pgtype.Int4 `json:"used_count"` + IsActive pgtype.Bool `json:"is_active"` +} + +type CronJob struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + Schedule string `json:"schedule"` + Handler string `json:"handler"` + IsActive pgtype.Bool `json:"is_active"` + LastRunAt pgtype.Timestamp `json:"last_run_at"` + NextRunAt pgtype.Timestamp `json:"next_run_at"` + CreatedAt pgtype.Timestamp `json:"created_at"` +} + +type EmailGroup struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + Description pgtype.Text `json:"description"` +} + +type EmailSubscription struct { + ID pgtype.UUID `json:"id"` + Email string `json:"email"` + GroupID pgtype.UUID `json:"group_id"` + IsActive pgtype.Bool `json:"is_active"` + SubscribedAt pgtype.Timestamp `json:"subscribed_at"` +} + +type FeatureFlag struct { + ID int32 `json:"id"` + Key string `json:"key"` + Enabled pgtype.Bool `json:"enabled"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +type HealthCheck struct { + ID pgtype.UUID `json:"id"` + ServiceName string `json:"service_name"` + Status string `json:"status"` + LatencyMs pgtype.Int4 `json:"latency_ms"` + Details []byte `json:"details"` + CheckedAt pgtype.Timestamp `json:"checked_at"` +} + +type JobExecution struct { + ID pgtype.UUID `json:"id"` + JobID pgtype.UUID `json:"job_id"` + Status string `json:"status"` + StartedAt pgtype.Timestamp `json:"started_at"` + FinishedAt pgtype.Timestamp `json:"finished_at"` + DurationMs pgtype.Int4 `json:"duration_ms"` + Error pgtype.Text `json:"error"` + Output []byte `json:"output"` +} + +type LegalPage struct { + ID pgtype.UUID `json:"id"` + Slug string `json:"slug"` + Title string `json:"title"` + Content string `json:"content"` + IsActive pgtype.Bool `json:"is_active"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +type LinktreeItem struct { + ID pgtype.UUID `json:"id"` + Title string `json:"title"` + Url string `json:"url"` + Icon pgtype.Text `json:"icon"` + OrderIndex pgtype.Int4 `json:"order_index"` + IsActive pgtype.Bool `json:"is_active"` +} + +type LogConfig struct { + ID int32 `json:"id"` + RetentionDays pgtype.Int4 `json:"retention_days"` + MinLevel pgtype.Text `json:"min_level"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +type Order struct { + ID pgtype.UUID `json:"id"` + UserID pgtype.UUID `json:"user_id"` + Status pgtype.Text `json:"status"` + Total pgtype.Numeric `json:"total"` + PaymentMethod pgtype.Text `json:"payment_method"` + PaymentID pgtype.Text `json:"payment_id"` + ShippingAddress []byte `json:"shipping_address"` + TrackingCode pgtype.Text `json:"tracking_code"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` + ReceiptUrl pgtype.Text `json:"receipt_url"` +} + +type OrderItem struct { + ID pgtype.UUID `json:"id"` + OrderID pgtype.UUID `json:"order_id"` + ProductID pgtype.UUID `json:"product_id"` + Quantity int32 `json:"quantity"` + UnitPrice pgtype.Numeric `json:"unit_price"` +} + +type PixConfig struct { + ID int32 `json:"id"` + PixKey string `json:"pix_key"` + KeyType string `json:"key_type"` + Beneficiary string `json:"beneficiary"` + City string `json:"city"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +type Product struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + Description pgtype.Text `json:"description"` + Price pgtype.Numeric `json:"price"` + Stock pgtype.Int4 `json:"stock"` + IsPreSale pgtype.Bool `json:"is_pre_sale"` + PreSaleAvailableAt pgtype.Timestamp `json:"pre_sale_available_at"` + Images []byte `json:"images"` + CategoryID pgtype.UUID `json:"category_id"` + IsActive pgtype.Bool `json:"is_active"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +type SecuritySetting struct { + ID int32 `json:"id"` + Key string `json:"key"` + Value string `json:"value"` + Description pgtype.Text `json:"description"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +type User struct { + ID pgtype.UUID `json:"id"` + Email string `json:"email"` + PasswordHash string `json:"password_hash"` + Name pgtype.Text `json:"name"` + Role pgtype.Text `json:"role"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` + EmailVerified pgtype.Bool `json:"email_verified"` + EmailVerifiedAt pgtype.Timestamp `json:"email_verified_at"` + StripeCustomerID pgtype.Text `json:"stripe_customer_id"` +} + +type UserGroup struct { + ID pgtype.UUID `json:"id"` + Name string `json:"name"` + DiscountPercentage pgtype.Numeric `json:"discount_percentage"` +} + +type UserProfile struct { + ID pgtype.UUID `json:"id"` + UserID pgtype.UUID `json:"user_id"` + Phone pgtype.Text `json:"phone"` + AvatarUrl pgtype.Text `json:"avatar_url"` + Address []byte `json:"address"` + Metadata []byte `json:"metadata"` +} + +type Waitlist struct { + ID pgtype.UUID `json:"id"` + Email string `json:"email"` + Name pgtype.Text `json:"name"` + Source pgtype.Text `json:"source"` + CreatedAt pgtype.Timestamp `json:"created_at"` +} diff --git a/backend/internal/infrastructure/sqlc/products.sql.go b/backend/internal/infrastructure/sqlc/products.sql.go new file mode 100644 index 0000000..cb50f6c --- /dev/null +++ b/backend/internal/infrastructure/sqlc/products.sql.go @@ -0,0 +1,194 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: products.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const countProducts = `-- name: CountProducts :one +SELECT COUNT(*) FROM products +WHERE ($1::uuid IS NULL OR category_id = $1) + AND ($2 = false OR is_active = true) +` + +type CountProductsParams struct { + Column1 pgtype.UUID `json:"column_1"` + Column2 interface{} `json:"column_2"` +} + +func (q *Queries) CountProducts(ctx context.Context, arg CountProductsParams) (int64, error) { + row := q.db.QueryRow(ctx, countProducts, arg.Column1, arg.Column2) + var count int64 + err := row.Scan(&count) + return count, err +} + +const createProduct = `-- name: CreateProduct :one +INSERT INTO products (name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) +RETURNING id, created_at, updated_at +` + +type CreateProductParams struct { + Name string `json:"name"` + Description pgtype.Text `json:"description"` + Price pgtype.Numeric `json:"price"` + Stock pgtype.Int4 `json:"stock"` + IsPreSale pgtype.Bool `json:"is_pre_sale"` + PreSaleAvailableAt pgtype.Timestamp `json:"pre_sale_available_at"` + Images []byte `json:"images"` + CategoryID pgtype.UUID `json:"category_id"` + IsActive pgtype.Bool `json:"is_active"` +} + +type CreateProductRow struct { + ID pgtype.UUID `json:"id"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +func (q *Queries) CreateProduct(ctx context.Context, arg CreateProductParams) (CreateProductRow, error) { + row := q.db.QueryRow(ctx, createProduct, + arg.Name, + arg.Description, + arg.Price, + arg.Stock, + arg.IsPreSale, + arg.PreSaleAvailableAt, + arg.Images, + arg.CategoryID, + arg.IsActive, + ) + var i CreateProductRow + err := row.Scan(&i.ID, &i.CreatedAt, &i.UpdatedAt) + return i, err +} + +const deleteProduct = `-- name: DeleteProduct :exec +DELETE FROM products WHERE id = $1 +` + +func (q *Queries) DeleteProduct(ctx context.Context, id pgtype.UUID) error { + _, err := q.db.Exec(ctx, deleteProduct, id) + return err +} + +const getProductByID = `-- name: GetProductByID :one +SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at +FROM products WHERE id = $1 +` + +func (q *Queries) GetProductByID(ctx context.Context, id pgtype.UUID) (Product, error) { + row := q.db.QueryRow(ctx, getProductByID, id) + var i Product + err := row.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.Price, + &i.Stock, + &i.IsPreSale, + &i.PreSaleAvailableAt, + &i.Images, + &i.CategoryID, + &i.IsActive, + &i.CreatedAt, + &i.UpdatedAt, + ) + return i, err +} + +const listProducts = `-- name: ListProducts :many +SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at +FROM products +WHERE ($1::uuid IS NULL OR category_id = $1) + AND ($2 = false OR is_active = true) +ORDER BY created_at DESC LIMIT $3 OFFSET $4 +` + +type ListProductsParams struct { + Column1 pgtype.UUID `json:"column_1"` + Column2 interface{} `json:"column_2"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +func (q *Queries) ListProducts(ctx context.Context, arg ListProductsParams) ([]Product, error) { + rows, err := q.db.Query(ctx, listProducts, + arg.Column1, + arg.Column2, + arg.Limit, + arg.Offset, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []Product{} + for rows.Next() { + var i Product + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.Price, + &i.Stock, + &i.IsPreSale, + &i.PreSaleAvailableAt, + &i.Images, + &i.CategoryID, + &i.IsActive, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateProduct = `-- name: UpdateProduct :exec +UPDATE products +SET name = $1, description = $2, price = $3, stock = $4, is_pre_sale = $5, + pre_sale_available_at = $6, images = $7, category_id = $8, is_active = $9 +WHERE id = $10 +` + +type UpdateProductParams struct { + Name string `json:"name"` + Description pgtype.Text `json:"description"` + Price pgtype.Numeric `json:"price"` + Stock pgtype.Int4 `json:"stock"` + IsPreSale pgtype.Bool `json:"is_pre_sale"` + PreSaleAvailableAt pgtype.Timestamp `json:"pre_sale_available_at"` + Images []byte `json:"images"` + CategoryID pgtype.UUID `json:"category_id"` + IsActive pgtype.Bool `json:"is_active"` + ID pgtype.UUID `json:"id"` +} + +func (q *Queries) UpdateProduct(ctx context.Context, arg UpdateProductParams) error { + _, err := q.db.Exec(ctx, updateProduct, + arg.Name, + arg.Description, + arg.Price, + arg.Stock, + arg.IsPreSale, + arg.PreSaleAvailableAt, + arg.Images, + arg.CategoryID, + arg.IsActive, + arg.ID, + ) + return err +} diff --git a/backend/internal/infrastructure/sqlc/querier.go b/backend/internal/infrastructure/sqlc/querier.go new file mode 100644 index 0000000..0b8c9c2 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/querier.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +type Querier interface { + CountBlogPosts(ctx context.Context, dollar_1 interface{}) (int64, error) + CountProducts(ctx context.Context, arg CountProductsParams) (int64, error) + CountUsers(ctx context.Context) (int64, error) + CreateBlogPost(ctx context.Context, arg CreateBlogPostParams) (CreateBlogPostRow, error) + CreateCategory(ctx context.Context, arg CreateCategoryParams) (pgtype.UUID, error) + CreateProduct(ctx context.Context, arg CreateProductParams) (CreateProductRow, error) + CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error) + DeleteBlogPost(ctx context.Context, id pgtype.UUID) error + DeleteCategory(ctx context.Context, id pgtype.UUID) error + DeleteProduct(ctx context.Context, id pgtype.UUID) error + DeleteUser(ctx context.Context, id pgtype.UUID) error + GetBlogPostByID(ctx context.Context, id pgtype.UUID) (BlogPost, error) + GetBlogPostBySlug(ctx context.Context, slug string) (BlogPost, error) + GetProductByID(ctx context.Context, id pgtype.UUID) (Product, error) + GetUserByEmail(ctx context.Context, email string) (GetUserByEmailRow, error) + GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDRow, error) + ListBlogPosts(ctx context.Context, arg ListBlogPostsParams) ([]BlogPost, error) + ListCategories(ctx context.Context) ([]Category, error) + ListProducts(ctx context.Context, arg ListProductsParams) ([]Product, error) + ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error) + UpdateBlogPost(ctx context.Context, arg UpdateBlogPostParams) error + UpdateCategory(ctx context.Context, arg UpdateCategoryParams) error + UpdateProduct(ctx context.Context, arg UpdateProductParams) error + UpdateStripeCustomerID(ctx context.Context, arg UpdateStripeCustomerIDParams) error + UpdateUser(ctx context.Context, arg UpdateUserParams) error + VerifyEmail(ctx context.Context, id pgtype.UUID) error +} + +var _ Querier = (*Queries)(nil) diff --git a/backend/internal/infrastructure/sqlc/queries/blog_posts.sql b/backend/internal/infrastructure/sqlc/queries/blog_posts.sql new file mode 100644 index 0000000..ead85d1 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/queries/blog_posts.sql @@ -0,0 +1,30 @@ +-- name: GetBlogPostByID :one +SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata +FROM blog_posts WHERE id = $1; + +-- name: GetBlogPostBySlug :one +SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata +FROM blog_posts WHERE slug = $1; + +-- name: ListBlogPosts :many +SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata +FROM blog_posts +WHERE ($1 = '' OR status = $1) +ORDER BY created_at DESC LIMIT $2 OFFSET $3; + +-- name: CountBlogPosts :one +SELECT COUNT(*) FROM blog_posts WHERE ($1 = '' OR status = $1); + +-- name: CreateBlogPost :one +INSERT INTO blog_posts (title, slug, content, excerpt, cover_image, status, author_id, published_at, metadata) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) +RETURNING id, created_at; + +-- name: UpdateBlogPost :exec +UPDATE blog_posts +SET title = $1, slug = $2, content = $3, excerpt = $4, cover_image = $5, + status = $6, author_id = $7, published_at = $8, metadata = $9 +WHERE id = $10; + +-- name: DeleteBlogPost :exec +DELETE FROM blog_posts WHERE id = $1; diff --git a/backend/internal/infrastructure/sqlc/queries/categories.sql b/backend/internal/infrastructure/sqlc/queries/categories.sql new file mode 100644 index 0000000..65c4ba5 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/queries/categories.sql @@ -0,0 +1,11 @@ +-- name: ListCategories :many +SELECT id, name, slug, parent_id FROM categories ORDER BY name; + +-- name: CreateCategory :one +INSERT INTO categories (name, slug, parent_id) VALUES ($1, $2, $3) RETURNING id; + +-- name: UpdateCategory :exec +UPDATE categories SET name = $1, slug = $2, parent_id = $3 WHERE id = $4; + +-- name: DeleteCategory :exec +DELETE FROM categories WHERE id = $1; diff --git a/backend/internal/infrastructure/sqlc/queries/products.sql b/backend/internal/infrastructure/sqlc/queries/products.sql new file mode 100644 index 0000000..ca42fdf --- /dev/null +++ b/backend/internal/infrastructure/sqlc/queries/products.sql @@ -0,0 +1,29 @@ +-- name: GetProductByID :one +SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at +FROM products WHERE id = $1; + +-- name: ListProducts :many +SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at +FROM products +WHERE ($1::uuid IS NULL OR category_id = $1) + AND ($2 = false OR is_active = true) +ORDER BY created_at DESC LIMIT $3 OFFSET $4; + +-- name: CountProducts :one +SELECT COUNT(*) FROM products +WHERE ($1::uuid IS NULL OR category_id = $1) + AND ($2 = false OR is_active = true); + +-- name: CreateProduct :one +INSERT INTO products (name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) +RETURNING id, created_at, updated_at; + +-- name: UpdateProduct :exec +UPDATE products +SET name = $1, description = $2, price = $3, stock = $4, is_pre_sale = $5, + pre_sale_available_at = $6, images = $7, category_id = $8, is_active = $9 +WHERE id = $10; + +-- name: DeleteProduct :exec +DELETE FROM products WHERE id = $1; diff --git a/backend/internal/infrastructure/sqlc/queries/users.sql b/backend/internal/infrastructure/sqlc/queries/users.sql new file mode 100644 index 0000000..c8ac9f0 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/queries/users.sql @@ -0,0 +1,32 @@ +-- name: GetUserByID :one +SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +FROM users WHERE id = $1; + +-- name: GetUserByEmail :one +SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +FROM users WHERE email = $1; + +-- name: CreateUser :one +INSERT INTO users (email, password_hash, name, role) +VALUES ($1, $2, $3, $4) +RETURNING id, email_verified, email_verified_at, created_at, updated_at; + +-- name: UpdateUser :exec +UPDATE users SET email = $1, password_hash = $2, name = $3, role = $4, updated_at = NOW() +WHERE id = $5; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = $1; + +-- name: ListUsers :many +SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2; + +-- name: CountUsers :one +SELECT COUNT(*) FROM users; + +-- name: VerifyEmail :exec +UPDATE users SET email_verified = true, email_verified_at = NOW() WHERE id = $1; + +-- name: UpdateStripeCustomerID :exec +UPDATE users SET stripe_customer_id = $1, updated_at = NOW() WHERE id = $2; diff --git a/backend/internal/infrastructure/sqlc/users.sql.go b/backend/internal/infrastructure/sqlc/users.sql.go new file mode 100644 index 0000000..c7e0fe7 --- /dev/null +++ b/backend/internal/infrastructure/sqlc/users.sql.go @@ -0,0 +1,244 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: users.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const countUsers = `-- name: CountUsers :one +SELECT COUNT(*) FROM users +` + +func (q *Queries) CountUsers(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, countUsers) + var count int64 + err := row.Scan(&count) + return count, err +} + +const createUser = `-- name: CreateUser :one +INSERT INTO users (email, password_hash, name, role) +VALUES ($1, $2, $3, $4) +RETURNING id, email_verified, email_verified_at, created_at, updated_at +` + +type CreateUserParams struct { + Email string `json:"email"` + PasswordHash string `json:"password_hash"` + Name pgtype.Text `json:"name"` + Role pgtype.Text `json:"role"` +} + +type CreateUserRow struct { + ID pgtype.UUID `json:"id"` + EmailVerified pgtype.Bool `json:"email_verified"` + EmailVerifiedAt pgtype.Timestamp `json:"email_verified_at"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error) { + row := q.db.QueryRow(ctx, createUser, + arg.Email, + arg.PasswordHash, + arg.Name, + arg.Role, + ) + var i CreateUserRow + err := row.Scan( + &i.ID, + &i.EmailVerified, + &i.EmailVerifiedAt, + &i.CreatedAt, + &i.UpdatedAt, + ) + return i, err +} + +const deleteUser = `-- name: DeleteUser :exec +DELETE FROM users WHERE id = $1 +` + +func (q *Queries) DeleteUser(ctx context.Context, id pgtype.UUID) error { + _, err := q.db.Exec(ctx, deleteUser, id) + return err +} + +const getUserByEmail = `-- name: GetUserByEmail :one +SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +FROM users WHERE email = $1 +` + +type GetUserByEmailRow struct { + ID pgtype.UUID `json:"id"` + Email string `json:"email"` + PasswordHash string `json:"password_hash"` + Name pgtype.Text `json:"name"` + Role pgtype.Text `json:"role"` + EmailVerified pgtype.Bool `json:"email_verified"` + EmailVerifiedAt pgtype.Timestamp `json:"email_verified_at"` + StripeCustomerID pgtype.Text `json:"stripe_customer_id"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +func (q *Queries) GetUserByEmail(ctx context.Context, email string) (GetUserByEmailRow, error) { + row := q.db.QueryRow(ctx, getUserByEmail, email) + var i GetUserByEmailRow + err := row.Scan( + &i.ID, + &i.Email, + &i.PasswordHash, + &i.Name, + &i.Role, + &i.EmailVerified, + &i.EmailVerifiedAt, + &i.StripeCustomerID, + &i.CreatedAt, + &i.UpdatedAt, + ) + return i, err +} + +const getUserByID = `-- name: GetUserByID :one +SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +FROM users WHERE id = $1 +` + +type GetUserByIDRow struct { + ID pgtype.UUID `json:"id"` + Email string `json:"email"` + PasswordHash string `json:"password_hash"` + Name pgtype.Text `json:"name"` + Role pgtype.Text `json:"role"` + EmailVerified pgtype.Bool `json:"email_verified"` + EmailVerifiedAt pgtype.Timestamp `json:"email_verified_at"` + StripeCustomerID pgtype.Text `json:"stripe_customer_id"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDRow, error) { + row := q.db.QueryRow(ctx, getUserByID, id) + var i GetUserByIDRow + err := row.Scan( + &i.ID, + &i.Email, + &i.PasswordHash, + &i.Name, + &i.Role, + &i.EmailVerified, + &i.EmailVerifiedAt, + &i.StripeCustomerID, + &i.CreatedAt, + &i.UpdatedAt, + ) + return i, err +} + +const listUsers = `-- name: ListUsers :many +SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2 +` + +type ListUsersParams struct { + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +type ListUsersRow struct { + ID pgtype.UUID `json:"id"` + Email string `json:"email"` + PasswordHash string `json:"password_hash"` + Name pgtype.Text `json:"name"` + Role pgtype.Text `json:"role"` + EmailVerified pgtype.Bool `json:"email_verified"` + EmailVerifiedAt pgtype.Timestamp `json:"email_verified_at"` + StripeCustomerID pgtype.Text `json:"stripe_customer_id"` + CreatedAt pgtype.Timestamp `json:"created_at"` + UpdatedAt pgtype.Timestamp `json:"updated_at"` +} + +func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error) { + rows, err := q.db.Query(ctx, listUsers, arg.Limit, arg.Offset) + if err != nil { + return nil, err + } + defer rows.Close() + items := []ListUsersRow{} + for rows.Next() { + var i ListUsersRow + if err := rows.Scan( + &i.ID, + &i.Email, + &i.PasswordHash, + &i.Name, + &i.Role, + &i.EmailVerified, + &i.EmailVerifiedAt, + &i.StripeCustomerID, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateStripeCustomerID = `-- name: UpdateStripeCustomerID :exec +UPDATE users SET stripe_customer_id = $1, updated_at = NOW() WHERE id = $2 +` + +type UpdateStripeCustomerIDParams struct { + StripeCustomerID pgtype.Text `json:"stripe_customer_id"` + ID pgtype.UUID `json:"id"` +} + +func (q *Queries) UpdateStripeCustomerID(ctx context.Context, arg UpdateStripeCustomerIDParams) error { + _, err := q.db.Exec(ctx, updateStripeCustomerID, arg.StripeCustomerID, arg.ID) + return err +} + +const updateUser = `-- name: UpdateUser :exec +UPDATE users SET email = $1, password_hash = $2, name = $3, role = $4, updated_at = NOW() +WHERE id = $5 +` + +type UpdateUserParams struct { + Email string `json:"email"` + PasswordHash string `json:"password_hash"` + Name pgtype.Text `json:"name"` + Role pgtype.Text `json:"role"` + ID pgtype.UUID `json:"id"` +} + +func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error { + _, err := q.db.Exec(ctx, updateUser, + arg.Email, + arg.PasswordHash, + arg.Name, + arg.Role, + arg.ID, + ) + return err +} + +const verifyEmail = `-- name: VerifyEmail :exec +UPDATE users SET email_verified = true, email_verified_at = NOW() WHERE id = $1 +` + +func (q *Queries) VerifyEmail(ctx context.Context, id pgtype.UUID) error { + _, err := q.db.Exec(ctx, verifyEmail, id) + return err +} diff --git a/backend/sqlc.yaml b/backend/sqlc.yaml new file mode 100644 index 0000000..28815aa --- /dev/null +++ b/backend/sqlc.yaml @@ -0,0 +1,12 @@ +version: "1" +packages: + - name: "db" + path: "internal/infrastructure/sqlc" + schema: "./migrations/" + queries: "internal/infrastructure/sqlc/queries/" + engine: "postgresql" + emit_json_tags: true + emit_interface: true + emit_exact_table_names: false + emit_empty_slices: true + sql_package: "pgx/v5" diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..d179c69 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,3 @@ +export default { + extends: ['@commitlint/config-conventional'], +} diff --git a/e2e/basic.spec.ts b/e2e/basic.spec.ts new file mode 100644 index 0000000..bec90ac --- /dev/null +++ b/e2e/basic.spec.ts @@ -0,0 +1,11 @@ +import { test, expect } from '@playwright/test' + +test('health endpoint returns 200', async ({ request }) => { + const res = await request.get('/healthz') + expect(res.ok()).toBeTruthy() +}) + +test('frontend loads', async ({ page }) => { + await page.goto('/') + await expect(page.locator('body')).toBeVisible() +}) diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts new file mode 100644 index 0000000..26e1ebf --- /dev/null +++ b/e2e/playwright.config.ts @@ -0,0 +1,21 @@ +import { defineConfig, devices } from '@playwright/test' + +export default defineConfig({ + testDir: '.', + timeout: 30000, + retries: 1, + use: { + baseURL: 'http://localhost', + trace: 'on-first-retry', + }, + projects: [ + { name: 'chromium', use: { ...devices['Desktop Chrome'] } }, + ], + webServer: { + command: 'docker compose up -d --wait', + url: 'http://localhost/healthz', + reuseExistingServer: true, + timeout: 60000, + cwd: '..', + }, +}) diff --git a/frontend/bun.lock b/frontend/bun.lock index d29c786..a61c289 100644 --- a/frontend/bun.lock +++ b/frontend/bun.lock @@ -14,6 +14,7 @@ "vue-router": "^5.0.4", }, "devDependencies": { + "@playwright/test": "^1.59.1", "@types/node": "^24.12.2", "@vitejs/plugin-vue": "^6.0.5", "@vue/tsconfig": "^0.9.1", @@ -234,6 +235,8 @@ "@oxc-project/types": ["@oxc-project/types@0.123.0", "", {}, "sha512-YtECP/y8Mj1lSHiUWGSRzy/C6teUKlS87dEfuVKT09LgQbUsBW1rNg+MiJ4buGu3yuADV60gbIvo9/HplA56Ew=="], + "@playwright/test": ["@playwright/test@1.59.1", "", { "dependencies": { "playwright": "1.59.1" }, "bin": { "playwright": "cli.js" } }, "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg=="], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.0.0-rc.13", "", { "os": "android", "cpu": "arm64" }, "sha512-5ZiiecKH2DXAVJTNN13gNMUcCDg4Jy8ZjbXEsPnqa248wgOVeYRX0iqXXD5Jz4bI9BFHgKsI2qmyJynstbmr+g=="], "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.0-rc.13", "", { "os": "darwin", "cpu": "arm64" }, "sha512-tz/v/8G77seu8zAB3A5sK3UFoOl06zcshEzhUO62sAEtrEuW/H1CcyoupOrD+NbQJytYgA4CppXPzlrmp4JZKA=="], @@ -734,6 +737,10 @@ "pkg-types": ["pkg-types@2.3.0", "", { "dependencies": { "confbox": "^0.2.2", "exsolve": "^1.0.7", "pathe": "^2.0.3" } }, "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig=="], + "playwright": ["playwright@1.59.1", "", { "dependencies": { "playwright-core": "1.59.1" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw=="], + + "playwright-core": ["playwright-core@1.59.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg=="], + "pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="], "possible-typed-array-names": ["possible-typed-array-names@1.1.0", "", {}, "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg=="], @@ -1016,6 +1023,8 @@ "path-scurry/lru-cache": ["lru-cache@11.3.3", "", {}, "sha512-JvNw9Y81y33E+BEYPr0U7omo+U9AySnsMsEiXgwT6yqd31VQWTLNQqmT4ou5eqPFUrTfIDFta2wKhB1hyohtAQ=="], + "playwright/fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="], + "rolldown/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-rc.13", "", {}, "sha512-3ngTAv6F/Py35BsYbeeLeecvhMKdsKm4AoOETVhAA+Qc8nrA2I0kF7oa93mE9qnIurngOSpMnQ0x2nQY2FPviA=="], "source-map-support/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], diff --git a/frontend/package.json b/frontend/package.json index d73d5f1..a6f4f92 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,7 +8,8 @@ "build": "vue-tsc -b && vite build", "preview": "vite preview", "test": "vitest run", - "test:watch": "vitest" + "test:watch": "vitest", + "e2e": "playwright test --config ../e2e/playwright.config.ts" }, "dependencies": { "@fortawesome/fontawesome-free": "^7.2.0", @@ -20,6 +21,7 @@ "vue-router": "^5.0.4" }, "devDependencies": { + "@playwright/test": "^1.59.1", "@types/node": "^24.12.2", "@vitejs/plugin-vue": "^6.0.5", "@vue/tsconfig": "^0.9.1", diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ba5b2a3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1264 @@ +{ + "name": "blueprint", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "blueprint", + "devDependencies": { + "@commitlint/cli": "^19.0.0", + "@commitlint/config-conventional": "^19.0.0", + "husky": "^9.1.7" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@commitlint/cli": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-19.8.1.tgz", + "integrity": "sha512-LXUdNIkspyxrlV6VDHWBmCZRtkEVRpBKxi2Gtw3J54cGWhLCTouVD/Q6ZSaSvd2YaDObWK8mDjrz3TIKtaQMAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/format": "^19.8.1", + "@commitlint/lint": "^19.8.1", + "@commitlint/load": "^19.8.1", + "@commitlint/read": "^19.8.1", + "@commitlint/types": "^19.8.1", + "tinyexec": "^1.0.0", + "yargs": "^17.0.0" + }, + "bin": { + "commitlint": "cli.js" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/config-conventional": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-19.8.1.tgz", + "integrity": "sha512-/AZHJL6F6B/G959CsMAzrPKKZjeEiAVifRyEwXxcT6qtqbPwGw+iQxmNS+Bu+i09OCtdNRW6pNpBvgPrtMr9EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/types": "^19.8.1", + "conventional-changelog-conventionalcommits": "^7.0.2" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/config-validator": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-19.8.1.tgz", + "integrity": "sha512-0jvJ4u+eqGPBIzzSdqKNX1rvdbSU1lPNYlfQQRIFnBgLy26BtC0cFnr7c/AyuzExMxWsMOte6MkTi9I3SQ3iGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/types": "^19.8.1", + "ajv": "^8.11.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/ensure": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-19.8.1.tgz", + "integrity": "sha512-mXDnlJdvDzSObafjYrOSvZBwkD01cqB4gbnnFuVyNpGUM5ijwU/r/6uqUmBXAAOKRfyEjpkGVZxaDsCVnHAgyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/types": "^19.8.1", + "lodash.camelcase": "^4.3.0", + "lodash.kebabcase": "^4.1.1", + "lodash.snakecase": "^4.1.1", + "lodash.startcase": "^4.4.0", + "lodash.upperfirst": "^4.3.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/execute-rule": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-19.8.1.tgz", + "integrity": "sha512-YfJyIqIKWI64Mgvn/sE7FXvVMQER/Cd+s3hZke6cI1xgNT/f6ZAz5heND0QtffH+KbcqAwXDEE1/5niYayYaQA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/format": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-19.8.1.tgz", + "integrity": "sha512-kSJj34Rp10ItP+Eh9oCItiuN/HwGQMXBnIRk69jdOwEW9llW9FlyqcWYbHPSGofmjsqeoxa38UaEA5tsbm2JWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/types": "^19.8.1", + "chalk": "^5.3.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/is-ignored": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-19.8.1.tgz", + "integrity": "sha512-AceOhEhekBUQ5dzrVhDDsbMaY5LqtN8s1mqSnT2Kz1ERvVZkNihrs3Sfk1Je/rxRNbXYFzKZSHaPsEJJDJV8dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/types": "^19.8.1", + "semver": "^7.6.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/lint": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-19.8.1.tgz", + "integrity": "sha512-52PFbsl+1EvMuokZXLRlOsdcLHf10isTPlWwoY1FQIidTsTvjKXVXYb7AvtpWkDzRO2ZsqIgPK7bI98x8LRUEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/is-ignored": "^19.8.1", + "@commitlint/parse": "^19.8.1", + "@commitlint/rules": "^19.8.1", + "@commitlint/types": "^19.8.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/load": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-19.8.1.tgz", + "integrity": "sha512-9V99EKG3u7z+FEoe4ikgq7YGRCSukAcvmKQuTtUyiYPnOd9a2/H9Ak1J9nJA1HChRQp9OA/sIKPugGS+FK/k1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/config-validator": "^19.8.1", + "@commitlint/execute-rule": "^19.8.1", + "@commitlint/resolve-extends": "^19.8.1", + "@commitlint/types": "^19.8.1", + "chalk": "^5.3.0", + "cosmiconfig": "^9.0.0", + "cosmiconfig-typescript-loader": "^6.1.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2", + "lodash.uniq": "^4.5.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/message": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.8.1.tgz", + "integrity": "sha512-+PMLQvjRXiU+Ae0Wc+p99EoGEutzSXFVwQfa3jRNUZLNW5odZAyseb92OSBTKCu+9gGZiJASt76Cj3dLTtcTdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/parse": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-19.8.1.tgz", + "integrity": "sha512-mmAHYcMBmAgJDKWdkjIGq50X4yB0pSGpxyOODwYmoexxxiUCy5JJT99t1+PEMK7KtsCtzuWYIAXYAiKR+k+/Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/types": "^19.8.1", + "conventional-changelog-angular": "^7.0.0", + "conventional-commits-parser": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/read": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-19.8.1.tgz", + "integrity": "sha512-03Jbjb1MqluaVXKHKRuGhcKWtSgh3Jizqy2lJCRbRrnWpcM06MYm8th59Xcns8EqBYvo0Xqb+2DoZFlga97uXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/top-level": "^19.8.1", + "@commitlint/types": "^19.8.1", + "git-raw-commits": "^4.0.0", + "minimist": "^1.2.8", + "tinyexec": "^1.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/resolve-extends": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-19.8.1.tgz", + "integrity": "sha512-GM0mAhFk49I+T/5UCYns5ayGStkTt4XFFrjjf0L4S26xoMTSkdCf9ZRO8en1kuopC4isDFuEm7ZOm/WRVeElVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/config-validator": "^19.8.1", + "@commitlint/types": "^19.8.1", + "global-directory": "^4.0.1", + "import-meta-resolve": "^4.0.0", + "lodash.mergewith": "^4.6.2", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/rules": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-19.8.1.tgz", + "integrity": "sha512-Hnlhd9DyvGiGwjfjfToMi1dsnw1EXKGJNLTcsuGORHz6SS9swRgkBsou33MQ2n51/boIDrbsg4tIBbRpEWK2kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@commitlint/ensure": "^19.8.1", + "@commitlint/message": "^19.8.1", + "@commitlint/to-lines": "^19.8.1", + "@commitlint/types": "^19.8.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/to-lines": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-19.8.1.tgz", + "integrity": "sha512-98Mm5inzbWTKuZQr2aW4SReY6WUukdWXuZhrqf1QdKPZBCCsXuG87c+iP0bwtD6DBnmVVQjgp4whoHRVixyPBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/top-level": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-19.8.1.tgz", + "integrity": "sha512-Ph8IN1IOHPSDhURCSXBz44+CIu+60duFwRsg6HqaISFHQHbmBtxVw4ZrFNIYUzEP7WwrNPxa2/5qJ//NK1FGcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^7.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/types": { + "version": "19.8.1", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-19.8.1.tgz", + "integrity": "sha512-/yCrWGCoA1SVKOks25EGadP9Pnj0oAIHGpl2wH2M2Y46dPM2ueb8wyCVOD7O3WCTkaJ0IkKvzhl1JY7+uCT2Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/conventional-commits-parser": "^5.0.0", + "chalk": "^5.3.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@types/conventional-commits-parser": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.2.tgz", + "integrity": "sha512-BgT2szDXnVypgpNxOK8aL5SGjUdaQbC++WZNjF1Qge3Og2+zhHj+RWhmehLhYyvQwqAmvezruVfOf8+3m74W+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "25.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.2.tgz", + "integrity": "sha512-sokuT28dxf9JT5Kady1fsXOvI4HVpjZa95NKT5y9PNTIrs2AsobR4GFAA90ZG8M+nxVRLysCXsVj6eGC7Vbrlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.19.0" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true, + "license": "MIT" + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", + "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-changelog-conventionalcommits": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz", + "integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", + "dev": true, + "license": "ISC", + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-commits-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-text-path": "^2.0.0", + "JSONStream": "^1.3.5", + "meow": "^12.0.1", + "split2": "^4.0.0" + }, + "bin": { + "conventional-commits-parser": "cli.mjs" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/cosmiconfig": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.1.tgz", + "integrity": "sha512-hr4ihw+DBqcvrsEDioRO31Z17x71pUYoNe/4h6Z0wB72p7MU7/9gH8Q3s12NFhHPfYBBOV3qyfUxmr/Yn3shnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cosmiconfig-typescript-loader": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-6.3.0.tgz", + "integrity": "sha512-Akr82WH1Wfqatyiqpj8HDkO2o2KmJRu1FhKfSNJP3K4IdXwHfEyL7MOb62i1AGQVLtIQM+iCE9CGOtrfhR+mmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jiti": "2.6.1" + }, + "engines": { + "node": ">=v18" + }, + "peerDependencies": { + "@types/node": "*", + "cosmiconfig": ">=9", + "typescript": ">=5" + } + }, + "node_modules/dargs": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-8.1.0.tgz", + "integrity": "sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz", + "integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/find-up": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^7.2.0", + "path-exists": "^5.0.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/git-raw-commits": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", + "integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==", + "deprecated": "This package is no longer maintained. For the JavaScript API, please use @conventional-changelog/git-client instead.", + "dev": true, + "license": "MIT", + "dependencies": { + "dargs": "^8.0.0", + "meow": "^12.0.1", + "split2": "^4.0.0" + }, + "bin": { + "git-raw-commits": "cli.mjs" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/global-directory": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", + "integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ini": "4.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/import-meta-resolve": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", + "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ini": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", + "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-text-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "text-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jiti": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", + "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.kebabcase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.startcase": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", + "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.upperfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", + "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", + "dev": true, + "license": "MIT" + }, + "node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-extensions": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", + "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.1.2.tgz", + "integrity": "sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.19.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz", + "integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz", + "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..278d5d7 --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "blueprint", + "private": true, + "type": "module", + "devDependencies": { + "@commitlint/cli": "^19.0.0", + "@commitlint/config-conventional": "^19.0.0", + "husky": "^9.1.7" + }, + "scripts": { + "commitlint": "commitlint --edit", + "prepare": "husky" + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..ba5c65c --- /dev/null +++ b/renovate.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:recommended"], + "labels": ["dependencies"], + "packageRules": [ + { + "matchUpdateTypes": ["minor", "patch"], + "automerge": true + }, + { + "matchDepTypes": ["devDependencies"], + "automerge": true + } + ], + "postUpdateOptions": ["gomodTidy"] +} From 5dcf4ef586b9993cca00bee9d236d180ae69c1b1 Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Fri, 8 May 2026 13:48:20 -0300 Subject: [PATCH 2/8] chore: replace husky with lefthook for faster git hooks --- .husky/commit-msg | 1 - .husky/pre-commit | 1 - lefthook.yml | 4 ++++ package.json | 7 +------ 4 files changed, 5 insertions(+), 8 deletions(-) delete mode 100755 .husky/commit-msg delete mode 100644 .husky/pre-commit create mode 100644 lefthook.yml diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index da99483..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1 +0,0 @@ -npx --no -- commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index 72c4429..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1 +0,0 @@ -npm test diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..907ebd7 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,4 @@ +commit-msg: + commands: + commitlint: + run: npx --no -- commitlint --edit {1} diff --git a/package.json b/package.json index 278d5d7..985ff7d 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,6 @@ "type": "module", "devDependencies": { "@commitlint/cli": "^19.0.0", - "@commitlint/config-conventional": "^19.0.0", - "husky": "^9.1.7" - }, - "scripts": { - "commitlint": "commitlint --edit", - "prepare": "husky" + "@commitlint/config-conventional": "^19.0.0" } } From f49f095655e4969fdcfe261af21255929456c275 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 16:57:41 +0000 Subject: [PATCH 3/8] fix: address PR review feedback for swagger, e2e, and sqlc typing Agent-Logs-Url: https://github.com/afa7789/blueprint/sessions/32ffd8d6-cc69-4684-b0ac-93b7680679fd Co-authored-by: afa7789 <26887703+afa7789@users.noreply.github.com> --- Makefile | 2 +- backend/cmd/server/main.go | 8 +++++--- .../internal/infrastructure/sqlc/blog_posts.sql.go | 12 ++++++------ backend/internal/infrastructure/sqlc/products.sql.go | 8 ++++---- backend/internal/infrastructure/sqlc/querier.go | 2 +- .../infrastructure/sqlc/queries/blog_posts.sql | 4 ++-- .../infrastructure/sqlc/queries/products.sql | 4 ++-- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index e92c4a4..2236084 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ sqlc: cd backend && sqlc generate e2e: - npx playwright test --config e2e/playwright.config.ts + cd frontend && bun run e2e tidy: cd backend && go mod tidy diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index 32bab3a..94a387d 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -27,6 +27,7 @@ import ( "log" "time" + swaggerdocs "github.com/afa/blueprint/backend/docs/swagger" "github.com/gofiber/contrib/swagger" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" @@ -121,9 +122,10 @@ func main() { // Swagger UI app.Get("/swagger/*", swagger.New(swagger.Config{ - BasePath: "/", - FilePath: "docs/swagger/swagger.json", - Path: "/swagger", + BasePath: "/", + FilePath: "swagger.json", + FileContent: []byte(swaggerdocs.SwaggerInfo.ReadDoc()), + Path: "/swagger", })) // Health check diff --git a/backend/internal/infrastructure/sqlc/blog_posts.sql.go b/backend/internal/infrastructure/sqlc/blog_posts.sql.go index d45fcbc..38c2657 100644 --- a/backend/internal/infrastructure/sqlc/blog_posts.sql.go +++ b/backend/internal/infrastructure/sqlc/blog_posts.sql.go @@ -12,10 +12,10 @@ import ( ) const countBlogPosts = `-- name: CountBlogPosts :one -SELECT COUNT(*) FROM blog_posts WHERE ($1 = '' OR status = $1) +SELECT COUNT(*) FROM blog_posts WHERE ($1::text = '' OR status = $1::text) ` -func (q *Queries) CountBlogPosts(ctx context.Context, dollar_1 interface{}) (int64, error) { +func (q *Queries) CountBlogPosts(ctx context.Context, dollar_1 string) (int64, error) { row := q.db.QueryRow(ctx, countBlogPosts, dollar_1) var count int64 err := row.Scan(&count) @@ -122,14 +122,14 @@ func (q *Queries) GetBlogPostBySlug(ctx context.Context, slug string) (BlogPost, const listBlogPosts = `-- name: ListBlogPosts :many SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata FROM blog_posts -WHERE ($1 = '' OR status = $1) +WHERE ($1::text = '' OR status = $1::text) ORDER BY created_at DESC LIMIT $2 OFFSET $3 ` type ListBlogPostsParams struct { - Column1 interface{} `json:"column_1"` - Limit int32 `json:"limit"` - Offset int32 `json:"offset"` + Column1 string `json:"column_1"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` } func (q *Queries) ListBlogPosts(ctx context.Context, arg ListBlogPostsParams) ([]BlogPost, error) { diff --git a/backend/internal/infrastructure/sqlc/products.sql.go b/backend/internal/infrastructure/sqlc/products.sql.go index cb50f6c..7c34992 100644 --- a/backend/internal/infrastructure/sqlc/products.sql.go +++ b/backend/internal/infrastructure/sqlc/products.sql.go @@ -14,12 +14,12 @@ import ( const countProducts = `-- name: CountProducts :one SELECT COUNT(*) FROM products WHERE ($1::uuid IS NULL OR category_id = $1) - AND ($2 = false OR is_active = true) + AND ($2::boolean = false OR is_active = true) ` type CountProductsParams struct { Column1 pgtype.UUID `json:"column_1"` - Column2 interface{} `json:"column_2"` + Column2 bool `json:"column_2"` } func (q *Queries) CountProducts(ctx context.Context, arg CountProductsParams) (int64, error) { @@ -108,13 +108,13 @@ const listProducts = `-- name: ListProducts :many SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at FROM products WHERE ($1::uuid IS NULL OR category_id = $1) - AND ($2 = false OR is_active = true) + AND ($2::boolean = false OR is_active = true) ORDER BY created_at DESC LIMIT $3 OFFSET $4 ` type ListProductsParams struct { Column1 pgtype.UUID `json:"column_1"` - Column2 interface{} `json:"column_2"` + Column2 bool `json:"column_2"` Limit int32 `json:"limit"` Offset int32 `json:"offset"` } diff --git a/backend/internal/infrastructure/sqlc/querier.go b/backend/internal/infrastructure/sqlc/querier.go index 0b8c9c2..df91123 100644 --- a/backend/internal/infrastructure/sqlc/querier.go +++ b/backend/internal/infrastructure/sqlc/querier.go @@ -11,7 +11,7 @@ import ( ) type Querier interface { - CountBlogPosts(ctx context.Context, dollar_1 interface{}) (int64, error) + CountBlogPosts(ctx context.Context, dollar_1 string) (int64, error) CountProducts(ctx context.Context, arg CountProductsParams) (int64, error) CountUsers(ctx context.Context) (int64, error) CreateBlogPost(ctx context.Context, arg CreateBlogPostParams) (CreateBlogPostRow, error) diff --git a/backend/internal/infrastructure/sqlc/queries/blog_posts.sql b/backend/internal/infrastructure/sqlc/queries/blog_posts.sql index ead85d1..d17ae37 100644 --- a/backend/internal/infrastructure/sqlc/queries/blog_posts.sql +++ b/backend/internal/infrastructure/sqlc/queries/blog_posts.sql @@ -9,11 +9,11 @@ FROM blog_posts WHERE slug = $1; -- name: ListBlogPosts :many SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata FROM blog_posts -WHERE ($1 = '' OR status = $1) +WHERE ($1::text = '' OR status = $1::text) ORDER BY created_at DESC LIMIT $2 OFFSET $3; -- name: CountBlogPosts :one -SELECT COUNT(*) FROM blog_posts WHERE ($1 = '' OR status = $1); +SELECT COUNT(*) FROM blog_posts WHERE ($1::text = '' OR status = $1::text); -- name: CreateBlogPost :one INSERT INTO blog_posts (title, slug, content, excerpt, cover_image, status, author_id, published_at, metadata) diff --git a/backend/internal/infrastructure/sqlc/queries/products.sql b/backend/internal/infrastructure/sqlc/queries/products.sql index ca42fdf..fef0c40 100644 --- a/backend/internal/infrastructure/sqlc/queries/products.sql +++ b/backend/internal/infrastructure/sqlc/queries/products.sql @@ -6,13 +6,13 @@ FROM products WHERE id = $1; SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at FROM products WHERE ($1::uuid IS NULL OR category_id = $1) - AND ($2 = false OR is_active = true) + AND ($2::boolean = false OR is_active = true) ORDER BY created_at DESC LIMIT $3 OFFSET $4; -- name: CountProducts :one SELECT COUNT(*) FROM products WHERE ($1::uuid IS NULL OR category_id = $1) - AND ($2 = false OR is_active = true); + AND ($2::boolean = false OR is_active = true); -- name: CreateProduct :one INSERT INTO products (name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active) From 2d0570ffb146f685cc01841f817bf13961f679d5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 17:09:23 +0000 Subject: [PATCH 4/8] fix: resolve CI failures in build, e2e, and security jobs Agent-Logs-Url: https://github.com/afa7789/blueprint/sessions/70fc17aa-6173-4c11-8a2f-b5cc627e43b2 Co-authored-by: afa7789 <26887703+afa7789@users.noreply.github.com> --- .github/workflows/ci.yml | 7 +- backend/go.mod | 52 ++++---- backend/go.sum | 206 +++++++++++------------------- backend/internal/handlers/blog.go | 1 + go.work.sum | 13 +- 5 files changed, 108 insertions(+), 171 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a6b735..415b859 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: "1.25" + GO_VERSION: "1.25.10" BUN_VERSION: "1.2.21" jobs: @@ -103,12 +103,13 @@ jobs: - name: Install Playwright run: | + sudo chown -R "$USER:$USER" frontend/node_modules || true cd frontend bun install --frozen-lockfile - bunx playwright install chromium + bunx --bun playwright install chromium - name: Run E2E tests - run: bunx playwright test --config e2e/playwright.config.ts + run: cd frontend && bun run e2e - name: Upload report if: failure() diff --git a/backend/go.mod b/backend/go.mod index fd09a7a..a29c13f 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -9,7 +9,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/s3 v1.100.0 github.com/aws/smithy-go v1.25.0 github.com/gofiber/contrib/swagger v1.3.0 - github.com/gofiber/fiber/v2 v2.52.6 + github.com/gofiber/fiber/v2 v2.52.13 github.com/golang-jwt/jwt/v5 v5.3.1 github.com/golang-migrate/migrate/v4 v4.19.1 github.com/google/uuid v1.6.0 @@ -20,13 +20,12 @@ require ( github.com/stripe/stripe-go/v82 v82.5.1 github.com/swaggo/swag v1.16.6 github.com/valyala/fasthttp v1.51.0 - golang.org/x/crypto v0.49.0 + golang.org/x/crypto v0.50.0 ) require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/andybalholm/brotli v1.1.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 // indirect @@ -43,44 +42,51 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/go-openapi/analysis v0.21.4 // indirect - github.com/go-openapi/errors v0.20.4 // indirect - github.com/go-openapi/jsonpointer v0.20.0 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/loads v0.21.2 // indirect - github.com/go-openapi/runtime v0.26.2 // indirect - github.com/go-openapi/spec v0.20.11 // indirect - github.com/go-openapi/strfmt v0.21.8 // indirect - github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-openapi/validate v0.22.3 // indirect + github.com/go-openapi/analysis v0.25.0 // indirect + github.com/go-openapi/errors v0.22.7 // indirect + github.com/go-openapi/jsonpointer v0.22.5 // indirect + github.com/go-openapi/jsonreference v0.21.5 // indirect + github.com/go-openapi/loads v0.23.3 // indirect + github.com/go-openapi/runtime v0.29.5 // indirect + github.com/go-openapi/spec v0.22.4 // indirect + github.com/go-openapi/strfmt v0.26.2 // indirect + github.com/go-openapi/swag/conv v0.26.0 // indirect + github.com/go-openapi/swag/fileutils v0.26.0 // indirect + github.com/go-openapi/swag/jsonname v0.25.5 // indirect + github.com/go-openapi/swag/jsonutils v0.26.0 // indirect + github.com/go-openapi/swag/loading v0.25.5 // indirect + github.com/go-openapi/swag/mangling v0.25.5 // indirect + github.com/go-openapi/swag/stringutils v0.26.0 // indirect + github.com/go-openapi/swag/typeutils v0.26.0 // indirect + github.com/go-openapi/swag/yamlutils v0.25.5 // indirect + github.com/go-openapi/validate v0.25.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect - github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/compress v1.18.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect - github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/oklog/ulid v1.3.1 // indirect + github.com/oklog/ulid/v2 v2.1.1 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect - go.mongodb.org/mongo-driver v1.13.1 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/mod v0.33.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/mod v0.34.0 // indirect + golang.org/x/net v0.53.0 // indirect golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect - golang.org/x/tools v0.42.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/text v0.36.0 // indirect + golang.org/x/tools v0.43.0 // indirect google.golang.org/protobuf v1.36.8 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/backend/go.sum b/backend/go.sum index 4b53a20..38ced6b 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -6,9 +6,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go-v2 v1.41.6 h1:1AX0AthnBQzMx1vbmir3Y4WsnJgiydmnJjiLu+LvXOg= github.com/aws/aws-sdk-go-v2 v1.41.6/go.mod h1:dy0UzBIfwSeot4grGvY1AqFWN5zgziMmWGzysDnHFcQ= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 h1:adBsCIIpLbLmYnkQU+nAChU5yhVTvu5PerROm+/Kq2A= @@ -59,7 +56,6 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= @@ -80,52 +76,63 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= -github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo= -github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWLG6M= -github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= -github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= -github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= -github.com/go-openapi/runtime v0.26.2 h1:elWyB9MacRzvIVgAZCBJmqTi7hBzU0hlKD4IvfX0Zl0= -github.com/go-openapi/runtime v0.26.2/go.mod h1:O034jyRZ557uJKzngbMDJXkcKJVzXJiymdSfgejrcRw= -github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= -github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY= -github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= -github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= -github.com/go-openapi/strfmt v0.21.8 h1:VYBUoKYRLAlgKDrIxR/I0lKrztDQ0tuTDrbhLVP8Erg= -github.com/go-openapi/strfmt v0.21.8/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/analysis v0.25.0 h1:EnjAq1yO8wEO9HbPmY8vLPEIkdZuuFhCAKBPvCB7bCs= +github.com/go-openapi/analysis v0.25.0/go.mod h1:5WFTRE43WLkPG9r9OtlMfqkkvUTYLVVCIxLlEpyF8kE= +github.com/go-openapi/errors v0.22.7 h1:JLFBGC0Apwdzw3484MmBqspjPbwa2SHvpDm0u5aGhUA= +github.com/go-openapi/errors v0.22.7/go.mod h1://QW6SD9OsWtH6gHllUCddOXDL0tk0ZGNYHwsw4sW3w= +github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA= +github.com/go-openapi/jsonpointer v0.22.5/go.mod h1:gyUR3sCvGSWchA2sUBJGluYMbe1zazrYWIkWPjjMUY0= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= +github.com/go-openapi/loads v0.23.3 h1:g5Xap1JfwKkUnZdn+S0L3SzBDpcTIYzZ5Qaag0YDkKQ= +github.com/go-openapi/loads v0.23.3/go.mod h1:NOH07zLajXo8y55hom0omlHWDVVvCwBM/S+csCK8LqA= +github.com/go-openapi/runtime v0.29.5 h1:uc5+/TtqLIfDBTUxnF3uppoGMt+9DzonwUWsviINlrY= +github.com/go-openapi/runtime v0.29.5/go.mod h1:D9IUbWccdYv+km8QwmAm90FZvDcQk47vP2Y7y5as/D8= +github.com/go-openapi/spec v0.22.4 h1:4pxGjipMKu0FzFiu/DPwN3CTBRlVM2yLf/YTWorYfDQ= +github.com/go-openapi/spec v0.22.4/go.mod h1:WQ6Ai0VPWMZgMT4XySjlRIE6GP1bGQOtEThn3gcWLtQ= +github.com/go-openapi/strfmt v0.26.2 h1:ysjheCh4i1rmFEo2LanhELDNucNzfWTZhUDKgWWPaFM= +github.com/go-openapi/strfmt v0.26.2/go.mod h1:fXh1e449cyUn2NYuz+wb3wARBUdMl7qPEZwX00nqivY= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/validate v0.22.3 h1:KxG9mu5HBRYbecRb37KRCihvGGtND2aXziBAv0NNfyI= -github.com/go-openapi/validate v0.22.3/go.mod h1:kVxh31KbfsxU8ZyoHaDbLBWU5CnMdqBUEtadQ2G4d5M= +github.com/go-openapi/swag/conv v0.26.0 h1:5yGGsPYI1ZCva93U0AoKi/iZrNhaJEjr324YVsiD89I= +github.com/go-openapi/swag/conv v0.26.0/go.mod h1:tpAmIL7X58VPnHHiSO4uE3jBeRamGsFsfdDeDtb5ECE= +github.com/go-openapi/swag/fileutils v0.26.0 h1:WJoPRvsA7QRiiWluowkLJa9jaYR7FCuxmDvnCgaRRxU= +github.com/go-openapi/swag/fileutils v0.26.0/go.mod h1:0WDJ7lp67eNjPMO50wAWYlKvhOb6CQ37rzR7wrgI8Tc= +github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo= +github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU= +github.com/go-openapi/swag/jsonutils v0.26.0 h1:FawFML2iAXsPqmERscuMPIHmFsoP1tOqWkxBaKNMsnA= +github.com/go-openapi/swag/jsonutils v0.26.0/go.mod h1:2VmA0CJlyFqgawOaPI9psnjFDqzyivIqLYN34t9p91E= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0 h1:apqeINu/ICHouqiRZbyFvuDge5jCmmLTqGQ9V95EaOM= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0/go.mod h1:AyM6QT8uz5IdKxk5akv0y6u4QvcL9GWERt0Jx/F/R8Y= +github.com/go-openapi/swag/loading v0.25.5 h1:odQ/umlIZ1ZVRteI6ckSrvP6e2w9UTF5qgNdemJHjuU= +github.com/go-openapi/swag/loading v0.25.5/go.mod h1:I8A8RaaQ4DApxhPSWLNYWh9NvmX2YKMoB9nwvv6oW6g= +github.com/go-openapi/swag/mangling v0.25.5 h1:hyrnvbQRS7vKePQPHHDso+k6CGn5ZBs5232UqWZmJZw= +github.com/go-openapi/swag/mangling v0.25.5/go.mod h1:6hadXM/o312N/h98RwByLg088U61TPGiltQn71Iw0NY= +github.com/go-openapi/swag/stringutils v0.26.0 h1:qZQngLxs5s7SLijc3N2ZO+fUq2o8LjuWAASSrJuh+xg= +github.com/go-openapi/swag/stringutils v0.26.0/go.mod h1:sWn5uY+QIIspwPhvgnqJsH8xqFT2ZbYcvbcFanRyhFE= +github.com/go-openapi/swag/typeutils v0.26.0 h1:2kdEwdiNWy+JJdOvu5MA2IIg2SylWAFuuyQIKYybfq4= +github.com/go-openapi/swag/typeutils v0.26.0/go.mod h1:oovDuIUvTrEHVMqWilQzKzV4YlSKgyZmFh7AlfABNVE= +github.com/go-openapi/swag/yamlutils v0.25.5 h1:kASCIS+oIeoc55j28T4o8KwlV2S4ZLPT6G0iq2SSbVQ= +github.com/go-openapi/swag/yamlutils v0.25.5/go.mod h1:Gek1/SjjfbYvM+Iq4QGwa/2lEXde9n2j4a3wI3pNuOQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.5.0 h1:3hZD1fwydvCx/cc1R2uYNQirHqf2s6lqpKV3FcNTURA= +github.com/go-openapi/testify/enable/yaml/v2 v2.5.0/go.mod h1:TvDZKBH7ZbMaF3EqH2AwTvNQCmzyZq8K1agRjf1B+Nk= +github.com/go-openapi/testify/v2 v2.5.0 h1:UOCr63aAsMIDydZbZGqo5Ev01D4eydItRbekDuZMJLw= +github.com/go-openapi/testify/v2 v2.5.0/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-openapi/validate v0.25.2 h1:12NsfLAwGegqbGWr2CnvT65X/Q2USJipmJ9b7xDJZz0= +github.com/go-openapi/validate v0.25.2/go.mod h1:Pgl1LpPPGFnZ+ys4/hTlDiRYQdI1ocKypgE+8Q8BLfY= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gofiber/contrib/swagger v1.3.0 h1:J1InCTPUW/DzDlG+QwWcD5QZ4W9HlyCRHLZjKKVZd+g= github.com/gofiber/contrib/swagger v1.3.0/go.mod h1:zlZljpjIz1VhKR25+Inxl7WaOkgyM10nITUFXn6sV5A= -github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI= -github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= +github.com/gofiber/fiber/v2 v2.52.13 h1:TOKP64iqC9b5P49VrBW5tHhUOvDyrtJ0xePEfzJbCbk= +github.com/gofiber/fiber/v2 v2.52.13/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang-migrate/migrate/v4 v4.19.1 h1:OCyb44lFuQfYXYLx1SCxPZQGU7mcaZ7gH9yH4jSFbBA= github.com/golang-migrate/migrate/v4 v4.19.1/go.mod h1:CTcgfjxhaUtsLipnLoQRWCrjYXycRz/g5+RWDuYgPrE= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/uuid v1.1.1/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/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= @@ -136,30 +143,18 @@ github.com/jackc/pgx/v5 v5.9.1 h1:uwrxJXBnx76nyISkhr33kQLlUqjv7et7b9FjCen/tdc= github.com/jackc/pgx/v5 v5.9.1/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= -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/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 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-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -167,26 +162,21 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 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/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -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/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s= +github.com/oklog/ulid/v2 v2.1.1/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -206,116 +196,66 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= 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/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/stripe/stripe-go/v82 v82.5.1 h1:05q6ZDKoe8PLMpQV072obF74HCgP4XJeJYoNuRSX2+8= github.com/stripe/stripe-go/v82 v82.5.1/go.mod h1:majCQX6AfObAvJiHraPi/5udwHi4ojRvJnnxckvHrX8= github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI= github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= 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/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= 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/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= -go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= -golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= +golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k= -golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/internal/handlers/blog.go b/backend/internal/handlers/blog.go index 19517cb..5afa53c 100644 --- a/backend/internal/handlers/blog.go +++ b/backend/internal/handlers/blog.go @@ -429,6 +429,7 @@ func (h *BlogHandler) AdminUploadCover(c *fiber.Ctx) error { } return c.JSON(fiber.Map{"cover_image": url}) } + // AdminAIGenerate godoc // @Summary Generate blog post with AI (admin) // @Tags Admin diff --git a/go.work.sum b/go.work.sum index 7342b25..085afdf 100644 --- a/go.work.sum +++ b/go.work.sum @@ -138,8 +138,6 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-github/v39 v39.2.0 h1:rNNM311XtPOz5rDdsJXAp2o8F67X9FnROXTvto3aSnQ= github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= @@ -189,12 +187,8 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/ktrysmt/go-bitbucket v0.6.4 h1:C8dUGp0qkwncKtAnozHCbbqhptefzEd1I0sfnuy9rYQ= github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/markbates/pkger v0.15.1 h1:3MPelV53RnGSW07izx5xGxl4e/sdRD6zqseIk0rMASY= github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= @@ -223,6 +217,7 @@ github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8 h1:P48LjvUQpT github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba h1:fhFP5RliM2HW/8XdcO5QngSfFli9GcRIpMXvypTQt6E= github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU= @@ -237,8 +232,6 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgm github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 h1:V7x0hCAgL8lNGezuex1RW1sh7VXXCqfw8nXZti66iFg= github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= @@ -284,8 +277,6 @@ go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFw go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 h1:pVgRXcIictcr+lBQIFeiwuwtDIs4eL21OuM9nyAADmo= golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= @@ -315,8 +306,6 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c/go. google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= From 114a31a00c8085bf4632f573c36a3929f34f6e8b Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Sat, 9 May 2026 21:00:09 -0300 Subject: [PATCH 5/8] feat: update CI workflow and dependencies, enhance API documentation, and improve error handling - Updated sqlc dependency version in CI workflow to v1.31.1. - Improved health check logic in CI workflow to provide clearer failure messages. - Modified E2E test command to run from the frontend directory. - Adjusted paths for uploading Playwright reports in CI workflow. - Added Swagger UI endpoint conditionally based on environment. - Enhanced Swagger documentation with parameters and response schemas for various endpoints. - Updated entity definitions to include swaggertype annotations for JSON fields. - Implemented Delete method in CouponRepository and corresponding handler for coupon deletion. - Refactored AI generation logic in blog handler to align with OpenAI API changes. - Added validation for subtotal in coupon validation handler. - Updated user and product SQL queries to improve filtering and pagination. - Added new request structs for security and waitlist handlers. - Improved E2E tests for health endpoint and frontend loading. - Adjusted frontend package.json for Playwright configuration. - Created a new Playwright configuration file for better test management. - Updated Renovate configuration to automate minor and patch updates for devDependencies. --- .github/workflows/ci.yml | 10 +- Makefile | 2 +- backend/cmd/server/main.go | 16 ++- backend/docs/swagger/docs.go | 123 +++++++++++++----- backend/docs/swagger/swagger.json | 123 +++++++++++++----- backend/docs/swagger/swagger.yaml | 85 ++++++++---- backend/internal/domain/entity.go | 20 +-- backend/internal/domain/repository.go | 1 + backend/internal/handlers/blog.go | 77 ++++------- backend/internal/handlers/coupon.go | 16 ++- backend/internal/handlers/legal.go | 5 + backend/internal/handlers/security.go | 10 +- backend/internal/handlers/user.go | 1 + backend/internal/handlers/waitlist.go | 12 +- backend/internal/infrastructure/adapter.go | 5 + .../infrastructure/sqlc/blog_posts.sql.go | 14 +- .../infrastructure/sqlc/products.sql.go | 24 ++-- .../internal/infrastructure/sqlc/querier.go | 2 +- .../sqlc/queries/blog_posts.sql | 6 +- .../infrastructure/sqlc/queries/products.sql | 10 +- .../infrastructure/sqlc/queries/users.sql | 2 +- .../internal/infrastructure/sqlc/users.sql.go | 4 +- backend/internal/testutil/mocks.go | 12 ++ e2e/basic.spec.ts | 8 +- frontend/package.json | 2 +- {e2e => frontend}/playwright.config.ts | 2 +- renovate.json | 1 + 27 files changed, 384 insertions(+), 209 deletions(-) rename {e2e => frontend}/playwright.config.ts (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 415b859..0d7ba97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: cd backend go mod download go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2 - go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest + go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.31.1 sqlc diff || (echo "sqlc generated code is out of date. Run 'make sqlc' to regenerate." && exit 1) go vet ./... golangci-lint run ./... @@ -97,9 +97,13 @@ jobs: - name: Wait for health run: | for i in $(seq 1 30); do - curl -s http://localhost/healthz && break + if curl -fsS http://localhost/healthz; then + exit 0 + fi sleep 2 done + echo "health check failed: /healthz not ready" >&2 + exit 1 - name: Install Playwright run: | @@ -116,7 +120,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: playwright-report - path: e2e/playwright-report/ + path: frontend/playwright-report/ - name: Cleanup if: always() diff --git a/Makefile b/Makefile index 2236084..eb8425b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ fmt fmt-backend fmt-frontend \ typecheck tidy vet \ deadcode deadcode-backend deadcode-frontend \ - vulncheck swagger sqlc check ci clean help + vulncheck swagger sqlc e2e check ci clean help # === Local Development (tudo via Docker, 1 porta) === diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index 94a387d..e5818a7 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -120,13 +120,15 @@ func main() { return nil }) - // Swagger UI - app.Get("/swagger/*", swagger.New(swagger.Config{ - BasePath: "/", - FilePath: "swagger.json", - FileContent: []byte(swaggerdocs.SwaggerInfo.ReadDoc()), - Path: "/swagger", - })) + // Swagger UI (non-production only) + if cfg.Env != "production" { + app.Get("/swagger/*", swagger.New(swagger.Config{ + BasePath: "/", + FilePath: "swagger.json", + FileContent: []byte(swaggerdocs.SwaggerInfo.ReadDoc()), + Path: "/swagger", + })) + } // Health check app.Get("/healthz", func(c *fiber.Ctx) error { diff --git a/backend/docs/swagger/docs.go b/backend/docs/swagger/docs.go index 9d34604..a4f67b5 100644 --- a/backend/docs/swagger/docs.go +++ b/backend/docs/swagger/docs.go @@ -395,11 +395,31 @@ const docTemplate = `{ "BearerAuth": [] } ], + "produces": [ + "application/json" + ], "tags": [ "Admin" ], "summary": "Delete a coupon (admin)", - "responses": {} + "parameters": [ + { + "type": "string", + "description": "Coupon ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } } }, "/admin/email-groups": { @@ -774,7 +794,23 @@ const docTemplate = `{ "Admin" ], "summary": "Update a legal page (admin)", - "responses": {} + "parameters": [ + { + "type": "string", + "description": "Legal page ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.LegalPage" + } + } + } }, "delete": { "security": [ @@ -782,11 +818,31 @@ const docTemplate = `{ "BearerAuth": [] } ], + "produces": [ + "application/json" + ], "tags": [ "Admin" ], "summary": "Delete a legal page (admin)", - "responses": {} + "parameters": [ + { + "type": "string", + "description": "Legal page ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } } }, "/admin/linktree": { @@ -1074,12 +1130,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - } + "$ref": "#/definitions/internal_handlers.SecurityUpdateRequest" } } ], @@ -2083,7 +2134,15 @@ const docTemplate = `{ "User" ], "summary": "Update user profile", - "responses": {} + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } } }, "/user/saved-cards": { @@ -2179,15 +2238,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } + "$ref": "#/definitions/internal_handlers.WaitlistRequest" } } ], @@ -2233,10 +2284,7 @@ const docTemplate = `{ "type": "string" }, "metadata": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "published_at": { "type": "string" @@ -2328,10 +2376,7 @@ const docTemplate = `{ "type": "string" }, "shipping_address": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "status": { "type": "string" @@ -2366,10 +2411,7 @@ const docTemplate = `{ "type": "string" }, "images": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "is_active": { "type": "boolean" @@ -2414,6 +2456,25 @@ const docTemplate = `{ } } }, + "internal_handlers.SecurityUpdateRequest": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + }, + "internal_handlers.WaitlistRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "internal_handlers.createOrderItem": { "type": "object", "properties": { diff --git a/backend/docs/swagger/swagger.json b/backend/docs/swagger/swagger.json index 5ca2d0f..9c99f87 100644 --- a/backend/docs/swagger/swagger.json +++ b/backend/docs/swagger/swagger.json @@ -389,11 +389,31 @@ "BearerAuth": [] } ], + "produces": [ + "application/json" + ], "tags": [ "Admin" ], "summary": "Delete a coupon (admin)", - "responses": {} + "parameters": [ + { + "type": "string", + "description": "Coupon ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } } }, "/admin/email-groups": { @@ -768,7 +788,23 @@ "Admin" ], "summary": "Update a legal page (admin)", - "responses": {} + "parameters": [ + { + "type": "string", + "description": "Legal page ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_afa_blueprint_backend_internal_domain.LegalPage" + } + } + } }, "delete": { "security": [ @@ -776,11 +812,31 @@ "BearerAuth": [] } ], + "produces": [ + "application/json" + ], "tags": [ "Admin" ], "summary": "Delete a legal page (admin)", - "responses": {} + "parameters": [ + { + "type": "string", + "description": "Legal page ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } } }, "/admin/linktree": { @@ -1068,12 +1124,7 @@ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - } + "$ref": "#/definitions/internal_handlers.SecurityUpdateRequest" } } ], @@ -2077,7 +2128,15 @@ "User" ], "summary": "Update user profile", - "responses": {} + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } } }, "/user/saved-cards": { @@ -2173,15 +2232,7 @@ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } + "$ref": "#/definitions/internal_handlers.WaitlistRequest" } } ], @@ -2227,10 +2278,7 @@ "type": "string" }, "metadata": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "published_at": { "type": "string" @@ -2322,10 +2370,7 @@ "type": "string" }, "shipping_address": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "status": { "type": "string" @@ -2360,10 +2405,7 @@ "type": "string" }, "images": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "is_active": { "type": "boolean" @@ -2408,6 +2450,25 @@ } } }, + "internal_handlers.SecurityUpdateRequest": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + }, + "internal_handlers.WaitlistRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "internal_handlers.createOrderItem": { "type": "object", "properties": { diff --git a/backend/docs/swagger/swagger.yaml b/backend/docs/swagger/swagger.yaml index cf536ab..da5f18c 100644 --- a/backend/docs/swagger/swagger.yaml +++ b/backend/docs/swagger/swagger.yaml @@ -15,9 +15,7 @@ definitions: id: type: string metadata: - items: - type: integer - type: array + type: string published_at: type: string slug: @@ -77,9 +75,7 @@ definitions: receipt_url: type: string shipping_address: - items: - type: integer - type: array + type: string status: type: string total: @@ -102,9 +98,7 @@ definitions: id: type: string images: - items: - type: integer - type: array + type: string is_active: type: boolean is_pre_sale: @@ -133,6 +127,18 @@ definitions: source: type: string type: object + internal_handlers.SecurityUpdateRequest: + properties: + value: + type: string + type: object + internal_handlers.WaitlistRequest: + properties: + email: + type: string + name: + type: string + type: object internal_handlers.createOrderItem: properties: product_id: @@ -435,7 +441,20 @@ paths: - Admin /admin/coupons/{id}: delete: - responses: {} + parameters: + - description: Coupon ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object security: - BearerAuth: [] summary: Delete a coupon (admin) @@ -655,7 +674,20 @@ paths: - Admin /admin/legal/{id}: delete: - responses: {} + parameters: + - description: Legal page ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object security: - BearerAuth: [] summary: Delete a legal page (admin) @@ -664,9 +696,19 @@ paths: put: consumes: - application/json + parameters: + - description: Legal page ID + in: path + name: id + required: true + type: string produces: - application/json - responses: {} + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_afa_blueprint_backend_internal_domain.LegalPage' security: - BearerAuth: [] summary: Update a legal page (admin) @@ -838,10 +880,7 @@ paths: name: body required: true schema: - properties: - value: - type: string - type: object + $ref: '#/definitions/internal_handlers.SecurityUpdateRequest' produces: - application/json responses: @@ -1478,7 +1517,12 @@ paths: - application/json produces: - application/json - responses: {} + responses: + "200": + description: OK + schema: + additionalProperties: true + type: object security: - BearerAuth: [] summary: Update user profile @@ -1538,12 +1582,7 @@ paths: name: body required: true schema: - properties: - email: - type: string - name: - type: string - type: object + $ref: '#/definitions/internal_handlers.WaitlistRequest' produces: - application/json responses: diff --git a/backend/internal/domain/entity.go b/backend/internal/domain/entity.go index f90d83e..10191fc 100644 --- a/backend/internal/domain/entity.go +++ b/backend/internal/domain/entity.go @@ -8,7 +8,7 @@ import ( type User struct { ID string `json:"id"` Email string `json:"email"` - PasswordHash string `json:"password_hash"` + PasswordHash string `json:"-"` Name *string `json:"name"` Role string `json:"role"` EmailVerified bool `json:"email_verified"` @@ -31,8 +31,8 @@ type UserProfile struct { UserID string `json:"user_id"` Phone *string `json:"phone"` AvatarURL *string `json:"avatar_url"` - Address json.RawMessage `json:"address"` - Metadata json.RawMessage `json:"metadata"` + Address json.RawMessage `json:"address" swaggertype:"string"` + Metadata json.RawMessage `json:"metadata" swaggertype:"string"` } type FeatureFlag struct { @@ -53,7 +53,7 @@ type BlogPost struct { AuthorID *string `json:"author_id"` CreatedAt time.Time `json:"created_at"` PublishedAt *time.Time `json:"published_at"` - Metadata json.RawMessage `json:"metadata"` + Metadata json.RawMessage `json:"metadata" swaggertype:"string"` } type Category struct { @@ -71,7 +71,7 @@ type Product struct { Stock int `json:"stock"` IsPreSale bool `json:"is_pre_sale"` PreSaleAvailableAt *time.Time `json:"pre_sale_available_at"` - Images json.RawMessage `json:"images"` + Images json.RawMessage `json:"images" swaggertype:"string"` CategoryID *string `json:"category_id"` IsActive bool `json:"is_active"` CreatedAt time.Time `json:"created_at"` @@ -85,7 +85,7 @@ type Order struct { Total float64 `json:"total"` PaymentMethod *string `json:"payment_method"` PaymentID *string `json:"payment_id"` - ShippingAddress json.RawMessage `json:"shipping_address"` + ShippingAddress json.RawMessage `json:"shipping_address" swaggertype:"string"` TrackingCode *string `json:"tracking_code"` ReceiptURL *string `json:"receipt_url"` CreatedAt time.Time `json:"created_at"` @@ -195,7 +195,7 @@ type HealthCheck struct { ServiceName string `json:"service_name"` Status string `json:"status"` LatencyMs *int `json:"latency_ms"` - Details json.RawMessage `json:"details"` + Details json.RawMessage `json:"details" swaggertype:"string"` CheckedAt time.Time `json:"checked_at"` } @@ -228,7 +228,7 @@ type JobExecution struct { FinishedAt *time.Time `json:"finished_at"` DurationMs *int `json:"duration_ms"` Error *string `json:"error"` - Output json.RawMessage `json:"output"` + Output json.RawMessage `json:"output" swaggertype:"string"` } // AdminTool represents a link to an external admin tool @@ -251,7 +251,7 @@ type AuditLog struct { Action string `json:"action"` Resource *string `json:"resource"` ResourceID *string `json:"resource_id"` - Details json.RawMessage `json:"details"` + Details json.RawMessage `json:"details" swaggertype:"string"` IPAddress *string `json:"ip_address"` CreatedAt time.Time `json:"created_at"` } @@ -262,7 +262,7 @@ type AppLog struct { Level string `json:"level"` Message string `json:"message"` Source *string `json:"source"` - Metadata json.RawMessage `json:"metadata"` + Metadata json.RawMessage `json:"metadata" swaggertype:"string"` CreatedAt time.Time `json:"created_at"` } diff --git a/backend/internal/domain/repository.go b/backend/internal/domain/repository.go index fe501d4..ebb53b5 100644 --- a/backend/internal/domain/repository.go +++ b/backend/internal/domain/repository.go @@ -66,6 +66,7 @@ type CouponRepository interface { Create(ctx context.Context, c *Coupon) error IncrementUsed(ctx context.Context, id string) error List(ctx context.Context) ([]Coupon, error) + Delete(ctx context.Context, id string) error } type BlogRepository interface { diff --git a/backend/internal/handlers/blog.go b/backend/internal/handlers/blog.go index 5afa53c..fa5c3cc 100644 --- a/backend/internal/handlers/blog.go +++ b/backend/internal/handlers/blog.go @@ -453,50 +453,29 @@ func (h *BlogHandler) AdminAIGenerate(c *fiber.Ctx) error { } payload := map[string]interface{}{ - "model": "gpt-5.4-mini", - "reasoning": map[string]interface{}{ - "effort": "low", - }, - "input": []map[string]interface{}{ + "model": "gpt-4o-mini", + "messages": []map[string]string{ { - "role": "developer", - "content": []map[string]string{ - { - "type": "input_text", - "text": "You write polished blog drafts for a SaaS product. Return valid JSON only.", - }, - }, + "role": "system", + "content": "You write polished blog drafts for a SaaS product. Return valid JSON only.", }, { - "role": "user", - "content": []map[string]string{ - { - "type": "input_text", - "text": "Write a blog draft based on this prompt:\n\n" + body.Prompt + "\n\nReturn JSON with title, slug, excerpt, and content. The content should be HTML with headings and paragraphs.", - }, - }, + "role": "user", + "content": "Write a blog draft based on this prompt:\n\n" + body.Prompt + "\n\nReturn JSON with title, slug, excerpt, and content. The content should be HTML with headings and paragraphs.", }, }, - "text": map[string]interface{}{ - "format": map[string]interface{}{ - "type": "json_schema", + "response_format": map[string]interface{}{ + "type": "json_schema", + "json_schema": map[string]interface{}{ "name": "blog_post_draft", "strict": true, "schema": map[string]interface{}{ "type": "object", "properties": map[string]interface{}{ - "title": map[string]string{ - "type": "string", - }, - "slug": map[string]string{ - "type": "string", - }, - "excerpt": map[string]string{ - "type": "string", - }, - "content": map[string]string{ - "type": "string", - }, + "title": map[string]string{"type": "string"}, + "slug": map[string]string{"type": "string"}, + "excerpt": map[string]string{"type": "string"}, + "content": map[string]string{"type": "string"}, }, "required": []string{"title", "slug", "excerpt", "content"}, "additionalProperties": false, @@ -510,7 +489,7 @@ func (h *BlogHandler) AdminAIGenerate(c *fiber.Ctx) error { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) } - req, err := http.NewRequestWithContext(c.Context(), http.MethodPost, "https://api.openai.com/v1/responses", bytes.NewReader(bodyBytes)) + req, err := http.NewRequestWithContext(c.Context(), http.MethodPost, "https://api.openai.com/v1/chat/completions", bytes.NewReader(bodyBytes)) if err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) } @@ -534,31 +513,19 @@ func (h *BlogHandler) AdminAIGenerate(c *fiber.Ctx) error { } var response struct { - OutputText string `json:"output_text"` - Output []struct { - Content []struct { - Type string `json:"type"` - Text string `json:"text"` - } `json:"content"` - } `json:"output"` + Choices []struct { + Message struct { + Content string `json:"content"` + } `json:"message"` + } `json:"choices"` } if err := json.Unmarshal(raw, &response); err != nil { return fiber.NewError(fiber.StatusBadGateway, "invalid OpenAI response") } - text := strings.TrimSpace(response.OutputText) - if text == "" { - for _, item := range response.Output { - for _, content := range item.Content { - if content.Type == "output_text" && strings.TrimSpace(content.Text) != "" { - text = strings.TrimSpace(content.Text) - break - } - } - if text != "" { - break - } - } + var text string + if len(response.Choices) > 0 { + text = strings.TrimSpace(response.Choices[0].Message.Content) } if text == "" { return fiber.NewError(fiber.StatusBadGateway, "empty OpenAI response") diff --git a/backend/internal/handlers/coupon.go b/backend/internal/handlers/coupon.go index 01e32cf..432b19c 100644 --- a/backend/internal/handlers/coupon.go +++ b/backend/internal/handlers/coupon.go @@ -34,6 +34,9 @@ func (h *CouponHandler) ValidateCoupon(c *fiber.Ctx) error { if req.Code == "" { return fiber.NewError(fiber.StatusBadRequest, "code required") } + if req.Subtotal < 0 { + return fiber.NewError(fiber.StatusBadRequest, "subtotal must be non-negative") + } coupon, err := h.coupons.FindByCode(c.Context(), req.Code) if err != nil { @@ -100,9 +103,18 @@ func (h *CouponHandler) AdminCreateCoupon(c *fiber.Ctx) error { // AdminDeleteCoupon godoc // @Summary Delete a coupon (admin) // @Tags Admin +// @Produce json +// @Param id path string true "Coupon ID" +// @Success 200 {object} map[string]interface{} // @Security BearerAuth // @Router /admin/coupons/{id} [delete] func (h *CouponHandler) AdminDeleteCoupon(c *fiber.Ctx) error { - // CouponRepository has no Delete method; return method not allowed. - return fiber.NewError(fiber.StatusMethodNotAllowed, "coupon deletion not supported") + id := c.Params("id") + if id == "" { + return fiber.NewError(fiber.StatusBadRequest, "id is required") + } + if err := h.coupons.Delete(c.Context(), id); err != nil { + return fiber.NewError(fiber.StatusInternalServerError, err.Error()) + } + return c.JSON(fiber.Map{"deleted": true}) } diff --git a/backend/internal/handlers/legal.go b/backend/internal/handlers/legal.go index a0c0538..d07b0e8 100644 --- a/backend/internal/handlers/legal.go +++ b/backend/internal/handlers/legal.go @@ -95,6 +95,8 @@ func (h *LegalHandler) AdminCreate(c *fiber.Ctx) error { // @Tags Admin // @Accept json // @Produce json +// @Param id path string true "Legal page ID" +// @Success 200 {object} domain.LegalPage // @Security BearerAuth // @Router /admin/legal/{id} [put] func (h *LegalHandler) AdminUpdate(c *fiber.Ctx) error { @@ -113,6 +115,9 @@ func (h *LegalHandler) AdminUpdate(c *fiber.Ctx) error { // AdminDelete godoc // @Summary Delete a legal page (admin) // @Tags Admin +// @Produce json +// @Param id path string true "Legal page ID" +// @Success 200 {object} map[string]interface{} // @Security BearerAuth // @Router /admin/legal/{id} [delete] func (h *LegalHandler) AdminDelete(c *fiber.Ctx) error { diff --git a/backend/internal/handlers/security.go b/backend/internal/handlers/security.go index 5b293fe..f660579 100644 --- a/backend/internal/handlers/security.go +++ b/backend/internal/handlers/security.go @@ -28,21 +28,23 @@ func (h *SecurityHandler) ListSettings(c *fiber.Ctx) error { return c.JSON(fiber.Map{"data": settings}) } +type SecurityUpdateRequest struct { + Value string `json:"value"` +} + // UpdateSetting godoc // @Summary Update a security setting (admin) // @Tags Admin // @Accept json // @Produce json // @Param key path string true "Setting key" -// @Param body body object{value=string} true "New value" +// @Param body body SecurityUpdateRequest true "New value" // @Success 200 {object} map[string]interface{} // @Security BearerAuth // @Router /admin/security/{key} [put] func (h *SecurityHandler) UpdateSetting(c *fiber.Ctx) error { key := c.Params("key") - var req struct { - Value string `json:"value"` - } + var req SecurityUpdateRequest if err := c.BodyParser(&req); err != nil { return c.Status(400).JSON(fiber.Map{"error": "invalid request"}) } diff --git a/backend/internal/handlers/user.go b/backend/internal/handlers/user.go index 211454d..f2508af 100644 --- a/backend/internal/handlers/user.go +++ b/backend/internal/handlers/user.go @@ -75,6 +75,7 @@ func (h *UserHandler) GetProfile(c *fiber.Ctx) error { // @Tags User // @Accept json // @Produce json +// @Success 200 {object} map[string]interface{} // @Security BearerAuth // @Router /user/profile [put] func (h *UserHandler) UpdateProfile(c *fiber.Ctx) error { diff --git a/backend/internal/handlers/waitlist.go b/backend/internal/handlers/waitlist.go index 8ca3f25..457cabc 100644 --- a/backend/internal/handlers/waitlist.go +++ b/backend/internal/handlers/waitlist.go @@ -13,20 +13,22 @@ func NewWaitlistHandler(waitlist domain.WaitlistRepository) *WaitlistHandler { return &WaitlistHandler{waitlist: waitlist} } +type WaitlistRequest struct { + Email string `json:"email"` + Name string `json:"name,omitempty"` +} + // AddToWaitlist godoc // @Summary Join the waitlist // @Tags Waitlist // @Accept json // @Produce json -// @Param body body object{email=string,name=string} true "Email and optional name" +// @Param body body WaitlistRequest true "Email and optional name" // @Success 201 {object} map[string]interface{} // @Failure 409 {object} map[string]interface{} // @Router /waitlist [post] func (h *WaitlistHandler) AddToWaitlist(c *fiber.Ctx) error { - var req struct { - Email string `json:"email"` - Name string `json:"name"` - } + var req WaitlistRequest if err := c.BodyParser(&req); err != nil || req.Email == "" { return c.Status(400).JSON(fiber.Map{"error": "email is required"}) } diff --git a/backend/internal/infrastructure/adapter.go b/backend/internal/infrastructure/adapter.go index 62f0387..b1b79f2 100644 --- a/backend/internal/infrastructure/adapter.go +++ b/backend/internal/infrastructure/adapter.go @@ -457,6 +457,11 @@ func (r *couponRepo) IncrementUsed(ctx context.Context, id string) error { return err } +func (r *couponRepo) Delete(ctx context.Context, id string) error { + _, err := r.pool.Exec(ctx, `DELETE FROM coupons WHERE id=$1`, id) + return err +} + func (r *couponRepo) List(ctx context.Context) ([]domain.Coupon, error) { rows, err := r.pool.Query(ctx, `SELECT id,code,discount_type,discount_value,min_purchase,valid_from,valid_until,max_uses,used_count,is_active FROM coupons ORDER BY code`) diff --git a/backend/internal/infrastructure/sqlc/blog_posts.sql.go b/backend/internal/infrastructure/sqlc/blog_posts.sql.go index 38c2657..3fed6a7 100644 --- a/backend/internal/infrastructure/sqlc/blog_posts.sql.go +++ b/backend/internal/infrastructure/sqlc/blog_posts.sql.go @@ -15,8 +15,8 @@ const countBlogPosts = `-- name: CountBlogPosts :one SELECT COUNT(*) FROM blog_posts WHERE ($1::text = '' OR status = $1::text) ` -func (q *Queries) CountBlogPosts(ctx context.Context, dollar_1 string) (int64, error) { - row := q.db.QueryRow(ctx, countBlogPosts, dollar_1) +func (q *Queries) CountBlogPosts(ctx context.Context, statusFilter string) (int64, error) { + row := q.db.QueryRow(ctx, countBlogPosts, statusFilter) var count int64 err := row.Scan(&count) return count, err @@ -123,17 +123,17 @@ const listBlogPosts = `-- name: ListBlogPosts :many SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata FROM blog_posts WHERE ($1::text = '' OR status = $1::text) -ORDER BY created_at DESC LIMIT $2 OFFSET $3 +ORDER BY created_at DESC LIMIT $3 OFFSET $2 ` type ListBlogPostsParams struct { - Column1 string `json:"column_1"` - Limit int32 `json:"limit"` - Offset int32 `json:"offset"` + StatusFilter string `json:"status_filter"` + RowOffset int32 `json:"row_offset"` + RowLimit int32 `json:"row_limit"` } func (q *Queries) ListBlogPosts(ctx context.Context, arg ListBlogPostsParams) ([]BlogPost, error) { - rows, err := q.db.Query(ctx, listBlogPosts, arg.Column1, arg.Limit, arg.Offset) + rows, err := q.db.Query(ctx, listBlogPosts, arg.StatusFilter, arg.RowOffset, arg.RowLimit) if err != nil { return nil, err } diff --git a/backend/internal/infrastructure/sqlc/products.sql.go b/backend/internal/infrastructure/sqlc/products.sql.go index 7c34992..a95f737 100644 --- a/backend/internal/infrastructure/sqlc/products.sql.go +++ b/backend/internal/infrastructure/sqlc/products.sql.go @@ -18,12 +18,12 @@ WHERE ($1::uuid IS NULL OR category_id = $1) ` type CountProductsParams struct { - Column1 pgtype.UUID `json:"column_1"` - Column2 bool `json:"column_2"` + CategoryID pgtype.UUID `json:"category_id"` + ActiveOnly bool `json:"active_only"` } func (q *Queries) CountProducts(ctx context.Context, arg CountProductsParams) (int64, error) { - row := q.db.QueryRow(ctx, countProducts, arg.Column1, arg.Column2) + row := q.db.QueryRow(ctx, countProducts, arg.CategoryID, arg.ActiveOnly) var count int64 err := row.Scan(&count) return count, err @@ -109,22 +109,22 @@ SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, FROM products WHERE ($1::uuid IS NULL OR category_id = $1) AND ($2::boolean = false OR is_active = true) -ORDER BY created_at DESC LIMIT $3 OFFSET $4 +ORDER BY created_at DESC LIMIT $4 OFFSET $3 ` type ListProductsParams struct { - Column1 pgtype.UUID `json:"column_1"` - Column2 bool `json:"column_2"` - Limit int32 `json:"limit"` - Offset int32 `json:"offset"` + CategoryID pgtype.UUID `json:"category_id"` + ActiveOnly bool `json:"active_only"` + RowOffset int32 `json:"row_offset"` + RowLimit int32 `json:"row_limit"` } func (q *Queries) ListProducts(ctx context.Context, arg ListProductsParams) ([]Product, error) { rows, err := q.db.Query(ctx, listProducts, - arg.Column1, - arg.Column2, - arg.Limit, - arg.Offset, + arg.CategoryID, + arg.ActiveOnly, + arg.RowOffset, + arg.RowLimit, ) if err != nil { return nil, err diff --git a/backend/internal/infrastructure/sqlc/querier.go b/backend/internal/infrastructure/sqlc/querier.go index df91123..213c9b3 100644 --- a/backend/internal/infrastructure/sqlc/querier.go +++ b/backend/internal/infrastructure/sqlc/querier.go @@ -11,7 +11,7 @@ import ( ) type Querier interface { - CountBlogPosts(ctx context.Context, dollar_1 string) (int64, error) + CountBlogPosts(ctx context.Context, statusFilter string) (int64, error) CountProducts(ctx context.Context, arg CountProductsParams) (int64, error) CountUsers(ctx context.Context) (int64, error) CreateBlogPost(ctx context.Context, arg CreateBlogPostParams) (CreateBlogPostRow, error) diff --git a/backend/internal/infrastructure/sqlc/queries/blog_posts.sql b/backend/internal/infrastructure/sqlc/queries/blog_posts.sql index d17ae37..e801d10 100644 --- a/backend/internal/infrastructure/sqlc/queries/blog_posts.sql +++ b/backend/internal/infrastructure/sqlc/queries/blog_posts.sql @@ -9,11 +9,11 @@ FROM blog_posts WHERE slug = $1; -- name: ListBlogPosts :many SELECT id, title, slug, content, excerpt, cover_image, status, author_id, created_at, published_at, metadata FROM blog_posts -WHERE ($1::text = '' OR status = $1::text) -ORDER BY created_at DESC LIMIT $2 OFFSET $3; +WHERE (sqlc.arg(status_filter)::text = '' OR status = sqlc.arg(status_filter)::text) +ORDER BY created_at DESC LIMIT sqlc.arg(row_limit) OFFSET sqlc.arg(row_offset); -- name: CountBlogPosts :one -SELECT COUNT(*) FROM blog_posts WHERE ($1::text = '' OR status = $1::text); +SELECT COUNT(*) FROM blog_posts WHERE (sqlc.arg(status_filter)::text = '' OR status = sqlc.arg(status_filter)::text); -- name: CreateBlogPost :one INSERT INTO blog_posts (title, slug, content, excerpt, cover_image, status, author_id, published_at, metadata) diff --git a/backend/internal/infrastructure/sqlc/queries/products.sql b/backend/internal/infrastructure/sqlc/queries/products.sql index fef0c40..8ae0649 100644 --- a/backend/internal/infrastructure/sqlc/queries/products.sql +++ b/backend/internal/infrastructure/sqlc/queries/products.sql @@ -5,14 +5,14 @@ FROM products WHERE id = $1; -- name: ListProducts :many SELECT id, name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active, created_at, updated_at FROM products -WHERE ($1::uuid IS NULL OR category_id = $1) - AND ($2::boolean = false OR is_active = true) -ORDER BY created_at DESC LIMIT $3 OFFSET $4; +WHERE (sqlc.narg(category_id)::uuid IS NULL OR category_id = sqlc.narg(category_id)) + AND (sqlc.arg(active_only)::boolean = false OR is_active = true) +ORDER BY created_at DESC LIMIT sqlc.arg(row_limit) OFFSET sqlc.arg(row_offset); -- name: CountProducts :one SELECT COUNT(*) FROM products -WHERE ($1::uuid IS NULL OR category_id = $1) - AND ($2::boolean = false OR is_active = true); +WHERE (sqlc.narg(category_id)::uuid IS NULL OR category_id = sqlc.narg(category_id)) + AND (sqlc.arg(active_only)::boolean = false OR is_active = true); -- name: CreateProduct :one INSERT INTO products (name, description, price, stock, is_pre_sale, pre_sale_available_at, images, category_id, is_active) diff --git a/backend/internal/infrastructure/sqlc/queries/users.sql b/backend/internal/infrastructure/sqlc/queries/users.sql index c8ac9f0..94a7e1a 100644 --- a/backend/internal/infrastructure/sqlc/queries/users.sql +++ b/backend/internal/infrastructure/sqlc/queries/users.sql @@ -19,7 +19,7 @@ WHERE id = $5; DELETE FROM users WHERE id = $1; -- name: ListUsers :many -SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +SELECT id, email, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2; -- name: CountUsers :one diff --git a/backend/internal/infrastructure/sqlc/users.sql.go b/backend/internal/infrastructure/sqlc/users.sql.go index c7e0fe7..ea5af6d 100644 --- a/backend/internal/infrastructure/sqlc/users.sql.go +++ b/backend/internal/infrastructure/sqlc/users.sql.go @@ -143,7 +143,7 @@ func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDR } const listUsers = `-- name: ListUsers :many -SELECT id, email, password_hash, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at +SELECT id, email, name, role, email_verified, email_verified_at, stripe_customer_id, created_at, updated_at FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2 ` @@ -155,7 +155,6 @@ type ListUsersParams struct { type ListUsersRow struct { ID pgtype.UUID `json:"id"` Email string `json:"email"` - PasswordHash string `json:"password_hash"` Name pgtype.Text `json:"name"` Role pgtype.Text `json:"role"` EmailVerified pgtype.Bool `json:"email_verified"` @@ -177,7 +176,6 @@ func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUse if err := rows.Scan( &i.ID, &i.Email, - &i.PasswordHash, &i.Name, &i.Role, &i.EmailVerified, diff --git a/backend/internal/testutil/mocks.go b/backend/internal/testutil/mocks.go index c3aefac..6cb47ef 100644 --- a/backend/internal/testutil/mocks.go +++ b/backend/internal/testutil/mocks.go @@ -465,6 +465,18 @@ func (m *MockCouponRepo) List(_ context.Context) ([]domain.Coupon, error) { return result, nil } +func (m *MockCouponRepo) Delete(_ context.Context, id string) error { + m.mu.Lock() + defer m.mu.Unlock() + for code, c := range m.coupons { + if c.ID == id { + delete(m.coupons, code) + return nil + } + } + return errors.New("not found") +} + // ---- MockBlogRepo ---- type MockBlogRepo struct { diff --git a/e2e/basic.spec.ts b/e2e/basic.spec.ts index bec90ac..67c30b9 100644 --- a/e2e/basic.spec.ts +++ b/e2e/basic.spec.ts @@ -2,10 +2,12 @@ import { test, expect } from '@playwright/test' test('health endpoint returns 200', async ({ request }) => { const res = await request.get('/healthz') - expect(res.ok()).toBeTruthy() + expect(res.status()).toBe(200) }) test('frontend loads', async ({ page }) => { - await page.goto('/') - await expect(page.locator('body')).toBeVisible() + const response = await page.goto('/') + expect(response).not.toBeNull() + expect(response!.status()).toBeLessThan(400) + await expect(page.locator('#app')).toBeVisible() }) diff --git a/frontend/package.json b/frontend/package.json index a6f4f92..5e3114b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,7 @@ "preview": "vite preview", "test": "vitest run", "test:watch": "vitest", - "e2e": "playwright test --config ../e2e/playwright.config.ts" + "e2e": "playwright test --config playwright.config.ts" }, "dependencies": { "@fortawesome/fontawesome-free": "^7.2.0", diff --git a/e2e/playwright.config.ts b/frontend/playwright.config.ts similarity index 95% rename from e2e/playwright.config.ts rename to frontend/playwright.config.ts index 26e1ebf..e0249c2 100644 --- a/e2e/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -1,7 +1,7 @@ import { defineConfig, devices } from '@playwright/test' export default defineConfig({ - testDir: '.', + testDir: '../e2e', timeout: 30000, retries: 1, use: { diff --git a/renovate.json b/renovate.json index ba5c65c..c1f62e5 100644 --- a/renovate.json +++ b/renovate.json @@ -9,6 +9,7 @@ }, { "matchDepTypes": ["devDependencies"], + "matchUpdateTypes": ["minor", "patch"], "automerge": true } ], From 7e91dd38af024f4fa0a329b578d0d14ad29bd719 Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Sat, 9 May 2026 21:03:51 -0300 Subject: [PATCH 6/8] feat: add new dependencies for govalidator, swag, intern, easyjson, and updated mongo-driver --- go.work.sum | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/go.work.sum b/go.work.sum index 085afdf..28ce736 100644 --- a/go.work.sum +++ b/go.work.sum @@ -56,6 +56,8 @@ github.com/apache/arrow/go/v10 v10.0.1 h1:n9dERvixoC/1JjDmBcs9FPaEryoANa2sCgVFo6 github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go v1.49.6 h1:yNldzF5kzLBRvKlKz1S0bkvc2+04R1kt13KfBWQBfFA= github.com/aws/aws-sdk-go v1.49.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk= @@ -112,6 +114,7 @@ github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkF github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M= github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE= github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= @@ -172,6 +175,8 @@ github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU= github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +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/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -189,6 +194,8 @@ github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/ktrysmt/go-bitbucket v0.6.4 h1:C8dUGp0qkwncKtAnozHCbbqhptefzEd1I0sfnuy9rYQ= github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/pkger v0.15.1 h1:3MPelV53RnGSW07izx5xGxl4e/sdRD6zqseIk0rMASY= github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= @@ -201,6 +208,8 @@ github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8D github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +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/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -218,6 +227,7 @@ github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86w github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba h1:fhFP5RliM2HW/8XdcO5QngSfFli9GcRIpMXvypTQt6E= github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU= @@ -263,6 +273,8 @@ gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b h1:7gd+rd8P3bqcn/9 gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/detectors/gcp v1.36.0 h1:F7q2tNlCaHY9nMKHR6XH9/qkp8FktLnIcy6jJNyOCQw= From 60f0c2d4827a71779d526c9ad84244e8b2760bd8 Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Sat, 9 May 2026 21:20:16 -0300 Subject: [PATCH 7/8] fix: resolve e2e CI failures (playwright resolution + healthz 502) - move e2e/basic.spec.ts into frontend/e2e/ so @playwright/test resolves - update frontend/playwright.config.ts testDir to ./e2e and bump webServer timeout - simplify e2e CI job: let playwright manage docker compose via webServer - add backend healthcheck and make nginx depends_on backend service_healthy - add nginx healthcheck for compose --wait readiness --- .github/workflows/ci.yml | 29 +++++++++-------------------- docker-compose.yml | 27 ++++++++++++++++++++++----- {e2e => frontend/e2e}/basic.spec.ts | 0 frontend/playwright.config.ts | 4 ++-- 4 files changed, 33 insertions(+), 27 deletions(-) rename {e2e => frontend/e2e}/basic.spec.ts (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d7ba97..3685c70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,30 +90,15 @@ jobs: bun-version: ${{ env.BUN_VERSION }} cache: true - - name: Start services - run: docker compose up -d - timeout-minutes: 3 - - - name: Wait for health - run: | - for i in $(seq 1 30); do - if curl -fsS http://localhost/healthz; then - exit 0 - fi - sleep 2 - done - echo "health check failed: /healthz not ready" >&2 - exit 1 - - - name: Install Playwright + - name: Install dependencies + working-directory: frontend run: | - sudo chown -R "$USER:$USER" frontend/node_modules || true - cd frontend bun install --frozen-lockfile - bunx --bun playwright install chromium + bunx --bun playwright install --with-deps chromium - name: Run E2E tests - run: cd frontend && bun run e2e + working-directory: frontend + run: bunx --bun playwright test --config playwright.config.ts - name: Upload report if: failure() @@ -122,6 +107,10 @@ jobs: name: playwright-report path: frontend/playwright-report/ + - name: Dump container logs + if: failure() + run: docker compose logs --no-color --tail=200 + - name: Cleanup if: always() run: docker compose down -v diff --git a/docker-compose.yml b/docker-compose.yml index 9caa50a..671e30f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,12 +5,23 @@ services: - "80:80" volumes: - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro + healthcheck: + test: ["CMD", "wget", "-qO-", "http://localhost/healthz"] + interval: 5s + timeout: 3s + retries: 30 + start_period: 60s depends_on: - - frontend - - backend - - pgweb - - grafana - - prometheus + backend: + condition: service_healthy + frontend: + condition: service_started + pgweb: + condition: service_started + grafana: + condition: service_started + prometheus: + condition: service_started postgres: image: postgres:16-alpine @@ -59,6 +70,12 @@ services: condition: service_healthy redis: condition: service_healthy + healthcheck: + test: ["CMD", "wget", "-qO-", "http://localhost:8080/healthz"] + interval: 5s + timeout: 3s + retries: 30 + start_period: 60s frontend: build: diff --git a/e2e/basic.spec.ts b/frontend/e2e/basic.spec.ts similarity index 100% rename from e2e/basic.spec.ts rename to frontend/e2e/basic.spec.ts diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index e0249c2..25c2ac2 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -1,7 +1,7 @@ import { defineConfig, devices } from '@playwright/test' export default defineConfig({ - testDir: '../e2e', + testDir: './e2e', timeout: 30000, retries: 1, use: { @@ -15,7 +15,7 @@ export default defineConfig({ command: 'docker compose up -d --wait', url: 'http://localhost/healthz', reuseExistingServer: true, - timeout: 60000, + timeout: 180000, cwd: '..', }, }) From e462cbb3f45858f372a2003a9288c59b04b644c8 Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Sat, 9 May 2026 21:54:27 -0300 Subject: [PATCH 8/8] fix: e2e CI passes locally end-to-end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - vitest: exclude e2e/** so playwright specs are not picked up - backend healthcheck: use 127.0.0.1 (localhost resolved to ::1 inside the container, but Fiber listens on IPv4 only — caused 180s healthcheck timeout) - nginx healthcheck: same IPv4 fix - nginx depends_on: drop pgweb/grafana/prometheus from the readiness path (they are not needed for /healthz and slowed down --wait) - playwright: bump webServer timeout to 300s for CI cold starts - e2e/basic.spec.ts: use #app.first() — the page renders two #app elements (mount target + App.vue template root), so a bare locator is ambiguous Verified locally: docker compose up -d --wait → all healthy in ~33s, playwright run → 2/2 passing. --- docker-compose.yml | 10 ++-------- frontend/e2e/basic.spec.ts | 2 +- frontend/playwright.config.ts | 2 +- frontend/vite.config.ts | 1 + 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 671e30f..f57cba5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: volumes: - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro healthcheck: - test: ["CMD", "wget", "-qO-", "http://localhost/healthz"] + test: ["CMD", "wget", "-qO-", "http://127.0.0.1/healthz"] interval: 5s timeout: 3s retries: 30 @@ -16,12 +16,6 @@ services: condition: service_healthy frontend: condition: service_started - pgweb: - condition: service_started - grafana: - condition: service_started - prometheus: - condition: service_started postgres: image: postgres:16-alpine @@ -71,7 +65,7 @@ services: redis: condition: service_healthy healthcheck: - test: ["CMD", "wget", "-qO-", "http://localhost:8080/healthz"] + test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/healthz"] interval: 5s timeout: 3s retries: 30 diff --git a/frontend/e2e/basic.spec.ts b/frontend/e2e/basic.spec.ts index 67c30b9..3fb229c 100644 --- a/frontend/e2e/basic.spec.ts +++ b/frontend/e2e/basic.spec.ts @@ -9,5 +9,5 @@ test('frontend loads', async ({ page }) => { const response = await page.goto('/') expect(response).not.toBeNull() expect(response!.status()).toBeLessThan(400) - await expect(page.locator('#app')).toBeVisible() + await expect(page.locator('#app').first()).toBeVisible() }) diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 25c2ac2..15e926e 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -15,7 +15,7 @@ export default defineConfig({ command: 'docker compose up -d --wait', url: 'http://localhost/healthz', reuseExistingServer: true, - timeout: 180000, + timeout: 300000, cwd: '..', }, }) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 845dd5e..568e42f 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -11,6 +11,7 @@ export default defineConfig({ test: { environment: 'happy-dom', globals: true, + exclude: ['e2e/**', 'node_modules/**', 'dist/**'], }, plugins: [ vue(),