diff options
Diffstat (limited to 'system/db')
-rw-r--r-- | system/db/content.go | 16 | ||||
-rw-r--r-- | system/db/init.go | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/system/db/content.go b/system/db/content.go index 3293ff4..535b601 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/bosssauce/ponzu/content" + "github.com/bosssauce/ponzu/system/item" "github.com/boltdb/bolt" "github.com/gorilla/schema" @@ -418,7 +418,7 @@ func SortContent(namespace string) { // decode each (json) into type to then sort for i := range all { j := all[i] - post := content.Types[namespace]() + post := item.Types[namespace]() err := json.Unmarshal(j, &post) if err != nil { @@ -426,7 +426,7 @@ func SortContent(namespace string) { return } - posts = append(posts, post.(content.Sortable)) + posts = append(posts, post.(item.Sortable)) } // sort posts @@ -467,7 +467,7 @@ func SortContent(namespace string) { } -type sortableContent []content.Sortable +type sortableContent []item.Sortable func (s sortableContent) Len() int { return len(s) @@ -483,9 +483,9 @@ func (s sortableContent) Swap(i, j int) { func postToJSON(ns string, data url.Values) ([]byte, error) { // find the content type and decode values into it - t, ok := content.Types[ns] + t, ok := item.Types[ns] if !ok { - return nil, fmt.Errorf(content.ErrTypeNotRegistered, ns) + return nil, fmt.Errorf(item.ErrTypeNotRegistered, ns) } post := t() @@ -500,7 +500,7 @@ func postToJSON(ns string, data url.Values) ([]byte, error) { // if the content has no slug, and has no specifier, create a slug, check it // for duplicates, and add it to our values if data.Get("slug") == "" && data.Get("__specifier") == "" { - slug, err := content.Slug(post.(content.Identifiable)) + slug, err := item.Slug(post.(item.Identifiable)) if err != nil { return nil, err } @@ -510,7 +510,7 @@ func postToJSON(ns string, data url.Values) ([]byte, error) { return nil, err } - post.(content.Sluggable).SetSlug(slug) + post.(item.Sluggable).SetSlug(slug) data.Set("slug", slug) } diff --git a/system/db/init.go b/system/db/init.go index fa2c42e..9a0c3e5 100644 --- a/system/db/init.go +++ b/system/db/init.go @@ -4,8 +4,8 @@ import ( "encoding/json" "log" - "github.com/bosssauce/ponzu/content" "github.com/bosssauce/ponzu/system/admin/config" + "github.com/bosssauce/ponzu/system/item" "github.com/boltdb/bolt" "github.com/nilslice/jwt" @@ -32,7 +32,7 @@ func Init() { err = store.Update(func(tx *bolt.Tx) error { // initialize db with all content type buckets & sorted bucket for type - for t := range content.Types { + for t := range item.Types { _, err := tx.CreateBucketIfNotExists([]byte(t)) if err != nil { return err @@ -86,7 +86,7 @@ func Init() { } go func() { - for t := range content.Types { + for t := range item.Types { SortContent(t) } }() |