From b6eb040045fcfeb39dda4fcd440d2be184c8e715 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 29 Oct 2016 01:33:33 -0700 Subject: adding db/analytics init back in after reverting for debug --- system/api/analytics/init.go | 6 ++---- system/api/external.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'system/api') diff --git a/system/api/analytics/init.go b/system/api/analytics/init.go index c04a7f2..c351bed 100644 --- a/system/api/analytics/init.go +++ b/system/api/analytics/init.go @@ -4,7 +4,6 @@ package analytics import ( - "fmt" "log" "net/http" "strings" @@ -55,13 +54,12 @@ func Close() { // Init creates a db connection, should run an initial prune of old data, and // sets up the queue/batching channel func Init() { - store, err := bolt.Open("analytics.db", 0666, nil) + var err error + store, err = bolt.Open("analytics.db", 0666, nil) if err != nil { log.Fatalln(err) } - fmt.Println("analytics", store) - recordChan = make(chan apiRequest, 1024*128) go serve() diff --git a/system/api/external.go b/system/api/external.go index 0da7eac..a65618b 100644 --- a/system/api/external.go +++ b/system/api/external.go @@ -8,12 +8,21 @@ import ( "github.com/bosssauce/ponzu/system/db" ) -// Externalable accepts or rejects external POST requests to /external/posts?type=Review +// Externalable accepts or rejects external POST requests to endpoints such as: +// /external/posts?type=Review type Externalable interface { // Accepts determines whether a type will allow external submissions Accepts() bool } +// Mergeable allows external post content to be approved and published through +// the public-facing API +type Mergeable interface { + // Approve copies an external post to the internal collection and triggers + // a re-sort of its content type posts + Approve() error +} + func externalPostsHandler(res http.ResponseWriter, req *http.Request) { if req.Method != http.MethodPost { res.WriteHeader(http.StatusMethodNotAllowed) -- cgit v1.2.3