- 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>
41 lines
981 B
Go
41 lines
981 B
Go
package main
|
|
|
|
import (
|
|
"database/sql"
|
|
"fmt"
|
|
"log"
|
|
|
|
_ "github.com/jackc/pgx/v5/stdlib"
|
|
)
|
|
|
|
const dbURL = "postgres://postgres:123@localhost:55432/saveinmed?sslmode=disable"
|
|
|
|
func main() {
|
|
db, err := sql.Open("pgx", dbURL)
|
|
if err != nil {
|
|
log.Fatalf("Failed to connect: %v", err)
|
|
}
|
|
defer db.Close()
|
|
|
|
ids := []string{
|
|
"019c04e1-65ab-7cb5-8ad3-d0297edd9094", // catalogo_id from log
|
|
"019c04e6-71a9-7a4e-a84c-3f887478cae8", // id from log
|
|
}
|
|
|
|
for _, id := range ids {
|
|
var exists bool
|
|
var name, sellerID string
|
|
err = db.QueryRow("SELECT EXISTS(SELECT 1 FROM products WHERE id = $1)", id).Scan(&exists)
|
|
if err != nil {
|
|
log.Printf("Error checking product %s: %v", id, err)
|
|
continue
|
|
}
|
|
|
|
if exists {
|
|
db.QueryRow("SELECT name, seller_id FROM products WHERE id = $1", id).Scan(&name, &sellerID)
|
|
fmt.Printf("Product ID %s FOUND. Name: %s, Seller: %s\n", id, name, sellerID)
|
|
} else {
|
|
fmt.Printf("Product ID %s NOT FOUND in 'products'.\n", id)
|
|
}
|
|
}
|
|
}
|