diff --git a/install.go b/install.go index e24483b..d69aa5c 100644 --- a/install.go +++ b/install.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "strings" + "time" "github.com/jmoiron/sqlx" "github.com/knadh/goyesql" @@ -57,9 +58,9 @@ func install(app *App, qMap goyesql.Queries) { // Sample subscriber. if _, err := q.UpsertSubscriber.Exec( uuid.NewV4(), - "test@test.com", - "Test Subscriber", - `{"type": "known", "good": true}`, + "john@example.com", + "John Doe", + `{"type": "known", "good": true, "city": "Bengaluru"}`, pq.Int64Array{int64(listID)}, ); err != nil { logger.Fatalf("Error creating subscriber: %v", err) @@ -76,10 +77,29 @@ func install(app *App, qMap goyesql.Queries) { "Default template", string(tplBody), ); err != nil { - logger.Fatalf("Error creating default template: %v", err) + logger.Fatalf("error creating default template: %v", err) } if _, err := q.SetDefaultTemplate.Exec(tplID); err != nil { - logger.Fatalf("Error setting default template: %v", err) + logger.Fatalf("error setting default template: %v", err) + } + + // Sample campaign. + sendAt := time.Now() + sendAt.Add(time.Minute * 43200) + if _, err := q.CreateCampaign.Exec(uuid.NewV4(), + "Test campaign", + "Welcome to listmonk", + "noreply@yoursite.com", + `