Commit graph

17 commits

Author SHA1 Message Date
Tiago Yamamoto
16a9ff7ffe test(handler): expand handler test coverage 6.6% -> 44.9%
Added 40+ new handler tests covering:
- Auth: Register, Login (invalid JSON, missing company)
- Company: Get, Update, Delete, Verify, Rating, MyCompany
- Product: Get, Update, Delete (not found, invalid UUID)
- Inventory: List, Adjust (invalid params)
- Order: Create, Get, Update, Delete (validation)
- Payment: Preference, Webhook, Shipment
- Dashboard: Seller, Admin (authorization)
- User: CRUD operations (admin/seller scoping)
- Cart: Add, Get, Delete (context validation)
- Review: Create (validation)

Fixed MockRepository to return errors for not found entities
2025-12-20 08:21:25 -03:00
Tiago Yamamoto
a0720fb4a6 refactor(handler): complete package decomposition - 92% extracted
Final handler package structure (9 files):
- handler.go: 111 lines (Auth: Register, Login)
- dto.go: 220 lines (DTOs, helpers)
- company_handler.go: 228 lines (Companies CRUD)
- product_handler.go: 216 lines (Products + Inventory)
- order_handler.go: 147 lines (Orders CRUD)
- cart_handler.go: 127 lines (Cart + Reviews)
- payment_handler.go: 117 lines (Payments + Shipments)
- dashboard_handler.go: 81 lines (Seller/Admin dashboards)
- user_handler.go: 256 lines (Users CRUD)

Total: 1471 -> 111 lines in handler.go (~92% extracted)
All tests passing
2025-12-20 08:10:56 -03:00
Tiago Yamamoto
a3f00cd8ff refactor(handler): extract order and cart handlers
- Extract 5 order handlers to order_handler.go (147 lines)
  - CreateOrder, ListOrders, GetOrder, UpdateOrderStatus, DeleteOrder
- Extract 4 cart/review handlers to cart_handler.go (127 lines)
  - CreateReview, AddToCart, GetCart, DeleteCartItem
- handler.go reduced from 806 to 548 lines
- Total refactoring: ~63% of original (1471 -> 548)

All tests passing
2025-12-20 08:06:07 -03:00
Tiago Yamamoto
19c636164b refactor(handler): extract product and inventory handlers
- Extract 7 handlers to product_handler.go (216 lines)
  - CreateProduct, ListProducts, GetProduct, UpdateProduct, DeleteProduct
  - ListInventory, AdjustInventory
- handler.go reduced from 1025 to 806 lines
- Total refactoring: ~60% of original (1471 -> 806)

All tests passing
2025-12-20 08:02:02 -03:00
Tiago Yamamoto
e40517aac4 refactor(handler): extract company handlers + update READMEs
Backend:
- Extract 8 company handlers to company_handler.go (228 lines)
- handler.go reduced from 1254 to ~1026 lines
- Total refactoring: ~35% of original handler.go

READMEs updated:
- Backend: new architecture, test coverage table
- Marketplace: new pages (Orders, Inventory, Company, SellerDashboard), Vitest info
2025-12-20 07:58:37 -03:00
Tiago Yamamoto
23df78d9c3 refactor(handler): extract DTOs and helpers to dto.go
- Move 18 request/response structs to dto.go
- Move utility functions (writeJSON, decodeJSON, parseUUID, etc)
- Reduce handler.go from 1471 to 1254 lines (~15% reduction)
- All tests passing
2025-12-20 07:54:35 -03:00
Tiago Yamamoto
8ffd35741d fix: resolve swagger duplicates and add backend tests 2025-12-19 20:28:39 -03:00
Tiago Yamamoto
69af774d30 Add v1 prefix to API routes 2025-12-19 18:42:38 -03:00
Tiago Yamamoto
6cc02a7a8c Add v1 routes to API and Swagger 2025-12-19 18:30:27 -03:00
Tiago Yamamoto
aaa4955fd9 Add full CRUD coverage to core API routes 2025-12-19 18:09:25 -03:00
Tiago Yamamoto
4680035e02 Add auth docs, user CRUD, and password pepper 2025-12-19 17:54:16 -03:00
Tiago Yamamoto
cd376339b9 Add rating and dashboard endpoints 2025-12-18 13:19:21 -03:00
Tiago Yamamoto
ce825fd1d5 Add shipment endpoints and payment webhook split handling 2025-12-18 12:58:05 -03:00
Tiago Yamamoto
e96ba8a49b Add inventory and cart endpoints 2025-12-18 12:43:51 -03:00
Tiago Yamamoto
e57445847b Implement JWT auth and company verification 2025-12-18 12:29:51 -03:00
Tiago Yamamoto
b461ff5201 Implement user CRUD endpoints 2025-12-18 11:42:23 -03:00
Tiago Yamamoto
42f72f5f43 docs: adiciona documentação completa do projeto SaveInMed
- Cria README.md na raiz com visão global e diagrama de arquitetura
- Adiciona/atualiza README.md em todos os componentes:
  - backend (API Go)
  - backoffice (NestJS)
  - marketplace (React/Vite)
  - saveinmed-bff (Python/FastAPI)
  - saveinmed-frontend (Next.js)
  - website (Fresh/Deno)
- Atualiza .gitignore em todos os componentes com regras abrangentes
- Cria .gitignore na raiz do projeto
- Renomeia pastas para melhor organização:
  - backend-go → backend
  - backend-nest → backoffice
  - marketplace-front → marketplace
- Documenta arquitetura, tecnologias, setup e fluxo de desenvolvimento
2025-12-17 17:07:30 -03:00