Commit graph

47 commits

Author SHA1 Message Date
Tiago Yamamoto
cab74b9879 fix(api): add empresas aliases for get/delete/verify by id 2026-03-04 19:29:24 -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
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
3f69cade21 test: expand backend coverage 2026-01-02 11:01:56 -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
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
53385670a3 feat: consolidate admin/seller dashboard, remove bff, fix backoffice docker, update docs 2025-12-27 00:58:06 -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
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
fd305c00a8 fix(marketplace): ensure auth token is set before initial requests 2025-12-26 17:24:57 -03:00
Tiago Yamamoto
baa60c0d9b feat: overhaul shipping module, add seeder, and improve order UI 2025-12-23 18:23:32 -03:00
Tiago Yamamoto
b0b96d469c Add review and shipment admin listing endpoints 2025-12-22 10:15:27 -03:00
Tiago Yamamoto
4ccfa629cc feat: add admin reviews, logistics, profile pages and update seeder 2025-12-22 09:08:42 -03:00
Tiago Yamamoto
9ad6d87590 fix(backend): add missing Username field to admin seeding 2025-12-22 00:45:30 -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
b72f8f3099 Add full auth endpoints and swagger updates 2025-12-21 22:37:54 -03:00
Tiago Yamamoto
4ad6a0aae5 Add marketplace record search and audit trigger 2025-12-21 17:36:17 -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
fd60888706 Add shipping settings and calculation 2025-12-20 10:47:37 -03:00
Tiago Yamamoto
77f414bf02 Add database migrations runner 2025-12-20 10:32:54 -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
8ffd35741d fix: resolve swagger duplicates and add backend tests 2025-12-19 20:28:39 -03:00
Tiago Yamamoto
632b35f6bb Update swagger route to /docs 2025-12-19 19:00:58 -03:00
Tiago Yamamoto
65add1fa8e Fix duplicate API route registrations 2025-12-19 18:52:47 -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
916225f19e feat(backend): add configurable CORS and optimize Dockerfile
- Add CORS_ORIGINS env var for multiple domains support
- Update config.go with CORSOrigins field and getEnvStringSlice helper
- Rewrite CORS middleware with CORSWithConfig for dynamic origins
- Update server.go to use configurable CORS
- Update .env.example with all configuration variables
- Optimize Dockerfile: switch to distroless image, update port to 8214
2025-12-19 17:34:30 -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
4037ab6876 feat(backend): add root endpoint and update port to 8214
- Add GET / endpoint with SaveInMed API info
- Update PORT from 8080 to 8214 in .env.example
- Add start.sh interactive development script
- Script auto-installs dependencies when needed
2025-12-18 10:37:46 -03:00
Tiago Yamamoto
fc4e3df02d feat: implement CORS and externalize payments config 2025-12-18 08:07:45 -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