Add an admin command for listing newsletter emails
This commit is contained in:
parent
86b87b2ec8
commit
4b26a92018
|
@ -620,5 +620,20 @@ func init() {
|
||||||
}
|
}
|
||||||
adminCommand.AddCommand(uploadAsset)
|
adminCommand.AddCommand(uploadAsset)
|
||||||
|
|
||||||
|
adminCommand.AddCommand(&cobra.Command{
|
||||||
|
Use: "newsletteremails",
|
||||||
|
Short: "Print a list of all newsletter email receipients",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
ctx := context.Background()
|
||||||
|
conn := db.NewConn()
|
||||||
|
defer conn.Close(ctx)
|
||||||
|
|
||||||
|
recipients := utils.Must1(db.Query[models.NewsletterEmail](ctx, conn, `SELECT $columns FROM newsletter_emails`))
|
||||||
|
for _, r := range recipients {
|
||||||
|
fmt.Println(r.Email)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
addProjectCommands(adminCommand)
|
addProjectCommands(adminCommand)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package models
|
||||||
|
|
||||||
|
type NewsletterEmail struct {
|
||||||
|
Email string `db:"email"`
|
||||||
|
}
|
Loading…
Reference in New Issue