diff --git a/seeder-api/pkg/seeder/seeder.go b/seeder-api/pkg/seeder/seeder.go index 8e37fe0..8d90453 100644 --- a/seeder-api/pkg/seeder/seeder.go +++ b/seeder-api/pkg/seeder/seeder.go @@ -112,6 +112,9 @@ func SeedLean(dsn string) (string, error) { longitude DOUBLE PRECISION NOT NULL DEFAULT 0, city TEXT NOT NULL DEFAULT '', state TEXT NOT NULL DEFAULT '', + phone TEXT NOT NULL DEFAULT '', + operating_hours TEXT NOT NULL DEFAULT '', + is_24_hours BOOLEAN NOT NULL DEFAULT FALSE, created_at TIMESTAMPTZ NOT NULL, updated_at TIMESTAMPTZ NOT NULL )`) @@ -260,9 +263,9 @@ func SeedLean(dsn string) (string, error) { // 1. Create Company companyID := uuid.Must(uuid.NewV7()) _, err = db.ExecContext(ctx, ` - INSERT INTO companies (id, cnpj, corporate_name, category, license_number, is_verified, latitude, longitude, city, state, created_at, updated_at) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, - companyID, ph.CNPJ, ph.Name, "farmacia", fmt.Sprintf("CRF-GO-%s", ph.Suffix), true, ph.Lat, ph.Lng, "Anápolis", "GO", now, now, + INSERT INTO companies (id, cnpj, corporate_name, category, license_number, is_verified, latitude, longitude, city, state, phone, operating_hours, is_24_hours, created_at, updated_at) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)`, + companyID, ph.CNPJ, ph.Name, "farmacia", fmt.Sprintf("CRF-GO-%s", ph.Suffix), true, ph.Lat, ph.Lng, "Anápolis", "GO", "(62) 99999-00"+ph.Suffix, "Seg-Sex: 08:00-18:00, Sáb: 08:00-12:00", false, now, now, ) if err != nil { return "", fmt.Errorf("create library %s: %v", ph.Name, err) @@ -454,6 +457,9 @@ func SeedFull(dsn string) (string, error) { longitude DOUBLE PRECISION NOT NULL DEFAULT 0, city TEXT NOT NULL DEFAULT '', state TEXT NOT NULL DEFAULT '', + phone TEXT NOT NULL DEFAULT '', + operating_hours TEXT NOT NULL DEFAULT '', + is_24_hours BOOLEAN NOT NULL DEFAULT FALSE, created_at TIMESTAMPTZ NOT NULL, updated_at TIMESTAMPTZ NOT NULL )`) @@ -491,8 +497,8 @@ func SeedFull(dsn string) (string, error) { // Insert tenants for _, t := range tenants { _, err := db.NamedExecContext(ctx, ` - INSERT INTO companies (id, cnpj, corporate_name, category, license_number, is_verified, latitude, longitude, city, state, created_at, updated_at) - VALUES (:id, :cnpj, :corporate_name, :category, :license_number, :is_verified, :latitude, :longitude, :city, :state, :created_at, :updated_at) + INSERT INTO companies (id, cnpj, corporate_name, category, license_number, is_verified, latitude, longitude, city, state, phone, operating_hours, is_24_hours, created_at, updated_at) + VALUES (:id, :cnpj, :corporate_name, :category, :license_number, :is_verified, :latitude, :longitude, :city, :state, :phone, :operating_hours, :is_24_hours, :created_at, :updated_at) ON CONFLICT (cnpj) DO NOTHING`, t) if err != nil { log.Printf("insert tenant %s: %v", t["corporate_name"], err) @@ -563,18 +569,21 @@ func generateTenants(rng *rand.Rand, count int) []map[string]interface{} { lngOffset := (rng.Float64() - 0.5) * 0.09 tenants = append(tenants, map[string]interface{}{ - "id": id, - "cnpj": cnpj, - "corporate_name": name, - "category": "farmacia", - "license_number": fmt.Sprintf("CRF-GO-%05d", rng.Intn(99999)), - "is_verified": rng.Float32() > 0.3, // 70% verified - "latitude": AnapolisLat + latOffset, - "longitude": AnapolisLng + lngOffset, - "city": "Anápolis", - "state": "GO", - "created_at": now, - "updated_at": now, + "id": id, + "cnpj": cnpj, + "corporate_name": name, + "category": "farmacia", + "license_number": fmt.Sprintf("CRF-GO-%05d", rng.Intn(99999)), + "is_verified": rng.Float32() > 0.3, // 70% verified + "latitude": AnapolisLat + latOffset, + "longitude": AnapolisLng + lngOffset, + "city": "Anápolis", + "state": "GO", + "phone": fmt.Sprintf("(62) 9%04d-%04d", rng.Intn(9999), rng.Intn(9999)), + "operating_hours": "Seg-Sex: 08:00-18:00", + "is_24_hours": rng.Float32() < 0.1, // 10% are 24h + "created_at": now, + "updated_at": now, }) } return tenants