model

package
v0.0.0-...-56f3798 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint       `json:"id" gorm:"primary_key"`
	CreatedAt time.Time  `json:"-"`
	UpdatedAt time.Time  `json:"-"`
	DeletedAt *time.Time `json:"-" sql:"index"`
}

BaseModel is the custom base model

type Card

type Card struct {
	BaseModel
	Title    string       `json:"title" binding:"required"`
	Category CardCategory `json:"category" binding:"exists"`
}

Card represents a single card

type CardCategory

type CardCategory int

CardCategory is the category of the card (positive or negative)

const (
	// CardCategoryPositive represents cards with a positive feedback point
	CardCategoryPositive CardCategory = iota

	// CardCategoryNegative represents cards with a negative feedback point
	CardCategoryNegative
)

type Review

type Review struct {
	BaseModel
	UUID       string `json:"uuid"`
	ReviewerID uint   `json:"-"`
	RevieweeID uint   `json:"-"`
	Reviewer   User   `json:"reviewer"`
	Reviewee   User   `json:"reviewee"`
	Cards      []Card `json:"cards" gorm:"many2many:review_cards;"`
	Remark     string `json:"remark"`
	Completed  bool   `json:"completed"`
}

Review of a user

func (*Review) BeforeCreate

func (review *Review) BeforeCreate() (err error)

BeforeCreate callback

type Role

type Role struct {
	BaseModel
	Username string `json:"username" gorm:"unique_index"`
	Role     string `json:"role"`
}

Role of a username

type User

type User struct {
	BaseModel
	Username   string `json:"username" gorm:"unique_index"`
	FirstName  string `json:"firstName"`
	Surname    string `json:"surname"`
	FullName   string `json:"fullName"`
	JobTitle   string `json:"jobTitle"`
	Department string `json:"department"`
	Company    string `json:"company"`
	Email      string `json:"email" gorm:"unique_index"`
	Avatar     string `json:"avatar"`
	Role       string `json:"role" gorm:"-"`
}

User is somebody like you or me

Jump to

Keyboard shortcuts

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