Commit Graph

19 Commits

Author SHA1 Message Date
9644833db9 fix(backend): seed.py add __main__ + seed_demo for demo tenant creation 2026-03-13 19:15:15 +02:00
165890b07d fix(backend): alembic migration SQLite compat + sync push rollback on error 2026-03-13 19:05:35 +02:00
1e96db4d91 fix(backend): sync push error handling + validation
- apply_push now uses PRAGMA table_info() to get valid column names per
  table and filters incoming data to only known columns, preventing
  "no such column" SQLite errors from frontend-only fields like oracle_id
- Wrap each operation in try/except so one bad op doesn't abort the
  whole batch; errors are returned in the conflicts list instead of 500
- Add server_default to all NOT NULL float/int columns so raw SQL
  INSERT OR REPLACE without those fields still succeeds
- Align DB models with frontend schema.js:
  - orders: add nr_comanda, client_nume, client_telefon, nr_auto,
    marca_denumire, model_denumire, created_by
  - order_lines: add norma_id, mecanic_id, ordine
  - vehicles: add serie_sasiu, client_cod_fiscal (keep vin, client_cui
    for REST API compat)
  - catalog_*: rename nume → denumire to match frontend schema
  - catalog_norme: align fields (cod, denumire, ore_normate)
  - invoices: add serie_factura, modalitate_plata, client_cod_fiscal,
    nr_auto, total_fara_tva, tva, total_general; keep total for compat
  - appointments: add client_nume, client_telefon, data_ora, durata_minute,
    status, order_id
  - mecanici: add user_id, prenume, activ
- Fix seed.py to use denumire= instead of nome= after catalog rename
- Add 3 new sync push tests covering order insert with frontend fields,
  unknown column filtering, and order_line with norma_id/mecanic_id/ordine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 18:45:31 +02:00
9aef3d6933 feat(frontend): wa-sqlite memory-only + Factureaza + Vite polling + Appointments + Catalog
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 18:37:08 +02:00
78d2a77b0d chore: configure gitignore 2026-03-13 17:40:28 +02:00
8c0346e41f feat(backend): invite system + user management
- InviteToken model with unique token for each invite
- POST /users/invite - create invite by email with role (admin/mecanic)
- POST /auth/accept-invite - accept invite, set password, return JWT
- GET /users - list all users in tenant
- DELETE /users/{id} - deactivate user (cannot deactivate owner)
- Alembic migration for invites table
- 25 passing tests (auth + sync + orders + pdf + portal + invoices + users)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:37:06 +02:00
5fa72e4323 fix(frontend): add COOP/COEP headers for SharedArrayBuffer (wa-sqlite WASM)
Dev server now sends Cross-Origin-Opener-Policy and
Cross-Origin-Embedder-Policy headers required for WASM
SharedArrayBuffer support used by wa-sqlite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:36:17 +02:00
1686efeead feat(frontend): PWA + Backup/Restore + Upgrade Prompts + Settings
- PWA: vite-plugin-pwa with autoUpdate service worker, manifest, offline
  caching for assets + NetworkFirst for API calls
- PWA icons: 192x192 and 512x512 placeholder PNGs + favicon.svg
- index.html: theme-color, apple-touch-icon, description meta tags
- UpgradeBanner component: trial expiry warning with upgrade CTA
- SettingsView: complete settings page with:
  - Plan info display
  - Tenant profile form (firma, CUI, reg com, adresa, IBAN, banca)
  - Backup export (JSON with all tenant data from wa-sqlite)
  - Restore import (JSON file with validation and INSERT OR REPLACE)
  - User management with invite form (email + rol)
  - Logout button
- useOffline composable: shared reactive online/offline state
- DashboardView: added UpgradeBanner at top

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:35:06 +02:00
3bdafad22a feat(backend): PDF deviz + portal client + SMS + invoice service
- PDF generation with WeasyPrint: deviz and factura templates (A4, branding)
- GET /orders/{id}/pdf/deviz returns PDF with order lines and totals
- Client portal (public, no auth): GET /p/{token}, POST /p/{token}/accept|reject
- SMS service (SMSAPI.ro) - skips in dev when no token configured
- Invoice service: create from validated order, auto-number (F-YYYY-NNNN)
- GET /invoices/{id}/pdf returns factura PDF
- Order status_client field for client accept/reject tracking
- Alembic migration for status_client
- 19 passing tests (auth + sync + orders + pdf + portal + invoices)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:34:36 +02:00
efc9545ae6 feat(frontend): Portal public client + PDF download + Facturi view
- DevizPublicView: standalone public page /p/:token (no auth, no layout)
  - Loads order/tenant/lines from backend API
  - Accept/Reject buttons with feedback banners
  - Mobile-first design with service branding
