bilhej/frontend/vite.config.ts
Hermes Agent 08fcbba580
Some checks failed
CI / Lint, type check, unit tests, coverage (pull_request) Failing after 1m45s
CI / E2E browser tests (pull_request) Successful in 3m59s
feat(guest): guest checkout without login (Swish + QR)
Adds an anonymous guest checkout flow so a customer can order a bilhälsning
without creating an account. Payment via Swish (QR + payment link).

Backend:
- GuestOrderController: POST /api/guest-orders (public, no auth)
- CreateGuestOrderRequest / GuestOrderResponse DTOs
- Order entity: guest_email, guest_token (UUID), nullable user_id
- OrderRepository: findByGuestToken, findByGuestEmail
- OrderService: createGuestOrder, getGuestOrder by token
- SecurityConfig: /api/guest-orders/** permitAll
- V12 migration: drops user_id NOT NULL, adds guest_email + guest_token
  with partial unique index (backfill-safe for existing user orders)

Frontend:
- GuestCheckoutPage: plate lookup + order form (no login)
- GuestPaymentRedirect: Swish QR + payment link + status polling
- GuestOrderPage: order status by guest token
- guestOrders.ts API client
- router: /guest/* public routes
- vite.config: dev proxy for /api/guest-orders

Verification:
- [x] vue-tsc type-check passes (exit 0)
- [ ] Backend Java compiles (no JDK/docker in agent sandbox)
- [ ] Flyway V12 migration applies cleanly
- [ ] End-to-end POST /api/guest-orders -> 201 -> Swish -> status

Frontend type-checks but backend has NOT been compiled or run yet. This
PR is for review; backend smoke test pending in a docker environment.
2026-06-19 19:15:01 +00:00

48 lines
1.2 KiB
TypeScript

/// <reference types="vitest/config" />
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 3000,
host: true,
proxy: {
// Allow running Vite locally outside Docker (set
// VITE_API_PROXY_TARGET=http://localhost:8080 npm run dev) by pointing
// the proxy at the host port instead of the compose service name.
'/api': process.env.VITE_API_PROXY_TARGET || 'http://backend:8080',
},
},
preview: {
port: 80,
host: true,
allowedHosts: ['frontend', 'localhost'],
proxy: {
'/api': 'http://backend:8080',
},
},
test: {
environment: 'jsdom',
setupFiles: ['src/__tests__/setup.ts'],
exclude: ['e2e/**', 'node_modules/**'],
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov', 'json'],
reportsDirectory: './coverage',
thresholds: {
lines: 70,
branches: 60,
functions: 70,
statements: 70,
},
exclude: ['src/__tests__/**', 'e2e/**'],
},
},
})