saveinmed/backend/cmd/api/main.go
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

55 lines
1.2 KiB
Go

package main
import (
"context"
"log"
"os"
"os/signal"
"syscall"
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/saveinmed/backend-go/docs"
"github.com/saveinmed/backend-go/internal/config"
"github.com/saveinmed/backend-go/internal/server"
)
// @title SaveInMed Performance Core API
// @version 1.0
// @description API REST B2B para marketplace farmacêutico com split de pagamento e rastreabilidade.
// @BasePath /
// @Schemes http
// @contact.name Engenharia SaveInMed
// @contact.email devops@saveinmed.com
// @securityDefinitions.apikey BearerAuth
// @in header
// @name Authorization
func main() {
cfg, err := config.Load()
if err != nil {
log.Fatalf("failed to load config: %v", err)
}
// swagger metadata overrides
docs.SwaggerInfo.Title = cfg.AppName
docs.SwaggerInfo.BasePath = "/"
if cfg.BackendHost != "" {
docs.SwaggerInfo.Host = cfg.BackendHost
}
if len(cfg.SwaggerSchemes) > 0 {
docs.SwaggerInfo.Schemes = cfg.SwaggerSchemes
}
srv, err := server.New(*cfg)
if err != nil {
log.Fatalf("boot failure: %v", err)
}
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
if err := srv.Start(ctx); err != nil {
log.Printf("server stopped: %v", err)
os.Exit(1)
}
}