Tiago Ribeiro
5d1f78dd33
fix: remove unused variable in product usecase
2026-03-09 09:25:57 -03:00
Tiago Ribeiro
742a93ddfc
fix: resolve duplicate methods and missing imports in usecases
2026-03-09 09:25:12 -03:00
Tiago Ribeiro
fa9ddbdeef
fix: restore missing interface methods and cleanup syntax in usecase.go and postgres.go
2026-03-09 09:23:32 -03:00
Tiago Ribeiro
f54c619fc7
fix: adjust financial split math for 6%+6% model and add split test
2026-03-09 09:01:10 -03:00
Tiago Ribeiro
4aac3a0a7e
feat: implement stock reservation background worker and geocode sync endpoint
2026-03-09 08:59:06 -03:00
Tiago Ribeiro
2e0a65389d
feat: implement checkout improvements, psychological fees, geocoding sync and seller dashboard updates
2026-03-09 08:57:51 -03:00
Tiago Yamamoto
a5f50321b9
fix(backend): bootstrap admin reuses existing platform company on duplicate CNPJ
...
When the platform company (CNPJ 00000000000000) already exists in the DB,
RegisterAccount was failing with a unique constraint error before creating
the admin user. Now the bootstrap checks for the existing company first
and binds the new admin user directly to it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 08:57:57 -06:00
Tiago Yamamoto
2829a3e87c
refactor(saveinmed): type legacy addresses and parameterize bootstrap admin
2026-03-07 08:24:53 -06:00
Tiago Yamamoto
b52f780e26
feat: consolidate architecture, remove bff dependency and update backend/frontend modules
2026-03-07 06:40:42 -06:00
Tiago Yamamoto
cab74b9879
fix(api): add empresas aliases for get/delete/verify by id
2026-03-04 19:29:24 -06:00
Tiago Yamamoto
b99f4427ae
fix: normalize auth me payload for perfil
2026-03-04 13:20:50 -06:00
Tiago Yamamoto
e701b57f6a
fix: accept legacy login payload
2026-03-04 12:33:49 -06:00
Tiago Yamamoto
b00d0fe99c
fix: align dev auth and bootstrap superadmin
2026-03-04 10:41:40 -06:00
Tiago Yamamoto
3ca9f50d0c
Merge branch 'main' into dev
2026-03-04 09:43:50 -06:00
joaoaodt
eb9dc8be1d
fix: correcoes de acesso e marketplace
...
- Corrige algoritmo de validacao CNPJ (pesos completos 12/13 digitos)
- Auto-login apos cadastro de usuario redirecionando para /seller
- Registro: role padrao Seller quando campo vazio, mapeamento company_name/cnpj
- Adiciona role Seller ao middleware productManagers (fix 403 em criacao de produto)
- Inventario: usa campos corretos da API (nome, ean_code, sale_price_cents, stock_quantity)
- Marketplace: raio padrao nacional (5000km), empresas sem coordenadas sempre visiveis
- dto.go: adiciona CompanyName e CNPJ ao registerAuthRequest
2026-02-27 15:46:35 -03:00
joaoaodt
dca3725864
Merge branch 'dev' of https://github.com/rede5/saveinmed into dev
2026-02-26 18:39:05 -03:00
caio-machado-dev
3aea36e594
feat: resolve react-icons dependency, add frontend e2e and backend tests
2026-02-26 18:27:02 -03:00
joaoaodt
5900241df6
Merge: mudanças locais + remotas do branch dev
2026-02-26 16:30:59 -03:00
caio-machado-dev
bf85072bff
chore: remove legacy services and restructure monorepo
...
- remove backend-old (Medusa), saveinmed-frontend (Next.js/Appwrite) and marketplace dirs
- split Go usecases by domain and move notifications/payments to infrastructure
- reorganize frontend pages into auth, dashboard and marketplace modules
- add Makefile, docker-compose.yml and architecture docs
2026-02-25 16:51:34 -03:00
caio-machado-dev
ea22729994
feat(company): adiciona melhorias de geolocalização e documentos
...
- implementa busca automática de CEP e coordenadas
- adiciona upload e visualização de licença sanitária
- corrige listagem de pedidos vinculados à empresa
- ajusta interceptador Axios para envio correto de multipart/form-data
2026-02-20 19:31:24 -03:00
Gabbriiel
90467db1ec
refactor: substitui backend Medusa por backend Go e corrige testes do marketplace
...
- Remove backend Medusa.js (TypeScript) e substitui pelo backend Go (saveinmed-performance-core)
- Corrige testes auth.test.ts: alinha paths de API (v1/ sem barra inicial) e campo access_token
- Corrige GroupedProductCard.test.tsx: ajusta distância formatada (toFixed) e troca userEvent por fireEvent com fakeTimers
- Corrige AuthContext.test.tsx: usa vi.hoisted() para mocks e corrige parênteses no waitFor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 04:56:37 -06:00
Tiago Yamamoto
668156fb48
Rename backend folder to backend-old
2026-01-16 10:51:52 -03:00
Tiago Yamamoto
bb8b10b26b
Expandir cobertura de handlers financeiros e admin
2026-01-02 11:27:36 -03:00
Tiago Yamamoto
3f69cade21
test: expand backend coverage
2026-01-02 11:01:56 -03:00
Tiago Yamamoto
4a18f76bd1
test: cover product import
2026-01-02 09:23:18 -03:00
Tiago Yamamoto
8eb9126bcc
Add financial service unit tests
2026-01-02 09:17:17 -03:00
Tiago Yamamoto
9fb4f3e12e
test: expand backend coverage
2026-01-01 16:01:45 -03:00
Tiago Yamamoto
f913f6b3d4
Add backend middleware and frontend card tests
2026-01-01 15:49:17 -03:00
Tiago Yamamoto
8588d07388
Add config helper tests
2026-01-01 15:43:33 -03:00
Tiago Yamamoto
c48666bf60
Add backend and frontend test coverage
2026-01-01 15:06:55 -03:00
Tiago Yamamoto
f7967490e7
test: expand config coverage
2026-01-01 11:46:06 -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
53385670a3
feat: consolidate admin/seller dashboard, remove bff, fix backoffice docker, update docs
2025-12-27 00:58:06 -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
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
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