model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const ApiPrefix = "/api/"
View Source
const (
	// CommentCollection holds the name of the comment collection.
	CommentCollection = "comments"
)
View Source
const FbKeyEmail = "email"
View Source
const FbKeyEmailVerified = "email_verified"
View Source
const FbKeyUserID = "user_id"
View Source
const KeyAuth = "authorization"
View Source
const KeyCategory = "category"
View Source
const KeyCategoryID = "categoryId"
View Source
const KeyClaims = "claims"
View Source
const KeyComment = "comment"

Comments

View Source
const KeyDataDb = "dataDb"
View Source
const KeyEditedUser = "user"
View Source
const KeyEditedUserRoles = "editedUserRoles"
View Source
const KeyEmail = "email"
View Source
const KeyEmailVerified = "emailVerified"
View Source
const KeyMgoID = "id"
View Source
const KeyParentID = "parentId"
View Source
const KeyPath = "path"
View Source
const KeyPost = "post"

Posts

View Source
const KeyPresence = "presence"

User Meta

View Source
const KeyTags = "tags"
View Source
const KeyTask = "task"

Tasks

View Source
const KeyUser = "user"

Users

View Source
const KeyUserDb = "userDb"

various const KeyDb = "db"

View Source
const KeyUserDisplayName = "userDisplayName"
View Source
const KeyUserID = "userId"
View Source
const KeyUserRecord = "userRecord"
View Source
const KeyUserRoles = "userRoles"
View Source
const PolicyCanEdit = "CAN_EDIT"
View Source
const PolicyCanManage = "CAN_MANAGE"
View Source
const PolicyCanRead = "CAN_READ"

Known Policies

View Source
const (
	// PostCollection holds the name of the post collection
	PostCollection = "posts"
)
View Source
const (
	PresenceCollection = "presence"
)
View Source
const RoleAdmin = "ADMIN"

Known Roles

View Source
const RoleAnonymous = "ANONYMOUS"
View Source
const RoleEditor = "EDITOR"
View Source
const RoleGuest = "GUEST"
View Source
const RoleModerator = "MODERATOR"
View Source
const RoleRegistered = "REGISTERED"
View Source
const RoleUserAdmin = "USER_ADMIN"
View Source
const RoleVolunteer = "VOLUNTEER"
View Source
const StoreTypeGorm = "gorm"
View Source
const StoreTypeMgo = "mongodb"

Store types

View Source
const (
	TaskCollection = "tasks"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID       bson.ObjectId `json:"id,omitempty"  bson:"id,omitempty"`
	Date     int64         `json:"date,omitempty"`
	ParentID string        `json:"parentId" binding:"required" bson:"parentId"`
	AuthorID string        `json:"authorId" bson:"authorId"`
	Author   string        `json:"author" bson:"author"`
	Body     string        `json:"body" bson:"body"`

	CreatedOn int64  `json:"createdOn,omitempty" bson:"createdOn"`
	UpdatedOn int64  `json:"updatedOn,omitempty" bson:"updatedOn"`
	UpdatedBy string `json:"updatedBy" bson:"updatedBy"`
}

Comment model.

type Group

type Group struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Type  string `json:"type"`
}

Group might be a user or a role

type Post

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:"-"`
}

Post model

type Presence

type Presence struct {
	ID        bson.ObjectId `json:"id,omitempty"  bson:"id,omitempty"`
	UserID    string        `json:"userId" binding:"required" bson:"userId"`
	IsComing  bool          `json:"isComing" bson:"isComing"`
	Transport string        `json:"transport" bson:"transport"`
	AdultNb   int8          `json:"adultNb" bson:"adultNb"`
	ChildNb   int8          `json:"childNb" bson:"childNb"`
	D1        bool          `json:"d1" bson:"d1"`
	D2        bool          `json:"d2" bson:"d2"`
	D3        bool          `json:"d3" bson:"d3"`
	D4        bool          `json:"d4" bson:"d4"`
	D5        bool          `json:"d5" bson:"d5"`
	D6        bool          `json:"d6" bson:"d6"`
	D7        bool          `json:"d7" bson:"d7"`
	D8        bool          `json:"d8" bson:"d8"`
	Comments  string        `json:"comments" bson:"comments"`

	UpdatedOn int64  `json:"updatedOn,omitempty" bson:"updatedOn"`
	UpdatedBy string `json:"updatedBy" bson:"updatedBy"`
}

Presence model.

type Role

type Role struct {
	RoleID string `gorm:"primary_key" json:"roleId"`
	Label  string `gorm:"" json:"label"`
}

Role is used to manage permissions

type Task

type Task struct {
	ID         bson.ObjectId `json:"id,omitempty"  bson:"id,omitempty"`
	Flags      int           `json:"flags"  bson:"flags"`
	CategoryId string        `json:"categoryId"  bson:"categoryId"`
	ManagerID  string        `json:"managerId" bson:"managerId"`
	Manager    string        `json:"manager" bson:"manager"`
	Desc       string        `json:"desc" bson:"desc"`

	CreationDate int64  `json:"creationDate" bson:"creationDate"`
	CloseDate    int64  `json:"closeDate" bson:"closeDate"`
	CancelDate   int64  `json:"cancelDate" bson:"cancelDate"`
	DueDate      int64  `json:"dueDate" bson:"dueDate"`
	UpdateDate   int64  `json:"updatedOn,omitempty" bson:"updatedOn"`
	UpdateBy     string `json:"updatedBy" bson:"updatedBy"`
}

Task model.

type User

type User struct {
	gorm.Model
	UserID  string `gorm:"not null" json:"userId"`
	Name    string `gorm:"" json:"name"`
	Email   string `gorm:"not null" json:"email"`
	Address string `gorm:"" json:"address"`
	Roles   []Role `gorm:"many2many:user_roles" json:"roles"`

	// Ease front end and JSON communication, not persisted
	UserRoles []string               `gorm:"-" json:"userRoles"`
	Meta      map[string]interface{} `gorm:"-" json:"meta"`
}

User represents a user in both gorm and json worlds

Jump to

Keyboard shortcuts

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