mirror of
https://github.com/hanzoai/marketing.git
synced 2026-10-17 11:18:15 +00:00
The web app for /v1/marketing on api.hanzo.ai (audiences, drip sequences and their steps, enrollments, campaigns, the send calendar, promos and opt-outs) and the small Go service beside it. Earlier history is kept privately in hanzoai/marketing-v1. Co-authored-by: Hanzo Dev <[email protected]>
63 lines
2.0 KiB
Go
63 lines
2.0 KiB
Go
package model
|
|
|
|
import (
|
|
"github.com/hanzoai/commerce/datastore"
|
|
"github.com/hanzoai/commerce/models/mixin"
|
|
"github.com/hanzoai/commerce/util/category"
|
|
"github.com/hanzoai/commerce/util/fake"
|
|
"github.com/hanzoai/commerce/util/slug"
|
|
"github.com/hanzoai/orm"
|
|
)
|
|
|
|
func init() { orm.Register[Campaign]("campaign") }
|
|
|
|
type Campaign struct {
|
|
mixin.Model[Campaign]
|
|
|
|
Slug string `json:"slug"`
|
|
|
|
OrganizationId string `json:"organizationId"`
|
|
Approved bool `json:"approved"`
|
|
Enabled bool `json:"enabled"`
|
|
Category category.Category `json:"category"`
|
|
Title string `json:"title"`
|
|
Tagline string `json:"tagline"`
|
|
PitchMedia string `json:"pitchMedia"`
|
|
VideoUrl string `json:"videoUrl"`
|
|
VideoOverlayUrl string `json:"videoOverlayUrl"`
|
|
ImageUrl string `json:"imageUrl"`
|
|
Description string `json:"Description"`
|
|
Backers int `json:"backers"`
|
|
Raised int64 `json:"raised"`
|
|
Thumbnail string `json:"thumbnail"`
|
|
OriginalUrl string `json:"originalUrl"`
|
|
StoreUrl string `json:"storeUrl"`
|
|
ProductIds []string `datastore:"-" json:"productIds" orm:"default:[]"`
|
|
|
|
GoogleAnalytics string `json:"googleAnalytics"`
|
|
FacebookTag string `json:"facebookTag"`
|
|
Links []string `json:"links" orm:"default:[]"`
|
|
}
|
|
|
|
func NewCampaign(db *datastore.Datastore) *Campaign {
|
|
c := new(Campaign)
|
|
c.Init(db)
|
|
return c
|
|
}
|
|
|
|
func QueryCampaign(db *datastore.Datastore) datastore.Query {
|
|
return db.Query("campaign")
|
|
}
|
|
|
|
func FakeCampaign(db *datastore.Datastore, organizationId string) *Campaign {
|
|
c := NewCampaign(db)
|
|
c.Title = fake.Words(3)
|
|
c.Slug = slug.Slugify(c.Title)
|
|
c.Approved = true
|
|
c.Enabled = true
|
|
c.OrganizationId = organizationId
|
|
c.Tagline = fake.Sentence()
|
|
c.Description = fake.Sentences(4)
|
|
return c
|
|
}
|