Tiago Yamamoto
55342c5375
Merge pull request #25 from rede5/codex/implementar-no-marketplace
...
Implement marketplace authentication login integration
2025-12-21 23:40:47 -03:00
Tiago Yamamoto
b710383733
Implement marketplace auth login integration
2025-12-21 23:40:34 -03:00
Tiago Yamamoto
9997aed18a
fix(backend): fix build errors, update tests, and improve documentation
...
- Add GetUserByEmail to Repository interface for password reset flow
- Add username to UpdateUser query
- Fix config_test.go: remove references to deleted DB pool fields
- Fix handler_test.go: add GetUserByUsername to MockRepository
- Fix usecase_test.go: add GetUserByUsername and update auth tests
- Update backend README with auth and admin seeding info
- Create seeder-api README with usage and warnings
2025-12-21 23:11:33 -03:00
Tiago Yamamoto
4612172b3c
feat(backend): switch auth to username and cleanup db config
2025-12-21 23:04:47 -03:00
Tiago Yamamoto
c1f32d0165
Merge pull request #24 from rede5/codex/verify-and-implement-authentication-routes-in-swagger
...
Add complete auth endpoints, password reset/verify and update swagger
2025-12-21 22:39:01 -03:00
Tiago Yamamoto
b72f8f3099
Add full auth endpoints and swagger updates
2025-12-21 22:37:54 -03:00
Tiago Yamamoto
276b6bb923
refactor(backend): rename SWAGGER_HOST to BACKEND_HOST
...
Renames SWAGGER_HOST to BACKEND_HOST in .env.example and config. Updates main.go to use the new configuration variable.
2025-12-21 22:21:37 -03:00
Tiago Yamamoto
e162ef04a5
Merge pull request #23 from rede5/codex/add-url-selection-from-env-file
...
Add Swagger host and schemes env config
2025-12-21 22:16:25 -03:00
Tiago Yamamoto
73ebe3ec6d
Add swagger host/scheme env config
2025-12-21 22:16:11 -03:00
Tiago Yamamoto
f71a3a320a
Merge pull request #22 from rede5/codex/fix-content-security-policy-violations
...
Relax Content-Security-Policy for Swagger UI under /docs
2025-12-21 22:10:19 -03:00
Tiago Yamamoto
8ab398723d
Relax CSP for Swagger docs
2025-12-21 22:10:03 -03:00
Tiago Yamamoto
fd237cd9c4
fix(backend): resolving hardcoded values and test failures
...
Updates .env.example with missing variables. Adds missing security headers in middleware. Fixes repository tests including timezone issues and sqlmock expectations.
2025-12-21 21:43:50 -03:00
Tiago Yamamoto
d63fb0da2d
Merge pull request #21 from rede5/codex/implement-advanced-search-repository-layer
...
Add marketplace advanced record search with windowed pagination and updated_at trigger
2025-12-21 17:36:28 -03:00
Tiago Yamamoto
4ad6a0aae5
Add marketplace record search and audit trigger
2025-12-21 17:36:17 -03:00
Tiago Yamamoto
ab138b6436
chore(deps): update go modules
2025-12-20 11:13:53 -03:00
Tiago Yamamoto
bad6d15a60
refactor: move seeder to api, improve coverage and security
2025-12-20 11:13:53 -03:00
Tiago Yamamoto
e73d423b16
refactor: move seeder to api, improve coverage and security
2025-12-20 11:13:53 -03:00
Tiago Yamamoto
51ad574d72
Merge pull request #20 from rede5/codex/implement-logistics-and-delivery-module
...
Add shipping settings, calculation logic and API endpoints
2025-12-20 10:47:56 -03:00
Tiago Yamamoto
fd60888706
Add shipping settings and calculation
2025-12-20 10:47:37 -03:00
Tiago Yamamoto
d9886fae62
Merge pull request #19 from rede5/codex/implement-backend-migrations-and-test
...
Add SQL migrations runner for backend schema
2025-12-20 10:33:46 -03:00
Tiago Yamamoto
77f414bf02
Add database migrations runner
2025-12-20 10:32:54 -03:00
Tiago Yamamoto
c3006064f7
chore: update backend .env.example
2025-12-20 10:12:02 -03:00
Tiago Yamamoto
25cee3911c
chore: refactor backend config, unignore .env, update config loading
2025-12-20 10:10:55 -03:00
Tiago Yamamoto
4bb848788f
feat: tenant model, seeder, and product search with distance
...
Tenant Model:
- Renamed Company→Tenant (Company alias for compatibility)
- Added: lat/lng, city, state, category
- Updated: postgres, handlers, DTOs, schema SQL
Seeder (cmd/seeder):
- Generates 400 pharmacies in Anápolis/GO
- 20-500 products per tenant
- Haversine distance variation ±5km from center
Product Search:
- GET /products/search with advanced filters
- Filters: price (min/max), expiration, distance
- Haversine distance calculation (approx km)
- Anonymous seller (only city/state shown until checkout)
- Ordered by expiration date (nearest first)
New domain types:
- ProductWithDistance, ProductSearchFilter, ProductSearchPage
- HaversineDistance function
Updated tests for Category instead of Role
2025-12-20 09:03:13 -03:00
Tiago Yamamoto
beffeb8268
feat(security): add rate limiting and security headers middleware
...
Rate Limiting (ratelimit.go):
- Token bucket algorithm per IP
- Default: 100 requests/minute
- X-Forwarded-For support
- Cleanup for stale buckets
- 7 tests (ratelimit_test.go)
Security Headers (security.go):
- X-Content-Type-Options: nosniff
- X-Frame-Options: DENY
- X-XSS-Protection: 1; mode=block
- Content-Security-Policy: default-src 'none'
- Referrer-Policy: strict-origin-when-cross-origin
- Cache-Control: no-store, max-age=0
Middleware coverage: 97.3% -> 95.8% (new code added)
2025-12-20 08:41:36 -03:00
Tiago Yamamoto
45d34f36c8
feat(pagination): add pagination to all list endpoints
...
Added pagination support to:
- ListCompanies: filter by role, search
- ListProducts: filter by seller, search
- ListOrders: filter by buyer, seller, status
- ListInventory: filter by expiring date, seller
New domain types:
- ProductFilter, ProductPage
- CompanyFilter, CompanyPage
- OrderFilter, OrderPage
- InventoryPage
All endpoints now return paginated responses with:
- items array
- total count
- current page
- page size
Updated MockRepository in both test files to match new signatures
2025-12-20 08:37:59 -03:00
Tiago Yamamoto
b713d8fbed
test(middleware): expand coverage 95.9% -> 97.3%
...
Added tests for:
- Expired token handling
- Wrong signing method rejection (None type attack)
2025-12-20 08:24:03 -03:00
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
b8973739ab
feat(backend): add comprehensive test suite for 80% coverage
...
- Add config_test.go (5 tests for env parsing)
- Add middleware_test.go (16 tests for CORS, Auth, Gzip, Logger)
- Add usecase_test.go (30+ tests for business logic)
- Add payments_test.go (6 tests for MercadoPago gateway)
Coverage: config 100%, middleware 95.9%, payments 100%, usecase 64.7%
feat(marketplace): add test framework and new pages
- Setup Vitest with jsdom environment
- Add cartStore.test.ts (15 tests for Zustand store)
- Add usePersistentFilters.test.ts (5 tests for hook)
- Add apiClient.test.ts (7 tests for axios client)
- Add Orders page with status transitions
- Add Inventory page with stock adjustments
- Add Company page with edit functionality
- Add SellerDashboard page with KPIs
Total marketplace tests: 27 passing
2025-12-20 07:43:56 -03:00
Tiago Yamamoto
c83079e4c9
chore(marketplace): update package-lock.json
2025-12-20 07:27:37 -03:00
Tiago Yamamoto
8ffd35741d
fix: resolve swagger duplicates and add backend tests
2025-12-19 20:28:39 -03:00
Tiago Yamamoto
fdf256d436
Merge pull request #18 from rede5/codex/corrigir-erro-contia
...
Remove duplicate /api/v1/products/{id} path from Swagger docs
2025-12-19 19:32:31 -03:00
Tiago Yamamoto
e5103db905
Fix duplicate product path in swagger docs
2025-12-19 19:32:16 -03:00
Tiago Yamamoto
cee817cd60
Merge pull request #17 from rede5/codex/implementar-rotas-para-sistema-de-auth
...
Add missing auth endpoints in BFF
2025-12-19 19:22:57 -03:00
Tiago Yamamoto
edf7cb78ac
Add missing auth endpoints
2025-12-19 19:22:20 -03:00
Tiago Yamamoto
952e158aae
Merge pull request #16 from rede5/codex/add-swagger-route-/docs
...
Expose Swagger UI at /docs and update links
2025-12-19 19:01:13 -03:00
Tiago Yamamoto
632b35f6bb
Update swagger route to /docs
2025-12-19 19:00:58 -03:00
Tiago Yamamoto
60078dd6aa
Merge pull request #15 from rede5/codex/fix-route-conflict-for-post-/api/v1/companies
...
Fix duplicate API route registrations
2025-12-19 18:53:02 -03:00
Tiago Yamamoto
65add1fa8e
Fix duplicate API route registrations
2025-12-19 18:52:47 -03:00
Tiago Yamamoto
2bca2d4576
Merge pull request #14 from rede5/codex/add-v1-to-all-rptas
...
Prefix API routes with /api/v1 and update OpenAPI docs
2025-12-19 18:43:26 -03:00
Tiago Yamamoto
69af774d30
Add v1 prefix to API routes
2025-12-19 18:42:38 -03:00
Tiago Yamamoto
21d98da9c1
Merge pull request #13 from rede5/codex/mapear-backend-e-atualizar-rotas-no-swagger
...
Add v1 API routes and Swagger entries
2025-12-19 18:31:25 -03:00
Tiago Yamamoto
6cc02a7a8c
Add v1 routes to API and Swagger
2025-12-19 18:30:27 -03:00
Tiago Yamamoto
1309a120cb
Merge pull request #12 from rede5/codex/implementar-crud-nas-rotas-e-documentar
...
Add CRUD endpoints for companies, products and orders; update repo/service/handlers and regenerate Swagger
2025-12-19 18:10:27 -03:00
Tiago Yamamoto
aaa4955fd9
Add full CRUD coverage to core API routes
2025-12-19 18:09:25 -03:00