Skip to content

Commit 6cb2cd7

Browse files
committed
Tweak default list and subscriber entries in install
1 parent 8616aa8 commit 6cb2cd7

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

install.go

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,45 @@ func install(app *App, qMap goyesql.Queries, prompt bool) {
4949
}
5050

5151
// Sample list.
52-
var listID int
53-
if err := q.CreateList.Get(&listID,
52+
var (
53+
defList int
54+
optinList int
55+
)
56+
if err := q.CreateList.Get(&defList,
5457
uuid.NewV4().String(),
5558
"Default list",
56-
models.ListTypePublic,
59+
models.ListTypePrivate,
5760
models.ListOptinSingle,
5861
pq.StringArray{"test"},
5962
); err != nil {
6063
logger.Fatalf("Error creating list: %v", err)
6164
}
6265

66+
if err := q.CreateList.Get(&optinList, uuid.NewV4().String(),
67+
"Opt-in list",
68+
models.ListTypePublic,
69+
models.ListOptinDouble,
70+
pq.StringArray{"test"},
71+
); err != nil {
72+
logger.Fatalf("Error creating list: %v", err)
73+
}
74+
6375
// Sample subscriber.
6476
if _, err := q.UpsertSubscriber.Exec(
6577
uuid.NewV4(),
6678
"john@example.com",
6779
"John Doe",
6880
`{"type": "known", "good": true, "city": "Bengaluru"}`,
69-
pq.Int64Array{int64(listID)},
81+
pq.Int64Array{int64(defList)},
82+
); err != nil {
83+
logger.Fatalf("Error creating subscriber: %v", err)
84+
}
85+
if _, err := q.UpsertSubscriber.Exec(
86+
uuid.NewV4(),
87+
"anon@example.com",
88+
"Anon Doe",
89+
`{"type": "unknown", "good": true, "city": "Bengaluru"}`,
90+
pq.Int64Array{int64(optinList)},
7091
); err != nil {
7192
logger.Fatalf("Error creating subscriber: %v", err)
7293
}
@@ -92,6 +113,7 @@ func install(app *App, qMap goyesql.Queries, prompt bool) {
92113
sendAt := time.Now()
93114
sendAt.Add(time.Minute * 43200)
94115
if _, err := q.CreateCampaign.Exec(uuid.NewV4(),
116+
models.CampaignTypeRegular,
95117
"Test campaign",
96118
"Welcome to listmonk",
97119
"No Reply <noreply@yoursite.com>",

0 commit comments

Comments
 (0)