- usePdf composable: fetch PDF blob from backend and trigger browser download
- PdfDownloadButton component: reusable button for deviz/invoice PDF download
- InvoicesView: table with invoice list from wa-sqlite, PDF download per row
- OrderDetailView: added PDF Deviz download button (visible when not DRAFT)
- Router: added /invoices route, portal /p/:token uses layout: 'none'
- App.vue: supports layout: 'none' for standalone pages
- AppLayout: added Facturi link in sidebar nav

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:31:41 +02:00
3a922a50e6 feat(backend): sync endpoints + all models + seed + order workflow
- All business models: Vehicle, Order, OrderLine, Invoice, Appointment,
  CatalogMarca/Model/Ansamblu/Norma/Pret/TipDeviz/TipMotor, Mecanic
- Sync endpoints: GET /sync/full, GET /sync/changes?since=, POST /sync/push
  with tenant isolation and last-write-wins conflict resolution
- Order CRUD with state machine: DRAFT -> VALIDAT -> FACTURAT
  Auto-recalculates totals (manopera + materiale)
- Vehicle CRUD: list, create, get, update
- Seed data: 24 marci, 11 ansamble, 6 tipuri deviz, 5 tipuri motoare, 3 preturi
- Alembic migration for all business models
- 13 passing tests (auth + sync + orders)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:31:02 +02:00
ad41956ea1 feat(frontend): Dashboard + Orders UI + Vehicle Picker + Vehicles list
- Pinia stores: orders (CRUD, line management, totals recalc, stats) and vehicles (CRUD, search, marca/model cascade)
- useSync composable: auto-sync on window focus + periodic 60s interval
- VehiclePicker component: debounced autocomplete search by nr. inmatriculare or client name
- OrderLineForm component: manopera/material toggle with live total preview
- DashboardView: stats cards (orders, vehicles, revenue), recent orders list
- OrdersListView: filterable table (all/draft/validat/facturat), clickable rows
- OrderCreateView: vehicle picker + inline new vehicle form, tip deviz select, km/observatii
- OrderDetailView: order info, lines table with add/remove, totals, validate action
- VehiclesListView: searchable table, inline create form with marca/model cascade
- AppLayout: mobile hamburger menu with slide-in sidebar overlay

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:29:02 +02:00
907b7be0fd feat(backend): FastAPI + libSQL + auth register/login/me + tests (TDD)
- FastAPI app with lifespan, CORS, health endpoint
- SQLAlchemy 2.0 async with aiosqlite, Base/UUIDMixin/TenantMixin/TimestampMixin
- Tenant and User models with multi-tenant isolation
- Auth: register (creates tenant+user), login, /me endpoint
- JWT HS256 tokens, bcrypt password hashing
- Alembic async setup with initial migration
- 6 passing tests (register, login, wrong password, me, no token, health)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:26:31 +02:00
c3482bba8d feat(frontend): Vue 3 + wa-sqlite + sync engine + auth + layouts
- package.json with Vue 3, Pinia, vue-router, wa-sqlite, Tailwind CSS 4, Vite
- wa-sqlite database layer with IDBBatchAtomicVFS (offline-first)
- Full schema mirroring backend tables (vehicles, orders, invoices, etc.)
- SyncEngine: fullSync, incrementalSync, pushQueue for offline queue
- Auth store with JWT parsing, login/register, plan tier detection
- Router with all routes and auth navigation guards
- AppLayout (sidebar desktop / bottom nav mobile) + AuthLayout
- Login/Register views connected to API contract
- SyncIndicator component (online/offline status)
- Reactive SQL query composable (useSqlQuery)
- Placeholder views for dashboard, orders, vehicles, appointments, catalog, settings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:22:50 +02:00
a16d01a669 chore(deploy): Docker production config, nginx gzip/cache, deploy docs
- docker-compose.yml: restart always, env_file, named volume, start_period
- frontend/nginx.conf: gzip compression, cache headers for assets, no-cache for SW
- Makefile: add prod-down and prod-logs targets
- docs/DEPLOY.md: Dokploy + Cloudflare Tunnel deploy instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:20:36 +02:00
6f82c56995 chore(devops): docker-compose dev + prod, Dockerfiles, nginx, Makefile
- backend/Dockerfile: Python 3.12 slim, non-root user, WeasyPrint system deps
- backend/Dockerfile.dev: dev variant with hot-reload support
- frontend/Dockerfile: Node 20 alpine build + nginx:alpine serve
- frontend/nginx.conf: SPA routing + /api proxy to backend:8000
- docker-compose.yml: production with healthcheck
- docker-compose.dev.yml: dev with volume mounts and hot-reload
- Makefile: dev, build, up, down, logs, migrate, test, shell, prod targets
- .dockerignore for backend and frontend

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:19:12 +02:00
1ab109b1d4 chore: project structure + API contract 2026-03-13 17:17:22 +02:00
d6e1a0c2fa chore: ignore HANDOFF.md 2026-03-13 17:09:12 +02:00
b5085bf2fa chore: plan implementare Agent Teams + API contract
- docs/PLAN.md - plan arhitectural complet (creat anterior)
- docs/api-contract.json - contract API intre backend/frontend agenti
- docs/superpowers/plans/2026-03-13-roaauto-implementation.md - plan implementare cu Agent Teams
- HANDOFF.md - context pentru sesiuni viitoare

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:07:04 +02:00