models

package
v0.0.0-...-1dfef78 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	GSPModel
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	Nick        string `json:"nick"`
	RUT         string `json:"rut"`
	Email       string `json:"email"`
	Password    string `json:"password"`
	AccountType string `json:"account_type"`
}

func (Account) Bind

func (ac Account) Bind(v interface{})

func (*Account) CheckPassword

func (u *Account) CheckPassword(plain string) bool

func (*Account) HashPassword

func (u *Account) HashPassword(plain string) (string, error)

func (Account) New

func (ac Account) New() Model

type Admin

type Admin struct {
	GSPModel
	AccountID int64   `json:"account_id" mapstructure:"account_id"`
	Account   Account `json:"account" mapstructure:"account"`
	EntryYear int     `json:"entry_year" mapstructure:"entry_year"`
}

Admin is a DBModel for Admin Entity

func (Admin) Bind

func (a Admin) Bind(v interface{})

func (Admin) New

func (a Admin) New() Model

type AdminUser

type AdminUser struct {
	User
	EntryYear int `json:"entry_year"`
}

func NewAdminUser

func NewAdminUser(a *Admin) AdminUser

func (*AdminUser) GetAccount

func (a *AdminUser) GetAccount() Account

type Career

type Career struct {
	GSPModel
	Code         int64       `json:"code" mapstructure:"code" gorm:"unique"`
	Name         string      `json:"name" mapstructure:"name"`
	Department   *Department `json:"department,omitempty" mapstructure:"department" gorm:"foreignKey:DepartmentID"`
	DepartmentID int64       `json:"department_id,omitempty" mapstructure:"department_id" gorm:"column:department_id"`
	Students     []Student   `json:"students" mapstructure:"students" gorm:"->"`
}

Career has many students and one Department associated

func (Career) Bind

func (c Career) Bind(v interface{})

func (Career) New

func (c Career) New() Model

type Channel

type Channel struct {
	GSPModel
	Name     string `json:"name" mapstructure:"name"`
	Icon     string `mapstructure:"icon" json:"icon"`
	URL      string `mapstructure:"url" json:"url"`
	IsOnline bool   `mapstructure:"is_online" json:"is_online"`
	Meets    []Meet `mapstructure:"meets" json:"meets"`
}

func NewChannel

func NewChannel(n string, i string, online bool) Channel

func (Channel) Bind

func (c Channel) Bind(v interface{})

func (Channel) New

func (c Channel) New() Model

type Commit

type Commit struct {
	GSPModel
	Title     string     `json:"title" mapstructure:"title"`
	Desc      string     `gorm:"type:text" json:"desc" mapstructure:"desc"`
	Solved    bool       `json:"solved" mapstructure:"solved"`
	SolvedAt  *time.Time `json:"solved_at,omitempty" mapstructure:"solved_at"`
	LimitDate *time.Time `json:"limit_date" mapstructure:"limit_date"`
	Project   Project    `json:"project" mapstructure:"project"`
	ProjectID int64      `json:"project_id" mapstructure:"project_id"`
}

func NewCommit

func NewCommit(t string, limit time.Time, pid int64) Commit

func (Commit) Bind

func (c Commit) Bind(v interface{})

func (Commit) New

func (c Commit) New() Model

type CommonModel

type CommonModel struct {
	ID        int64      `gorm:"primaryKey" mapstructure:"id" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at"`
}

type Coordinator

type Coordinator struct {
	GSPModel
	AccountID int64   `json:"account_id" mapstructure:"account_id"`
	Account   Account `json:"account" mapstructure:"account"`
	EntryYear int     `json:"entry_year" mapstructure:"entry_year"`
}

Coordinator is a DBModel for Coordinator Entity

type Department

type Department struct {
	GSPModel
	Name    string   `json:"name" mapstructure:"name"`
	Careers []Career `json:"careers" gorm:"->"`
}

Department embeds multiple careers

func (Department) Bind

func (d Department) Bind(v interface{})

func (Department) New

func (d Department) New() Model

type Entity

type Entity interface {
	Bind(v interface{})
	New() Model
}

type GSPModel

type GSPModel struct {
	CommonModel
	Entity  string `mapstructure:"entity" json:"entity"`
	UID     string `json:"uid" mapstructure:"uid"`
	IsValid bool   `json:"is_valid" gorm:"default:1"`
}

func (GSPModel) Bind

func (gsp GSPModel) Bind(v interface{})

func (*GSPModel) Clear

func (gsp *GSPModel) Clear()

func (*GSPModel) GetID

func (gsp *GSPModel) GetID() int64

func (*GSPModel) GetUID

func (gsp *GSPModel) GetUID() string

func (*GSPModel) InitGSP

func (gsp *GSPModel) InitGSP(t string)

InitGSP initialize an GSPStructure

func (GSPModel) New

func (gsp GSPModel) New() *GSPModel

func (*GSPModel) SetID

func (gsp *GSPModel) SetID(id int64)

