models

package
v0.0.0-...-df3b144 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID         bson.ObjectId `bson:"_id"`
	UserID     bson.ObjectId `bson:"user_id"`
	PostID     bson.ObjectId `bson:"post_id"`
	Title      string        `bson:"title"`
	Body       string        `bson:"body"`
	CreatedAt  time.Time     `bson:"created_at"`
	UpdatedAt  time.Time     `bson:"updated_at"`
	Favourites int64         `bson:"favourites"`
}

type Post

type Post struct {
	ID         bson.ObjectId `bson:"_id"`
	Title      string        `bson:"title"`
	Body       string        `bson:"body"`
	Categories []string      `bson:"categories"`
	Tags       []string      `bson:"tags"`
	UserID     bson.ObjectId `bson:"user_id"`
	CreatedAt  time.Time     `bson:"created_at"`
	UpdatedAt  time.Time     `bson:"updated_at"`
	Status     Status        `bson:"status"`
	Views      int64         `bson:"views"`
	Favourites int64         `bson:"favourites"`
}

func (*Post) ToPostStatus

func (p *Post) ToPostStatus(status string) Status

func (*Post) ValidateStatus

func (p *Post) ValidateStatus(newStatus string) bool

type Session

type Session struct {
	ID           bson.ObjectId `bson:"_id"`
	UserID       bson.ObjectId `bson:"user_id"`
	AccessToken  string        `bson:"access_token"`
	RefreshToken string        `bson:"refresh_token"`
	CreatedAt    time.Time     `bson:"created_at"`
	ExpiredAt    time.Time     `bson:"updated_at"`
}

type Status

type Status string
const (
	PostStatusSaved     Status = "saved"
	PostStatusPublished Status = "published"
)

type User

type User struct {
	ID         bson.ObjectId `bson:"_id"`
	Name       string        `bson:"name"`
	Username   string        `bson:"username"`
	Email      string        `bson:"email"`
	Password   string        `bson:"password"`
	Details    string        `bson:"details"`
	UserType   UserType      `bson:"user_type"`
	UserStatus UserStatus    `bson:"user_status"`
	CreatedAt  time.Time     `bson:"created_at"`
	UpdatedAt  time.Time     `bson:"updated_at"`
}

type UserStatus

type UserStatus string
const (
	UserStatusRegistered UserStatus = "registered"
	UserStatusVerified   UserStatus = "verified"
	UserStatusBlocked    UserStatus = "blocked"
)

type UserType

type UserType string
const (
	UserTypeParent UserType = "parent"
	UserTypeFamily UserType = "family"
	UserTypeGhost  UserType = "ghost"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL