Commit graph

77 commits

Author SHA1 Message Date
Nycolas2005
079cbeceaa feat:adicionada regra de negocio de 12%, rotas corrigidas, teste de api bem sucedidos, marketplace operacional, produto cadastrando, seller não consegue ver seu proprio produto no marketplace, verificar pendencias_backend.md 2026-02-13 13:46:32 -03:00
Tiago Yamamoto
960880211b Hide fee details from help center 2026-02-07 09:00:37 -03:00
Tiago Yamamoto
78c7839e60 docs: add status sections to markdown files 2026-01-08 14:28:34 -03:00
Tiago Yamamoto
f913f6b3d4 Add backend middleware and frontend card tests 2026-01-01 15:49:17 -03:00
Tiago Yamamoto
b8599b4d08 Add tests for auth and theme contexts 2026-01-01 15:39:53 -03:00
Tiago Yamamoto
d3f1d0e36d docs: add b2b gaps roadmap and test matrix 2026-01-01 15:20:48 -03:00
Tiago Yamamoto
c48666bf60 Add backend and frontend test coverage 2026-01-01 15:06:55 -03:00
Tiago Yamamoto
93c6853d08 Update Dockerfiles and add website Dockerfile 2026-01-01 10:58:10 -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
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
89036d7b39 docs: add detailed mermaid diagrams for db, backend and marketplace 2025-12-27 01:13:11 -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
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
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
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
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
Tiago Yamamoto
73ad7296ca feat(web): redesign login page, fix search bug and enhance seeder 2025-12-23 18:34:46 -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
8a5ec57e9c feat: redesign Orders page with tabs for purchases/sales
- Add tabs: 'Pedidos Feitos' (compras) and 'Pedidos Recebidos' (vendas)
- Add stats bar with totals and pending count
- Add progress tracker for purchase orders
- Improved UI with icons and better styling
- Actions only visible on sales tab
2025-12-23 17:32:55 -03:00
Tiago Yamamoto
e39ed59264 fix: use ES module import for logo in Shell.tsx
- Import logoImg from assets instead of hardcoded path
- Fixes logo not displaying in production build
2025-12-23 17:25:00 -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
091e8093c0 feat: apply logo, document database schema, update docs
- Move logo to marketplace/src/assets/
- Apply logo in Shell.tsx header
- Add favicon and meta tags to index.html
- Create docs/database-schema.md with ER diagram
- Update README.md with database section
- Update marketplace/README.md with assets section
- Update seeder-api/README.md with new fields
2025-12-23 17:01:16 -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
352ef86617 fix(marketplace): filter own products by company_id from JWT
- Add companyId field to AuthUser interface in AuthContext
- Extract company_id from JWT payload in Login.tsx
- Use user.companyId to filter products where seller_id matches
- This properly excludes own store products using UUID comparison
2025-12-23 16:31:46 -03:00
Tiago Yamamoto
2bbb715ebb fix(marketplace): filter out own store products by 0km distance
- For owners/sellers, exclude products at exactly 0km (own pharmacy)
- This correctly hides own products without needing company_id in JWT
2025-12-23 16:29:08 -03:00
Tiago Yamamoto
e7b02f24e7 fix(marketplace): fix modal z-index and button colors
- Change modal z-index from z-50 to z-[1000] to appear above Leaflet map
- Replace bg-primary with bg-blue-600 for visible button styling
- Fix 'Adicionar' button in ProductOffersModal
- Fix 'Ver ofertas' button in GroupedProductCard
2025-12-23 16:23:59 -03:00
Tiago Yamamoto
8ec820c383 feat(marketplace): add cart hover dropdown preview
- Add CartDropdownContent component showing cart items on hover
- Show 'carrinho vazio' message when empty
- Display up to 4 items with name, quantity, price
- Add remove button for each item in dropdown
- Show total and 'Ver carrinho completo' link
- Badge only shows when cart has items (already implemented)
2025-12-23 16:21:48 -03:00
Tiago Yamamoto
299001d8bc feat(marketplace): add functional sort dropdown to ProductSearch
- Add sortBy state with options: price, distance, expiry
- Replace static text with interactive select dropdown
- Implement sorting logic for each option in groupedProducts memo
2025-12-23 16:19:47 -03:00
Tiago Yamamoto
1600591f86 feat(marketplace): improve ProductSearch with grouping, modal, and filters
- Add Shell layout to restore header navigation
- Filter out products from logged-in user's own pharmacy
- Group medications by name (e.g., Losartana 50mg shows as 1 card with '3 offers')
- Create GroupedProductCard component with offer count badge
- Create ProductOffersModal with sorted offers and add-to-cart
- Implement advanced filters (price range, minimum expiry days)
- Add GroupedProduct interface to types
- Sort grouped products by lowest price
2025-12-23 16:13:19 -03:00
Tiago Yamamoto
3a618fa466 chore(marketplace): remove Checkout page and route
- Remove CheckoutPage import from App.tsx
- Remove /checkout route from routing configuration
2025-12-23 16:04:46 -03:00
Tiago Yamamoto
cad6010965 feat(marketplace): replace cart text with icon + badge counter
- Remove Checkout link from header navigation
- Replace 'Carrinho' text with cart SVG icon
- Add red badge showing cart item count (max 99+)
- Import and use cartStore for real-time count updates
2025-12-23 16:01:54 -03:00
Tiago Yamamoto
77d23dac7e feat(marketplace): enable ProductSearch page for pharmacy owners and employees
- Add ProductSearch route at /search with access for owner, seller, employee roles
- Add 'Comprar Medicamentos' button to SellerDashboard header
- Add 'Comprar Medicamentos' button and card to EmployeeDashboard
- Remove redirect that was blocking access to the product search page
2025-12-23 15:59:51 -03:00
Tiago Yamamoto
32f6fde529 Fix shipping settings validation 2025-12-23 15:08:46 -03:00
Tiago Yamamoto
36c0742735 Add company tabs for users and shipping settings 2025-12-23 14:30:55 -03:00
Tiago Yamamoto
51b6165f09 Add cart empty state 2025-12-23 12:03:47 -03:00
Tiago Yamamoto
6a66503b48 Update profile dropdown in marketplace shell 2025-12-23 11:48:54 -03:00
Tiago Yamamoto
49d8878706 Add owner profile link and page 2025-12-23 09:21:38 -03:00
Tiago Yamamoto
20980d8a80 Add profile dropdown to marketplace header 2025-12-23 08:12:54 -03:00
Tiago Yamamoto
95913578e9 Add profile dropdown to marketplace header 2025-12-23 08:05:51 -03:00
Tiago Yamamoto
54d0de2844 Gate marketplace logs behind logger 2025-12-22 17:52:05 -03:00
Tiago Yamamoto
6477eeb756 fix(marketplace): handle paginated API response in Orders and Inventory pages 2025-12-22 16:39:30 -03:00
Tiago Yamamoto
965cedca05 fix(marketplace): add centralized formatCurrency/formatCents utilities to prevent toFixed errors 2025-12-22 16:31:39 -03:00
Tiago Yamamoto
5c004422f2 feat(marketplace): fix R$ NaN and add owner navigation links 2025-12-22 15:42:58 -03:00
Tiago Yamamoto
940e6561f4 feat(marketplace): add password visibility toggle with eye icon on login page 2025-12-22 15:10:29 -03:00
Tiago Yamamoto
9e0601179e fix(marketplace): install dependencies and resolve vite/client type error 2025-12-22 14:55:12 -03:00