func (*GSPModel) SetInvalid

func (gsp *GSPModel) SetInvalid()

SetInvalid invalids object

func (*GSPModel) ToString

func (gsp *GSPModel) ToString() string

type IProfile

type IProfile interface {
	GetAccount() Account
}
type Link struct {
	GSPModel
	URL        string   `mapstructure:"url" json:"url"`
	LinkTypeID int64    `mapstructure:"link_type_id" json:"link_type_id"`
	LinkType   LinkType `mapstructure:"link_type" json:"link_type"`
	Project    Project  `mapstructure:"project" json:"project" gorm:"foreignKey:ProjectID"`
	ProjectID  int64    `mapstructure:"project_id" json:"project_id,omitempty" gorm:"column:project_id"`
}
func NewLink(url string, tid int64, pid int64) Link

func (Link) Bind

func (l Link) Bind(v interface{})

func (Link) New

func (l Link) New() Model

type LinkType

type LinkType struct {
	GSPModel
	Name string `mapstructure:"name" json:"name"`
	Icon string `mapstructure:"icon" json:"icon"`
}

func NewLinkType

func NewLinkType(n string, i string) LinkType

func (LinkType) Bind

func (l LinkType) Bind(v interface{})

func (LinkType) New

func (l LinkType) New() Model

type Meet

type Meet struct {
	GSPModel
	Name      string     `mapstructure:"name" json:"name"`
	Date      *time.Time `mapstructure:"date" json:"date"`
	ChannelID int64      `mapstructure:"channel_id" json:"channel_id"`
	Channel   *Channel   `mapstructure:"channel" json:"channel"`
	Done      bool       `mapstructure:"done" json:"done"`
	Project   Project    `mapstructure:"project" json:"project"`
	ProjectID int64      `mapstructure:"project_id" json:"project_id"`
}

func NewMeet

func NewMeet(n string, d time.Time, chid int64, pid int64) Meet

func (Meet) Bind

func (m Meet) Bind(v interface{})

func (Meet) New

func (m Meet) New() Model

type Milestone

type Milestone struct {
	GSPModel
	Title     string     `json:"title" mapstructure:"title"`
	Desc      string     `gorm:"type:text" json:"desc" mapstructure:"desc"`
	FileURL   string     `json:"file_url" mapstructure:"file_url"`
	Solved    bool       `json:"solved" mapstructure:"solved"`
	Date      *time.Time `json:"date" mapstructure:"date"`
	Project   Project    `json:"project" mapstructure:"project"`
	ProjectID int64      `json:"project_id" mapstructure:"project_id"`
}

Milestone ...

func NewMilestone

func NewMilestone(t string, d time.Time, pid int64) Milestone

func (Milestone) Bind

func (m Milestone) Bind(v interface{})

func (Milestone) New

func (m Milestone) New() Model

type Model

type Model interface {
	InitGSP(t string)
	GetID() int64
	GetUID() string
	SetID(id int64)
	Bind(v interface{})
}

type Progress

type Progress struct {
	GSPModel
	Name      string  `json:"name" mapstructure:"name"`
	Project   Project `json:"project" mapstructure:"project"`
	ProjectID int64   `json:"project_id" mapstructure:"project_id"`
}

func NewProgress

func NewProgress(n string, pid int64) Progress

func (Progress) Bind

func (p Progress) Bind(v interface{})

func (Progress) New

func (Progress) New() Model

type Project

type Project struct {
	GSPModel
	ProjectState   ProjectState `json:"project_state" mapstructure:"project_state"`
	ProjectStateID int64        `json:"project_state_id,omitempty" mapstructure:"project_state_id"`
	Title          string       `json:"title" mapstructure:"title"`
	ProjectTypeID  int64        `json:"project_type_id" mapstructure:"project_type_id"`
	ProjectType    ProjectType  `json:"project_type" mapstructure:"project_type"`
	Desc           string       `gorm:"type:text" json:"desc" mapstructure:"desc"`
	Authors        []Student    `gorm:"many2many:project_authors;" json:"authors" mapstructure:"authors"`
	Guides         []Teacher    `gorm:"many2many:project_guides" json:"guides" mapstructure:"guides"`
	Links          []Link       `json:"links" mapstructure:"links"`
	Subjects       []Subject    `gorm:"many2many:project_subjects" json:"subjects" mapstructure:"subjects"`
	Meets          []Meet       `json:"meets" mapstructure:"meets"`
	Milestones     []Milestone  `json:"milestones" mapstructure:"milestones"`
	Progress       []Progress   `json:"progress" mapstructure:"progress"`
	Tags           string       `json:"tags" mapstructure:"tags"`
	Commits        []Commit     `json:"commits" mapstructure:"commits"`
	Reviews        []Review     `json:"reviews" mapstructure:"reviews"`
}

func NewProject

func NewProject(title string, authors []Student, guides []Teacher, subjects []Subject, ptype ProjectType) Project

func (Project) Bind

