Tiago Yamamoto
d3f1d0e36d
docs: add b2b gaps roadmap and test matrix
2026-01-01 15:20:48 -03:00
Tiago Yamamoto
a51dfd14af
Merge pull request #51 from rede5/codex/amplify-tests-by-28-percent
...
Add backend shipping/distance tests and marketplace financialService tests
2026-01-01 15:07:32 -03:00
Tiago Yamamoto
c48666bf60
Add backend and frontend test coverage
2026-01-01 15:06:55 -03:00
Tiago Yamamoto
2ff6034e76
Merge pull request #50 from rede5/codex/ampliar-testes-em-10-por-cento
...
test: expand config package tests (BuyerFeeRate, BackendHost, SwaggerSchemes)
2026-01-01 11:46:43 -03:00
Tiago Yamamoto
f7967490e7
test: expand config coverage
2026-01-01 11:46:06 -03:00
Tiago Yamamoto
93c6853d08
Update Dockerfiles and add website Dockerfile
2026-01-01 10:58:10 -03:00
Tiago Yamamoto
eb5c59c1e2
fix(backoffice): repair build errors, update prisma schema and services
2025-12-29 19:07:31 -03:00
Tiago Yamamoto
5c59e7b5a1
docs: add DEVOPS guide and optimize Dockerfiles
...
- Add DEVOPS.md with complete deployment guide for apolo server
- Add DATABASE.md (unified schema documentation)
- Fix backend Dockerfile: Go 1.24 -> 1.23 (current stable)
- Add marketplace Dockerfile with pnpm + static-web-server
- Migrate marketplace from npm to pnpm
- Remove duplicate database-schema.md and DATABASE_SCHEMA.md
2025-12-29 17:00:42 -03:00
Tiago Yamamoto
d435bbe057
fix: Fix fraud.service.ts return type
2025-12-27 10:09:18 -03:00
Tiago Yamamoto
36d6fa4ae0
feat: Implement Phase 4 features
...
Backend (Go):
- FCM Push Notifications (fcm.go, push_handler.go)
- Credit Lines (credit_line.go, credit_handler.go)
- Payment Config (admin_handler.go, seller_payment_handler.go)
- Team Management (team_handler.go)
Backoffice (NestJS):
- Dashboard module (KPIs, revenue charts)
- Audit module (tracking changes)
- Disputes module (CRUD, resolution)
- Reports module (CSV export)
- Performance module (seller scores)
- Fraud module (detection, alerts)
Frontend (Marketplace):
- ThemeContext for Dark Mode
- HelpCenter page with FAQ
- OrderDetails with timeline
- Team management page
- Persistent cart (Zustand)
2025-12-27 10:07:05 -03:00
Tiago Yamamoto
b41f1f6a52
feat(phase2): implement Trust, Safety & Financials
...
- Backend: Add Financial logic (Ledger, Withdrawals) and KYC Endpoints
- Backoffice: Update Prisma Schema and add KYC Review Module
- Frontend: Add Company Profile, Wallet View, and Reviews/Ratings UI
- Frontend: Enhance Admin Companies Page for KYC Review Queue
2025-12-27 01:56:32 -03:00
Tiago Yamamoto
bbe6ec447e
feat(backend): implement financial features (KYC, ledger, withdrawals)
2025-12-27 01:34:29 -03:00
Tiago Yamamoto
6de471ce3e
feat(backend): implement notification system (logger mock)
2025-12-27 01:24:43 -03:00
Tiago Yamamoto
b63242b8fd
feat(backend): implement stripe and asaas webhook handlers
2025-12-27 01:21:25 -03:00
Tiago Yamamoto
132fef816c
feat(backend): implement order state machine with validation
2025-12-27 01:18:00 -03:00
Tiago Yamamoto
89036d7b39
docs: add detailed mermaid diagrams for db, backend and marketplace
2025-12-27 01:13:11 -03:00
Tiago Yamamoto
6b23d05383
refactor(backoffice): remove redundant routes and add settings module for credentials
2025-12-27 01:10:25 -03:00
Tiago Yamamoto
94675c2169
docs: update architecture diagram with Asaas, Stripe and Backoffice connections
2025-12-27 01:05:56 -03:00
Tiago Yamamoto
95131d8c51
fix(docs): close mermaid code block properly
2025-12-27 01:03:44 -03:00
Tiago Yamamoto
7b3b909296
feat(backoffice): add root route with api info and correct swagger link
2025-12-27 01:03:01 -03:00
Tiago Yamamoto
469c473c1e
fix(docs): restore missing header for architecture section
2025-12-27 01:00:37 -03:00
Tiago Yamamoto
1bc89a991c
fix(docs): restore missing graph TD line in architecture diagram
2025-12-27 01:00:13 -03:00
Tiago Yamamoto
ee26512f5a
fix(backoffice): add debian-openssl-3.0.x binary target for prisma
2025-12-27 00:59:25 -03:00
Tiago Yamamoto
53385670a3
feat: consolidate admin/seller dashboard, remove bff, fix backoffice docker, update docs
2025-12-27 00:58:06 -03:00
Tiago Yamamoto
93360c61ca
fix: switch backoffice builder to debian (bookworm) to match distroless runtime (fix bcrypt musl/glibc error)
2025-12-27 00:50:55 -03:00
Tiago Yamamoto
00c18ee704
docs: remove references to BFF service
2025-12-27 00:50:06 -03:00
Tiago Yamamoto
ed1b3c2e53
fix: robust Dockerfile for Backoffice with pnpm prod-deps
2025-12-27 00:45:33 -03:00
Tiago Yamamoto
64d13581df
feat: enable CORS in backoffice with configurable origins
2025-12-27 00:42:57 -03:00
Tiago Yamamoto
70d89d1c28
docs: update BACKOFFICE.md with distroless and jwt details
2025-12-27 00:36:49 -03:00
Tiago Yamamoto
93da628362
chore: optimize Dockerfiles (distroless) and align JWT config
...
- Optimized Backoffice Dockerfile: node:22-alpine -> gcr.io/distroless/nodejs22-debian12
- Optimized BFF Dockerfile: python:3.12-slim -> gcr.io/distroless/python3-debian12
- Updated Backoffice Auth to use JWT_SECRET for local verification
- Updated .env.example with correct env vars
2025-12-27 00:36:26 -03:00
Tiago Yamamoto
d1d2f3f338
chore: remove unused parseShippingMethodType function
2025-12-27 00:31:54 -03:00
Tiago Yamamoto
7105549faf
test: add handler tests (+9.6% coverage: 36.9% → 46.5%)
...
Added 26 new handler tests:
- SearchProducts: MissingLatLng, InvalidLat/Lng, Success, WithFilters
- Auth: RegisterCustomer, RegisterTenant, ForgotPassword, ResetPassword, VerifyEmail, Logout
- Pagination: ListProducts, ListCompanies, ListOrders
- Shipping: CalculateShipping, GetShippingSettings
- Reviews: CreateReview, GetCompanyRating
- Dashboard: GetSellerDashboard
- Payments: CreatePaymentPreference, HandlePaymentWebhook
- Shipments: CreateShipment, GetShipmentByOrderID
Handler coverage: 36.9% → 46.5% (+9.6%)
Seeder already has 'Aparecida de Goiânia' (verified)
2025-12-27 00:29:03 -03:00
Tiago Yamamoto
ebd6d903ec
test: add comprehensive Asaas gateway tests (+45% payments coverage)
...
Added 17 new tests for Asaas payment gateway:
- TestNewAsaasGateway, TestAsaasBaseURL_Sandbox/Production
- TestAsaasCreatePreference, TestAsaasCreatePixPayment
- TestAsaasCreateBoletoPayment, TestAsaasConfirmPayment
- TestAsaasRefundPayment, TestAsaasCreateSubaccount
- Context cancellation tests for all methods
Coverage results:
- Payments: 50% → 95.3% (+45%)
- Middleware: 90.8%
- Config: 85.7%
- Server: 69.1%
- Handler: 36.9%
2025-12-27 00:22:52 -03:00
Tiago Yamamoto
3c49df55e4
feat: complete payment gateway implementation (Asaas, Stripe, MercadoPago)
...
Payment Gateways:
- asaas.go: Pix (QR code), Boleto, Credit Card with split
- Seller subaccount creation for split payments
- 6 new domain types: PixPaymentResult, BoletoPaymentResult, SellerPaymentAccount, Customer, PaymentGatewayConfig
Documentation:
- docs/PAYMENT_GATEWAYS.md: Complete comparison (MercadoPago vs Stripe vs Asaas)
- Admin routes for gateway config
- Seller onboarding routes
- Environment variables reference
Coverage: 50% payments
2025-12-27 00:11:48 -03:00
Tiago Yamamoto
c53cd5a4dd
test: add Stripe and Mock gateway tests (+79% payments coverage)
...
Added 12 new tests for payment gateways:
- TestNewStripeGateway, TestStripeCreatePreference, TestStripeCreatePaymentIntent
- TestNewMockGateway, TestMockCreatePreference, TestMockConfirmPayment, TestMockRefundPayment
- Context cancellation tests for all gateways
Coverage increases:
- Payments: 11.8% → 91.4% (+79.6%)
- Handler: 32.6% → 36.9%
- Middleware: 90.8%
- Config: 85.7%
- Server: 69.1%
Frontend: 95 tests passing
2025-12-26 23:42:38 -03:00
Tiago Yamamoto
8f1e893142
feat: major implementation - seeder, payments, docs
...
Seeder API:
- 110 pharmacies across 5 cities (Goiânia 72, Anápolis 22, Nerópolis 10, Senador Canedo 5, Aparecida 1)
- 3-300 products per pharmacy
- Dynamic city/state in company records
Payment Gateways:
- stripe.go: Stripe integration with PaymentIntent
- mock.go: Mock gateway with auto-approve for testing
- PaymentResult and RefundResult domain types
Documentation:
- docs/BACKEND.md: Architecture, invisible fee, endpoints
- docs/SEEDER_API.md: City distribution, product counts
- docs/MARKETPLACE.md: Frontend structure, stores, utils
- docs/BACKOFFICE.md: Admin features, encrypted settings
2025-12-26 23:39:49 -03:00
Tiago Yamamoto
12e2503244
feat: implement invisible 12% buyer fee
...
Business model:
- Seller registers R$10,00 → Seller sees R$10,00 → Seller receives R$10,00
- Buyer searches → sees R$11,20 (+12%) → pays R$11,20
- Marketplace keeps R$1,20 (12%)
Changes:
- config.go: Add BuyerFeeRate (default 0.12)
- handler.go: Add buyerFeeRate field to Handler struct
- product_handler.go: SearchProducts inflates prices for buyers
- server.go: Pass cfg.BuyerFeeRate to handler.New()
- handler_test.go: Fix 3 New() calls with fee rate
Env var: BUYER_FEE_RATE (default: 0.12)
2025-12-26 23:23:18 -03:00
Tiago Yamamoto
285f586371
fix: cart price display showing cents as reais (R19 instead of R.19)
...
Root cause: Cart.tsx used formatCurrency(819) -> '819,00' instead of formatCents(819) -> 'R$ 8,19'
Changes:
- Cart.tsx: Replace formatCurrency with formatCents at all 5 price display points
- Cart.tsx: Add debug logging (logPrice) to trace price values
- cartStore.ts: Add debug logging for addItem, updateQuantity, etc.
- cartStore.ts: Document unitPrice as CENTS in interface
- cartStore.test.ts: Add 7 new price conversion tests for cents handling
All 95 tests pass.
2025-12-26 23:08:55 -03:00
Tiago Yamamoto
670af4ea67
test: increase test coverage +10% frontend, +2% backend
...
Backend (+1.8%):
- Add shipping handler tests (GetShippingSettings, UpsertShippingSettings, CalculateShipping)
- Add ListOrders with role filters tests
- Handler coverage: 32.6% → 37.2%
Frontend (+16 tests, 72 → 88):
- Add jwt.test.ts (6 tests)
- Add logger.test.ts (8 tests)
- Add useDebounce.test.ts (5 tests)
2025-12-26 23:02:18 -03:00
Tiago Yamamoto
114e8dc5bc
fix: add payment_method column to orders table
...
Migration 0008: adds payment_method column with default 'pix'
Fixes 500 error: column "payment_method" does not exist
2025-12-26 22:56:46 -03:00
Tiago Yamamoto
f0d64d1801
fix(tests): fix failing tests and increase coverage
...
Backend:
- Fix TestCreateCompany (added Phone, OperatingHours, Is24Hours)
- Fix TestCreateProduct (added EANCode, Manufacturer, Category, etc)
- Add TestCreateUser, TestListUsers, TestListOrders, TestGetShippingSettings
- All 9 repository tests now pass
Frontend:
- Add shippingService.test.ts (4 tests)
- Add ordersService.test.ts (5 tests)
- Add format.test.ts (9 tests)
- Total tests increased from 54 to 72
2025-12-26 22:54:51 -03:00
Tiago Yamamoto
630bcc9da5
debug: add detailed logging with emojis for orders endpoint
...
Backend (order_handler.go):
- Log URL, method, pagination
- Log requester role and company ID
- Log role query param and filter values
- Log service call results and errors
Frontend (Orders.tsx):
- Styled console logs with colors
- Log tab, endpoint, response data
- Detailed error logging with response data
2025-12-26 22:44:34 -03:00
Tiago Yamamoto
aaa304c256
feat: add test/coverage and build verification options to start.sh
...
- Option 7: Run tests with coverage (go test + vitest)
- Option 8: Verify build for backend, marketplace, and backoffice
- Also accessible via --test/-t and --build/-B CLI flags
2025-12-26 22:39:53 -03:00
Tiago Yamamoto
59c0fe7449
fix: filter users by company for ALL non-Admin roles
...
Previously only 'Seller' role was filtered, but Owner/Colaborador/Entregador roles
were not filtered, causing global admin to appear in pharmacy user lists.
2025-12-26 22:37:23 -03:00
Tiago Yamamoto
61f73c3421
fix: allow buyers to view shipping settings and filter orders by role
...
- shipping_handler: Remove auth restriction on GetShippingSettings (buyers need to see sellers' shipping options)
- order_handler: Add role query param parsing (buyer/seller) to filter orders by requester's company ID
Fixes 500 errors on:
- GET /api/v1/shipping/settings/{vendor_id}
- GET /api/v1/orders?role=buyer
- GET /api/v1/orders?role=seller
2025-12-26 22:35:27 -03:00
Tiago Yamamoto
240ce9a7e5
feat: add quantity selector, fix offer display, swap filter/location layout
...
- ProductOffersModal: Add quantity input for each offer when purchasing
- ProductOffersModal: Display offer info in single line with flex-wrap
- GroupedProductCard: Add whitespace-nowrap to prevent 'oferta' badge wrapping
- ProductSearch: Swap Filters and Location components (Filters now first)
- Backend: Refactored admin routes to use role-based access control
- review_handler: New handler with role-based filtering
- shipping_handler: Added ListShipments with role-based filtering
- domain/models: Added SellerID to ReviewFilter and ShipmentFilter
- postgres.go: Updated ListReviews and ListShipments for SellerID filtering
- server.go: Removed /api/v1/admin routes, updated handlers
2025-12-26 22:16:48 -03:00
Tiago Yamamoto
41862b3d5c
chore(backend): change swagger endpoint from /swagger to /docs
2025-12-26 22:00:10 -03:00
Tiago Yamamoto
803d371b59
Fix checkout summary rendering
2025-12-26 18:13:01 -03:00
Tiago Yamamoto
ed4349a938
feat: Implement Payment Methods, Shipping Improvements, Swagger Audit, and UUIDv7 Migration
...
- Payment Methods: Added Pix/Credit/Debit selection in checkout, updated backend models and handlers.
- Shipping: Updated Checkout UI, added shipping_settings table and seed data.
- Swagger: Updated API docs, regenerated swagger.yaml.
- UUIDv7: Migrated seeder and backend tests to use uuid.NewV7().
2025-12-26 17:48:50 -03:00
Tiago Yamamoto
fd305c00a8
fix(marketplace): ensure auth token is set before initial requests
2025-12-26 17:24:57 -03:00