models

package
v0.0.0-...-7f22e17 Latest Latest
Warning

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

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

Documentation

Overview

group.go -- each group gets its own collection, this is just how we resolve permissions

notification.go -- each group gets its own collection, this is just how we resolve permissions

post.go -- models for post operations

thread.go -- models for thread operations

user.go -- models for user operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthUser

type AuthUser struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type AuthedUser

type AuthedUser struct {
	Token string `json:"token"`
}

type ChangePW

type ChangePW struct {
	Password    string `json:"password"`
	NewPassword string `json:"newPassword"`
}

type CreateGroup

type CreateGroup struct {
	Private bool   `json:"anonymous"`
	Group   string `json:"group"`
}

type CreateUser

type CreateUser struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type DeletePost

type DeletePost struct {
	Post string `json:"post"`
	Id   string `json:"id,omitempty"`
}

type EditPost

type EditPost struct {
	Body string `json:"body"`
	Post string `json:"post"`
	Id   string `json:"id,omitempty"`
}

type Friend

type Friend struct {
	Username string `json:"username"`
	Friend   string `json:"friend"`
}

type GetFriends

type GetFriends struct {
	Friends []string `json:"friends"`
}

type GetGroup

type GetGroup struct {
	Page  int    `json:"page"`
	Group string `json:"group"`
}

type GetNotifications

type GetNotifications struct {
	Notifications []Notification `json:"notifications"`
}

JSON Handling

type GetPop

type GetPop struct {
	Skip int `json:"skip"`
}

type GetThread

type GetThread struct {
	Thread string `json:"thread"`
}

type GetUser

type GetUser struct {
	Username  string          `bson:"username" json:"username"`
	Email     string          `bson:"email" json:"email"`
	Unread    int             `bson:"unread" json:"unread"`
	Usernames []string        `bson:"usernames" json:"usernames"`
	Saved     []bson.ObjectId `bson:"saved" json:"-"`
	SavedStr  []string        `bson:"-" json:"saved"`
}

type GetUserFeed

type GetUserFeed struct {
	Page int `json:"page"`
}

type Group

type Group struct {
	Id      bson.ObjectId   `bson:"_id,omitempty"`
	Created time.Time       `bson:"created"`
	Name    string          `bson:"name"`
	Author  bson.ObjectId   `bson:"author"`
	Admins  []bson.ObjectId `bson:"admins"`
	Private bool            `bson:"private"`
}

type GroupAdmin

type GroupAdmin struct {
	User  string `json:"user"`
	Group string `json:"group"`
}

type GroupInfo

type GroupInfo struct {
	Created time.Time `json:"created"`
	Name    string    `json:"name"`
	Author  string    `json:"author"`
	Private bool      `bson:"private"`
}

type Grp

type Grp struct {
	Group string `json:"group"`
}

type Mthread

type Mthread struct {
	Id       bson.ObjectId `bson:"_id,omitempty" json:"-"`
	SId      string        `bson:"id" json:"id"`
	Created  time.Time     `bson:"created" json:"created"`
	Thread   bson.ObjectId `bson:"thread" json:"-"`
	ThreadId string        `bson:"threadId" json:"thread"`
	Head     *Post         `bson:"head" json:"head"`
	Group    string        `bson:"group" json:"group"`
	Size     int           `bson:"-" json:"size"`
}

For the Group View

type Name

type Name struct {
	Name string `json:"name"`
}

type NewPost

type NewPost struct {
	Body        string   `json:"body"`
	Content     string   `json:"content"`
	ContentType string   `json:"contentType"`
	Author      string   `json:"author"`
	ResponseTo  []string `json:"responseTo"`
	Anonymous   bool     `json:"anonymous"`
	Thread      string   `json:"thread"`
}

type NewThread

type NewThread struct {
	Group       string `json:"group"`
	Body        string `json:"body"`
	Author      string `json:"author"`
	Content     string `json:"content"`
	ContentType string `json:"contentType"`
	Anonymous   bool   `json:"anonymous"`
}

type Notification

type Notification struct {
	Id        bson.ObjectId `bson:"_id,omitempty" json:"-"`
	SId       string        `bson:"-" json:"id"`
	Recipient bson.ObjectId `bson:"recipient" json:"recipient"`
	Link      string        `bson:"link" json:"link"`
	Text      string        `bson:"text" json:"text"`
}

type Permission

type Permission struct {
	Allowed bool `json:"allowed"`
	Admin   bool `json:"admin"`
	Author  bool `json:"author"`
	Mod     bool `json:"mod, omitempty"`
}

type PopularPost