func (p Project) Bind(v interface{})

func (Project) New

func (p Project) New() Model

type ProjectState

type ProjectState struct {
	GSPModel
	Name     string    `json:"name" mapstructure:"name"`
	Projects []Project `json:"projects" mapstructure:"projects"`
}

func NewProjectState

func NewProjectState(n string) ProjectState

func (ProjectState) Bind

func (s ProjectState) Bind(v interface{})

func (ProjectState) New

func (ProjectState) New() Model

type ProjectType

type ProjectType struct {
	GSPModel
	Name     string    `json:"name" mapstructure:"name"`
	Projects []Project `json:"projects" mapstructure:"projects"`
}

func NewProjectType

func NewProjectType(n string) ProjectType

func (ProjectType) Bind

func (t ProjectType) Bind(v interface{})

func (ProjectType) New

func (ProjectType) New() Model

type Review

type Review struct {
	GSPModel
	Name       string   `mapstructure:"name" json:"name"`
	RubricID   int64    `json:"rubric_id" mapstructure:"rubric_id"`
	Rubric     Rubric   `mapstructure:"rubric" json:"rubric"`
	Project    Project  `json:"project" mapstructure:"project"`
	ProjectID  int64    `json:"project_id" mapstructure:"project_id"`
	FileURL    string   `mapstructure:"file_url" json:"file_url"`
	Score      *float32 `json:"score" mapstructure:"score"`
	ReviewerID int64    `json:"reviewer_id" mapstructure:"reviewer_id"`
	Reviewer   Teacher  `mapstructure:"reviewer" json:"reviewer"`
	Comment    string   `json:"comment" mapstructure:"comment"`
}

func NewReview

func NewReview(n string, rid int64, pid int64, url string, rvid int64, score float32) Review

func (Review) Bind

func (r Review) Bind(v interface{})

func (Review) New

func (r Review) New() Model

type Rubric

type Rubric struct {
	GSPModel
	Name    string   `json:"name" mapstructure:"name"`
	FileURL string   `json:"file_url" mapstructure:"file_url"`
	Reviews []Review `gorm:"->" json:"reviews" mapstructure:"reviews"`
}

func NewRubric

func NewRubric(n string, url string) Rubric

func (Rubric) Bind

func (r Rubric) Bind(v interface{})

func (Rubric) New

func (r Rubric) New() Model

type Student

type Student struct {
	GSPModel
	FirstName string    `mapstructure:"first_name" json:"first_name"`
	LastName  string    `mapstructure:"last_name" json:"last_name"`
	RUT       string    `mapstructure:"rut" json:"rut"`
	CareerID  int64     `mapstructure:"career_id" json:"career_id"`
	Career    *Career   `mapstructure:"career" json:"career"`
	EntryYear int       `mapstructure:"entry_year" json:"entry_year"`
	Projects  []Project `json:"projects" mapstructure:"projects" gorm:"many2many:project_authors;"`
}

Student has one associated Career

func NewStudent

func NewStudent(f string, l string, cid int64) Student

func (Student) Bind

func (s Student) Bind(v interface{})

func (Student) New

func (s Student) New() Model

type Subject

type Subject struct {
	GSPModel
	Name string `json:"name" mapstructure:"name"`
	Icon string `json:"icon" mapstructure:"icon"`
}

func NewSubject

func NewSubject(n string, i string) Subject

func (Subject) Bind

func (s Subject) Bind(v interface{})

func (Subject) New

func (s Subject) New() Model

type Teacher

type Teacher struct {
	GSPModel
	AccountID int64     `json:"account_id" mapstructure:"account_id"`
	Account   Account   `json:"account" mapstructure:"account"`
	EntryYear int       `json:"entry_year" mapstructure:"entry_year"`
	Projects  []Project `gorm:"many2many:project_guides" json:"projects" mapstructure:"projects"`
}

Teacher is a DBModel for Teacher Entity

func NewTeacher

func NewTeacher(f string, l string) Teacher

func (Teacher) Bind

func (t Teacher) Bind(v interface{})

func (Teacher) New

func (t Teacher) New() Model

type TeacherUser

type TeacherUser struct {
	User
	EntryYear int `json:"entry_year"`
}

func NewTeacherUser

func NewTeacherUser(t *Teacher) TeacherUser

func (*TeacherUser) GetAccount

func (t *TeacherUser) GetAccount() Account

type UType

type UType int
const (
	UTeacher UType = iota + 1
	UCoordinator
	UAdmin
)

func (UType) String

func (t UType) String() string

type User

type User struct {
	ID        int64   `json:"id"`
	AccountID int64   `json:"account_id"`
	Account   Account `json:"account"`
}

func NewUser

func NewUser(ac *Account) User

func (User) Bind

func (u User) Bind(v interface{})

func (*User) GetID

func (u *User) GetID() int64

func (*User) GetUID

func (u *User) GetUID() int64

Jump to

Keyboard shortcuts

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