Tweak default list and subscriber entries in install
This commit is contained in:
parent
8616aa8028
commit
6cb2cd7ea2
1 changed files with 26 additions and 4 deletions
30
install.go
30
install.go
|
@ -49,24 +49,45 @@ func install(app *App, qMap goyesql.Queries, prompt bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sample list.
|
// Sample list.
|
||||||
var listID int
|
var (
|
||||||
if err := q.CreateList.Get(&listID,
|
defList int
|
||||||
|
optinList int
|
||||||
|
)
|
||||||
|
if err := q.CreateList.Get(&defList,
|
||||||
uuid.NewV4().String(),
|
uuid.NewV4().String(),
|
||||||
"Default list",
|
"Default list",
|
||||||
models.ListTypePublic,
|
models.ListTypePrivate,
|
||||||
models.ListOptinSingle,
|
models.ListOptinSingle,
|
||||||
pq.StringArray{"test"},
|
pq.StringArray{"test"},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
logger.Fatalf("Error creating list: %v", err)
|
logger.Fatalf("Error creating list: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := q.CreateList.Get(&optinList, uuid.NewV4().String(),
|
||||||
|
"Opt-in list",
|
||||||
|
models.ListTypePublic,
|
||||||
|
models.ListOptinDouble,
|
||||||
|
pq.StringArray{"test"},
|
||||||
|
); err != nil {
|
||||||
|
logger.Fatalf("Error creating list: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Sample subscriber.
|
// Sample subscriber.
|
||||||
if _, err := q.UpsertSubscriber.Exec(
|
if _, err := q.UpsertSubscriber.Exec(
|
||||||
uuid.NewV4(),
|
uuid.NewV4(),
|
||||||
"john@example.com",
|
"john@example.com",
|
||||||
"John Doe",
|
"John Doe",
|
||||||
`{"type": "known", "good": true, "city": "Bengaluru"}`,
|
`{"type": "known", "good": true, "city": "Bengaluru"}`,
|
||||||
pq.Int64Array{int64(listID)},
|
pq.Int64Array{int64(defList)},
|
||||||
|
); err != nil {
|
||||||
|
logger.Fatalf("Error creating subscriber: %v", err)
|
||||||
|
}
|
||||||
|
if _, err := q.UpsertSubscriber.Exec(
|
||||||
|
uuid.NewV4(),
|
||||||
|
"anon@example.com",
|
||||||
|
"Anon Doe",
|
||||||
|
`{"type": "unknown", "good": true, "city": "Bengaluru"}`,
|
||||||
|
pq.Int64Array{int64(optinList)},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
logger.Fatalf("Error creating subscriber: %v", err)
|
logger.Fatalf("Error creating subscriber: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -92,6 +113,7 @@ func install(app *App, qMap goyesql.Queries, prompt bool) {
|
||||||
sendAt := time.Now()
|
sendAt := time.Now()
|
||||||
sendAt.Add(time.Minute * 43200)
|
sendAt.Add(time.Minute * 43200)
|
||||||
if _, err := q.CreateCampaign.Exec(uuid.NewV4(),
|
if _, err := q.CreateCampaign.Exec(uuid.NewV4(),
|
||||||
|
models.CampaignTypeRegular,
|
||||||
"Test campaign",
|
"Test campaign",
|
||||||
"Welcome to listmonk",
|
"Welcome to listmonk",
|
||||||
"No Reply <noreply@yoursite.com>",
|
"No Reply <noreply@yoursite.com>",
|
||||||
|
|
Loading…
Reference in a new issue