Integrate shared JWT authentication into data-entry-app: - Add Oracle pool initialization for auth service - Add AuthenticationMiddleware to protect API routes - Update all receipt endpoints to use CurrentUser from JWT - Add shared auth router (/api/auth/login, /api/auth/refresh) Add nomenclature synchronization feature: - Create SQLite models for synced suppliers, local suppliers, and cash registers - Add nomenclature router with sync triggers and CRUD endpoints - Add sync service for Oracle → SQLite nomenclature data - Update nomenclature_service to use synced SQLite data with fallbacks Create shared frontend components: - Add shared/frontend/ with LoginView.vue, auth store factory, login.css - Integrate shared login and auth into data-entry-app frontend - Add axios-based API service with token refresh interceptor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.0 KiB
4.0 KiB
CLAUDE.md - Data Entry App
Scop
Aplicatie pentru introducere date in ERP (bonuri fiscale, chitante) cu workflow de aprobare.
Documentatie de Referinta
- Cerinte:
docs/data-entry/REQUIREMENTS.md - Arhitectura:
docs/data-entry/ARCHITECTURE.md - Quick Start:
README.md
Decizii Tehnice
- ORM: SQLModel (Pydantic + SQLAlchemy)
- Migrari: Alembic
- Database: SQLite (Faza 1) → Oracle (Faza 2)
- Frontend: Vue.js 3 + PrimeVue (consistent cu reports-app)
Workflow Bonuri
1. DRAFT → utilizator completeaza + upload poza
2. PENDING_REVIEW → sistem genereaza note contabile
3. APPROVED/REJECTED → contabil aproba sau respinge
4. SYNCED → (Faza 2) date in Oracle
Structura Directoare
data-entry-app/
├── backend/ # FastAPI API (port 8003)
│ ├── app/
│ │ ├── db/ # SQLModel models + CRUD
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/ # Business logic
│ │ └── routers/ # API endpoints
│ ├── migrations/ # Alembic migrations
│ └── data/ # SQLite DB + uploads
├── frontend/ # Vue.js UI (port 3010)
│ └── src/
│ ├── views/ # Page components
│ ├── components/ # Reusable components
│ └── stores/ # Pinia stores
└── docs/ # Documentatie specifica
Componente Partajate
Backend
shared/database/oracle_pool.py- Conexiune Oracle pentru nomenclatoare si autentificareshared/auth/- JWT authentication (middleware, routes, service)
Frontend
shared/frontend/components/LoginView.vue- Componenta login partajatashared/frontend/stores/auth.js- Pinia auth store factoryshared/frontend/styles/login.css- Stiluri login
Comenzi Dezvoltare
# Backend
cd data-entry-app/backend
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reload --port 8003
# Frontend
cd data-entry-app/frontend
npm install
npm run dev -- --port 3010
# Migrari
cd data-entry-app/backend
alembic revision --autogenerate -m "description"
alembic upgrade head
Tipuri Cheltuieli (hardcoded in Faza 1)
| Cod | Tip | Cont | TVA |
|---|---|---|---|
| FUEL | Combustibil | 6022 | 19% |
| MATERIALS | Materiale | 6028 | 19% |
| OFFICE | Rechizite | 6024 | 19% |
| PHONE | Telefonie | 626 | 19% |
| PARKING | Parcare | 6022 | 19% |
| FOOD | Alimentatie | 6028 | 0% |
| TRANSPORT | Transport | 624 | 19% |
| OTHER | Altele | 628 | 19% |
Integrare Oracle (Faza 2)
Vezi docs/PACK_CONTAFIN.pck pentru procedurile stocate:
pack_contafin.init_scriere_act_rul_local()INSERT INTO ACT_TEMP (...)pack_contafin.finalizeaza_scriere_act_rul()
API Endpoints Summary
Receipts CRUD
POST /api/receipts/- CreateGET /api/receipts/- List (filterable)GET /api/receipts/{id}- DetailPUT /api/receipts/{id}- Update (DRAFT only)DELETE /api/receipts/{id}- Delete (DRAFT only)
Workflow
POST /api/receipts/{id}/submit- Send for reviewPOST /api/receipts/{id}/approve- ApprovePOST /api/receipts/{id}/reject- RejectPOST /api/receipts/{id}/resubmit- Resubmit after rejection
Attachments
POST /api/receipts/{id}/attachments- UploadGET /api/attachments/{id}/download- DownloadDELETE /api/attachments/{id}- Delete
Nomenclatures
GET /api/receipts/partners- Partners from OracleGET /api/receipts/accounts- Accounts from OracleGET /api/receipts/cash-registers- Cash registers from OracleGET /api/receipts/expense-types- Expense types (hardcoded)
Testing
# Backend tests
cd backend && pytest
# Frontend tests
cd frontend && npm run test
Common Issues
SQLite locked
- Asigura-te ca nu ai multiple procese care acceseaza DB-ul
Upload fails
- Verifica permisiuni pe
data/uploads/ - Verifica MIME type (doar image/*, application/pdf)
Migration errors
alembic downgrade -1pentru rollback- Sterge migration file si regenereaza