Commit graph

34 commits

Author SHA1 Message Date
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
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
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
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
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
baa60c0d9b feat: overhaul shipping module, add seeder, and improve order UI 2025-12-23 18:23:32 -03:00
Tiago Yamamoto
607d942072 feat: implement 2-step product registration with new catalog fields
Backend:
- Add ean_code, manufacturer, category, subcategory, observations to Product model
- Create migration 0006_product_catalog_fields.sql
- Update repository queries (CreateProduct, ListProducts, ListRecords)

Frontend:
- Create ProductCreate.tsx with 2-step wizard form
- Add route /products/new
- Add 'Cadastrar Produto' button to Inventory page

Seeder:
- Update CREATE TABLE products with new columns
- Update generateProducts with EAN codes and manufacturers

Docs:
- Update database-schema.md with new fields
2025-12-23 17:09:38 -03:00
Tiago Yamamoto
8d4731268e feat(marketplace): add company management and user editing features
Backend:
- Add phone, operating_hours, is_24_hours fields to Tenant model
- Create migration 0005_tenants_operating_hours.sql for new columns
- Update postgres repository queries for new fields

Frontend Company.tsx:
- Expand company edit form with phone, city, state
- Add operating hours section with 24h toggle
- Add user edit/delete buttons with Actions column
- Add user edit modal with name, email, role fields
- Add handleDeleteUser and handleSaveUser functions
2025-12-23 16:44:51 -03:00
Tiago Yamamoto
abf636ab65 fix(backend): handle NULL shipping fields in orders queries with COALESCE 2025-12-22 15:50:02 -03:00
Tiago Yamamoto
2a602ab09e fix(backend): use pq.Array for PostgreSQL array syntax in dashboard queries 2025-12-22 15:27:30 -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
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
b72f8f3099 Add full auth endpoints and swagger updates 2025-12-21 22:37:54 -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
4ad6a0aae5 Add marketplace record search and audit trigger 2025-12-21 17:36:17 -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
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
aaa4955fd9 Add full CRUD coverage to core API routes 2025-12-19 18:09:25 -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
029fce39ce fix: update db tests with proper env loading 2025-12-18 08:20:19 -03:00
Tiago Yamamoto
0e5c93ec6c feat: add automated db tests and update env examples 2025-12-18 08:13:19 -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