/
post.go
34 lines (29 loc) · 1.25 KB
/
post.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package model
import (
"gopkg.in/mgo.v2/bson"
)
const (
// PostCollection holds the name of the post collection
PostCollection = "posts"
)
// Post model
type Post struct {
ID bson.ObjectId `json:"id,omitempty" bson:"id,omitempty"`
Date int64 `json:"date,omitempty" bson:"date"`
Path string `json:"path" binding:"required" bson:"path"`
Title string `json:"title" binding:"required" bson:"title"`
AuthorID string `json:"authorId" bson:"authorId"`
Author string `json:"author" bson:"author"`
Tags string `json:"tags" bson:"tags"`
Desc string `json:"desc" bson:"desc"`
Hero string `json:"hero" binding:"required" bson:"hero"`
Thumb string `json:"thumb" binding:"required" bson:"thumb"`
Body string `json:"body" bson:"body"`
Audience string `json:"audience" bson:"audience"`
Weight int `json:"weight,omitempty" bson:"weight"`
CreatedOn int64 `json:"createdOn,omitempty" bson:"createdOn"`
UpdatedOn int64 `json:"updatedOn,omitempty" bson:"updatedOn"`
UpdatedBy string `json:"updatedBy" bson:"updatedBy"`
// Convenience fields to communicate with the front end. Not persisted.
CommentCount int `json:"commentCount" bson:"-"`
}