models

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2017 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//IdeaNew is the default status
	IdeaNew = 0
	//IdeaStarted is used when the idea has been accepted and work is in progress
	IdeaStarted = 1
	//IdeaCompleted is used when the idea has been accepted and already implemented
	IdeaCompleted = 2
	//IdeaDeclined is used when organizers decide to decline an idea
	IdeaDeclined = 3
)
View Source
var (
	//RoleVisitor is the basic role for every user
	RoleVisitor = 1
	//RoleMember has limited access to administrative console
	RoleMember = 2
	//RoleAdministrator has full access to administrative console
	RoleAdministrator = 3
)

Functions

This section is empty.

Types

type AppSettings

type AppSettings struct {
	Mode            string `json:"mode"`
	BuildTime       string `json:"buildTime"`
	Version         string `json:"version"`
	Environment     string `json:"environment"`
	GoogleAnalytics string `json:"googleAnalytics"`
	Compiler        string `json:"compiler"`
	Domain          string `json:"domain"`
}

AppSettings is an application-wide settings

type Comment

type Comment struct {
	ID        int       `json:"id"`
	Content   string    `json:"content"`
	CreatedOn time.Time `json:"createdOn"`
	User      *User     `json:"user"`
}

Comment represents an user comment on an idea

type CreateTenant added in v0.5.0

type CreateTenant struct {
	Token      string `json:"token"`
	Name       string `json:"name"`
	Subdomain  string `json:"subdomain"`
	UserClaims *OAuthClaims
}

CreateTenant is the input model used to create a tenant

type FiderClaims

type FiderClaims struct {
	UserID    int    `json:"user/id"`
	UserName  string `json:"user/name"`
	UserEmail string `json:"user/email"`
	jwt.StandardClaims
}

FiderClaims represents what goes into JWT tokens

type Idea

type Idea struct {
	ID              int           `json:"id"`
	Number          int           `json:"number"`
	Title           string        `json:"title"`
	Slug            string        `json:"slug"`
	Description     string        `json:"description"`
	CreatedOn       time.Time     `json:"createdOn"`
	User            *User         `json:"user"`
	TotalSupporters int           `json:"totalSupporters"`
	TotalComments   int           `json:"totalComments"`
	Status          int           `json:"status"`
	Response        *IdeaResponse `json:"response"`
}

Idea represents an idea on a tenant board

func (*Idea) CanBeChangedBy added in v0.4.0

func (i *Idea) CanBeChangedBy(user *User) bool

CanBeChangedBy returns true if given user can change this idea

type IdeaResponse

type IdeaResponse struct {
	Text        string    `json:"text"`
	RespondedOn time.Time `json:"respondedOn"`
	User        *User     `json:"user"`
}

IdeaResponse is a staff response to a given idea

type NewComment added in v0.5.0

type NewComment struct {
	Content string `json:"content"`
}

NewComment represents a new comment

type NewIdea added in v0.5.0

type NewIdea struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

NewIdea represents a new idea

type OAuthClaims

type OAuthClaims struct {
	OAuthID       string `json:"oauth/id"`
	OAuthProvider string `json:"oauth/provider"`
	OAuthName     string `json:"oauth/name"`
	OAuthEmail    string `json:"oauth/email"`
	jwt.StandardClaims
}

OAuthClaims represents what goes into temporary OAuth JWT tokens

type SetResponse added in v0.5.0

type SetResponse struct {
	Status int    `json:"status"`
	Text   string `json:"text"`
}

SetResponse represents the action to update an idea response

type Tenant

type Tenant struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Subdomain      string `json:"subdomain"`
	Invitation     string `json:"invitation"`
	WelcomeMessage string `json:"welcomeMessage"`
	CNAME          string `json:"cname"`
}

Tenant represents a tenant

type UpdateTenantSettings added in v0.5.0

type UpdateTenantSettings struct {
	Title          string `json:"title"`
	Invitation     string `json:"invitation"`
	WelcomeMessage string `json:"welcomeMessage"`
	UserClaims     *OAuthClaims
}

UpdateTenantSettings is the input model used to update tenant settings

type User

type User struct {
	ID        int             `json:"id"`
	Name      string          `json:"name"`
	Email     string          `json:"-"`
	Gravatar  string          `json:"gravatar"`
	Tenant    *Tenant         `json:"-"`
	Role      int             `json:"role"`
	Providers []*UserProvider `json:"-"`
}

User represents an user inside our application

func (*User) HasProvider

func (u *User) HasProvider(provider string) bool

HasProvider returns true if current user has registered with given provider

func (*User) IsStaff added in v0.4.0

func (u *User) IsStaff() bool

IsStaff returns true if user has special permissions

type UserProvider

type UserProvider struct {
	Name string
	UID  string
}

UserProvider represents the relashionship between an User and an Authentication provide

Jump to

Keyboard shortcuts

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