type PopularPost struct {
	Id          bson.ObjectId   `bson:"_id,omitempty" json:"-"`
	SId         string          `bson:"id,omitempty" json:"id"`
	Thread      bson.ObjectId   `bson:"thread,omitempty" json:"-"`
	ThreadId    string          `bson:"-" json:"thread"`
	Created     time.Time       `bson:"created" json:"created"`
	Author      string          `bson:"author" json:"author"`
	AuthorId    bson.ObjectId   `bson:"authorId,omitempty" json:"-"`
	Replies     []bson.ObjectId `bson:"replies" json:"replies"`
	ResponseTo  []bson.ObjectId `bson:"responseTo" json:"responseTo"`
	Content     string          `bson:"content,omitempty" json:"content"`
	ContentType string          `bson:"contentType,omitempty" json:"contentType"`
	Body        string          `bson:"body" json:"body"`
	Group       string          `bson:"-" json:"group"`
	Size        int             `bson:"-" json:"size"`
}

pretty much a post, just with a group and size field attached

type PopularPosts

type PopularPosts struct {
	Posts []PopularPost `json:"posts"`
}

type Post

type Post struct {
	Id          bson.ObjectId   `bson:"_id,omitempty" json:"-"`
	SId         string          `bson:"id,omitempty" json:"id"`
	Thread      bson.ObjectId   `bson:"thread,omitempty" json:"-"`
	Created     time.Time       `bson:"created" json:"created"`
	Author      string          `bson:"author" json:"author"`
	AuthorId    bson.ObjectId   `bson:"authorId,omitempty" json:"-"`
	Replies     []bson.ObjectId `bson:"replies" json:"replies"`
	ResponseTo  []bson.ObjectId `bson:"responseTo" json:"responseTo"`
	Content     string          `bson:"content,omitempty" json:"content"`
	ContentType string          `bson:"contentType,omitempty" json:"contentType"`
	Body        string          `bson:"body" json:"body"`
}

type Recovery

type Recovery struct {
	Email string `json:"email"`
}

type RemoveThread

type RemoveThread struct {
	Thread string `json:"thread"`
	Id     string `json:"id,omitempty"`
}

type ResThread

type ResThread struct {
	Id      bson.ObjectId `json:"-" bson:"_id,omitempty"`
	SId     string        `json:"id,omitempty" bson:"-"`
	Created time.Time     `json:"created" bson:"created"`
	Posts   []Post        `json:"posts" bson:"posts"`
	Alive   bool          `json:"-" bson:"alive"`
	Group   string        `json:"group" bson:"group"`
	Mthread string        `json:"mthread" bson:"-"`
}

type Saved

type Saved struct {
	Thread string `json:"thread"`
}
type Search struct {
	Text string `json:"text"`
	Page int    `json:"page,omitempty"`
}

type SearchUsers

type SearchUsers struct {
	Username string `bson:"username"`
}

type SendGroup

type SendGroup struct {
	Threads []Mthread `json:"threads"`
}

type SendGroupSearch

type SendGroupSearch struct {
	Groups []string `json:"groups"`
}

type SendPost

type SendPost struct {
	Id     string `json:"id"`
	PostId string `json:"postId"`
}

type SendUserSearch

type SendUserSearch struct {
	Usernames []string `json:"usernames"`
}

type Thread

type Thread struct {
	Id      bson.ObjectId   `bson:"_id,omitempty"`
	Created time.Time       `bson:"created"`
	Author  bson.ObjectId   `bson:"author"`
	Posts   []bson.ObjectId `bson:"posts"`
	Alive   bool            `bson:"alive"`
	Group   string          `bson:"group"`
	Mthread bson.ObjectId   `bson:"mthread"`
}

type ThreadLen

type ThreadLen struct {
	Length int `json:"size,omitempty"`
}

type User

type User struct {
	Id            bson.ObjectId   `bson:"_id,omitempty"`
	Created       time.Time       `bson:"created"`
	Username      string          `bson:"username"`
	Usernames     []string        `bson:"usernames"`
	Name          string          `bson:"name",omitempty`
	Email         string          `bson:"email"`
	Password      string          `bson:"password"`
	Friends       []bson.ObjectId `bson:"friends"`
	Notifications []bson.ObjectId `bson:"notifications"`
	Unread        int             `bson:"unread"`
	Requests      []bson.ObjectId `bson:"requests"`
	Activated     bool            `bson:"activated"`
	Suspended     bool            `bson:"suspended"`
	Saved         []bson.ObjectId `bson:"saved"`
	Description   string          `bson:"description,omitempty"`
}

type Username

type Username struct {
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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