Commit graph

17 commits

Author SHA1 Message Date
Tiago Yamamoto
8588d07388 Add config helper tests 2026-01-01 15:43:33 -03:00
Tiago Yamamoto
f7967490e7 test: expand config coverage 2026-01-01 11:46: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
35495b4728 fix(backend): properly load .env file manually in config.go 2025-12-22 09:47:17 -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
276b6bb923 refactor(backend): rename SWAGGER_HOST to BACKEND_HOST
Renames SWAGGER_HOST to BACKEND_HOST in .env.example and config. Updates main.go to use the new configuration variable.
2025-12-21 22:21:37 -03:00
Tiago Yamamoto
73ebe3ec6d Add swagger host/scheme env config 2025-12-21 22:16:11 -03:00
Tiago Yamamoto
e73d423b16 refactor: move seeder to api, improve coverage and security 2025-12-20 11:13:53 -03:00
Tiago Yamamoto
25cee3911c chore: refactor backend config, unignore .env, update config loading 2025-12-20 10:10:55 -03:00
Tiago Yamamoto
b8973739ab feat(backend): add comprehensive test suite for 80% coverage
- Add config_test.go (5 tests for env parsing)
- Add middleware_test.go (16 tests for CORS, Auth, Gzip, Logger)
- Add usecase_test.go (30+ tests for business logic)
- Add payments_test.go (6 tests for MercadoPago gateway)

Coverage: config 100%, middleware 95.9%, payments 100%, usecase 64.7%

feat(marketplace): add test framework and new pages

- Setup Vitest with jsdom environment
- Add cartStore.test.ts (15 tests for Zustand store)
- Add usePersistentFilters.test.ts (5 tests for hook)
- Add apiClient.test.ts (7 tests for axios client)
- Add Orders page with status transitions
- Add Inventory page with stock adjustments
- Add Company page with edit functionality
- Add SellerDashboard page with KPIs

Total marketplace tests: 27 passing
2025-12-20 07:43:56 -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
e57445847b Implement JWT auth and company verification 2025-12-18 12:29:51 -03:00
Tiago Yamamoto
521c7f1377 fix(backend): update default port to 8214 and fix env loading 2025-12-18 10:39:42 -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