models

package
v0.0.0-...-f5fa5b5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Abjad string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Functions

func BookSeat

func BookSeat(ctx helpers.Context, classId int, userId, inOut string) map[string]interface{}

func CreateSeats

func CreateSeats(rows, cols, classId int, ctx helpers.Context)

Types

type CheckInResponse

type CheckInResponse struct {
	ClassID       int            `json:"class_id,omitempty" name:"class_id"`
	Rows          int            `json:"rows,omitempty"`
	Columns       int            `json:"columns,omitempty"`
	Teacher       string         `json:"teacher,omitempty"`
	AvailableSeat []string       `json:"available_seats"`
	OccupiedSeat  []OccupiedSeat `json:"occupied_seats"`
	Message       string         `json:"message,omitempty"`
}

func (*CheckInResponse) SetAvailableSeats

func (cr *CheckInResponse) SetAvailableSeats(ctx helpers.Context)

func (*CheckInResponse) SetOccupiedClass

func (cr *CheckInResponse) SetOccupiedClass(ctx helpers.Context) map[string]interface{}

func (*CheckInResponse) SetOccupiedSeats

func (cr *CheckInResponse) SetOccupiedSeats(ctx helpers.Context)

type Classroom

type Classroom struct {
	ID        int       `json:"id,omitempty" form:"id,omitempty" query:"id,omitempty"`
	Name      string    `json:"name" gorm:"type:varchar(50)" validate:"required"`
	Rows      int       `json:"rows,omitempty" form:"rows,omitempty" query:"rows,omitempty" validate:"required"`
	Columns   int       `json:"columns,omitempty" form:"columns,omitempty" query:"columns,omitempty" validate:"required"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

func (*Classroom) CreateClass

func (cr *Classroom) CreateClass(ctx helpers.Context) map[string]interface{}

func (*Classroom) GetClassById

func (cr *Classroom) GetClassById(ctx helpers.Context, classId int) map[string]interface{}

type Learning

type Learning struct {
	ID        string    `json:"id,omitempty" form:"id,omitempty" query:"id,omitempty" gorm:"type:char(36)"`
	ClassID   int       `json:"class.id,omitempty" gorm:"type:char(36);index:learning_class_id"`
	ClassName string    `json:"class.name,omitempty" gorm:"-"`
	SeatID    string    `json:"seat.id,omitempty" gorm:"type:char(36);index:learning_seat_id"`
	SeatName  string    `json:"seat.name,omitempty" gorm:"-"`
	UserID    string    `json:"user.id,omitempty" gorm:"type:char(36);index:learning_user_id"`
	UserName  string    `json:"user.name,omitempty" gorm:"-"`
	ExpiredAt time.Time `json:"expired_at,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

type OccupiedSeat

type OccupiedSeat struct {
	Seat        string
	StudentName string
}

type Seat

type Seat struct {
	ID        string    `json:"id,omitempty" form:"id,omitempty" query:"id,omitempty" gorm:"type:char(36)"`
	Name      string    `json:"name" gorm:"type:varchar(50)" validate:"required|string"`
	SeatType  string    `json:"seat_type" gorm:"type:varchar(50)" validate:"required|string"` // student,teacher
	ClassID   int       `json:"class.id,omitempty" gorm:"index:classroom_id"`
	ClassName string    `json:"class.name,omitempty" query:"class.name,omitempty" gorm:"-"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

type Setting

type Setting struct {
	Key       string    `json:"key,omitempty" gorm:"primary_key;type:varchar(100)"`
	Value     string    `json:"value,omitempty"`
	CreatedAt string    `json:"created_at,omitempty" gorm:"type:timestamp"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	DeletedAt time.Time `json:"-" `
}

func (*Setting) Get

func (o *Setting) Get(ctx helpers.Context) map[string]interface{}

func (*Setting) Update

func (o *Setting) Update(ctx helpers.Context, data map[string]interface{}) map[string]interface{}

type User

type User struct {
	ID              string    `json:"id,omitempty" gorm:"type:char(36)"`
	Name            string    `json:"name,omitempty" gorm:"type:varchar(100)" validate:"required,max=100"`
	Gender          string    `json:"gender,omitempty" gorm:"type:varchar(6)" validate:"required,eq=male|eq=female"`
	Email           string    `json:"email,omitempty" gorm:"type:varchar(100)" validate:"required_without=phone,email,max=100"`
	Password        string    `json:"password,omitempty" validate:"required_with=email,max=100"`
	Phone           string    `json:"phone,omitempty" validate:"required_without=email,number"`
	IsPhoneVerified bool      `json:"is_phone_verified,omitempty"`
	IsEmailVerified bool      `json:"is_email_verified,omitempty"`
	RoleID          int       `json:"role.id,omitempty" gorm:"index:users_role_id"`
	RoleName        string    `json:"role.name,omitempty" query:"role.name,omitempty" gorm:"-"`
	LanguageCode    string    `json:"language_code,omitempty" gorm:"type:char(2)" validate:"max=2"`
	CountryCode     string    `json:"country_code,omitempty" gorm:"type:char(2)" validate:"max=2"`
	Province        string    `json:"province,omitempty" gorm:"type:varchar(50)" validate:"max=50"`
	City            string    `json:"city,omitempty" gorm:"type:varchar(75)" validate:"max=75"`
	Token           string    `json:"token,omitempty" gorm:"-"`
	CreatedAt       time.Time `json:"created_at,omitempty"`
	UpdatedAt       time.Time `json:"updated_at,omitempty"`
}

func (*User) BeforeSave

func (o *User) BeforeSave() error

func (*User) Create

func (o *User) Create(ctx helpers.Context) map[string]interface{}

func (*User) DeleteById

func (o *User) DeleteById(ctx helpers.Context) map[string]interface{}

func (*User) GetById

func (o *User) GetById(ctx helpers.Context, id string, params map[string][]string) map[string]interface{}

func (*User) GetByKey

func (o *User) GetByKey(ctx helpers.Context, key, value string) (*User, error)

func (*User) GetPaginated

func (o *User) GetPaginated(ctx helpers.Context, params map[string][]string) map[string]interface{}

func (*User) IsEmailAvailable

func (o *User) IsEmailAvailable(ctx helpers.Context) (map[string]interface{}, error)

func (*User) IsPhoneAvailable

func (o *User) IsPhoneAvailable(ctx helpers.Context) (map[string]interface{}, error)

func (*User) Schema

func (o *User) Schema() map[string]interface{}

func (*User) SetDefaultValue

func (o *User) SetDefaultValue(ctx helpers.Context) (map[string]interface{}, error)

func (*User) UpdateById

func (o *User) UpdateById(ctx helpers.Context) map[string]interface{}

type UserRole

type UserRole struct {
	ID        int       `json:"id,omitempty" form:"id,omitempty" query:"id,omitempty"`
	Name      string    `json:"name" gorm:"type:varchar(50)" validate:"required|string"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

func (*UserRole) Create

func (o *UserRole) Create(ctx helpers.Context) map[string]interface{}

func (*UserRole) DeleteById

func (o *UserRole) DeleteById(ctx helpers.Context) map[string]interface{}

func (*UserRole) GetById

func (o *UserRole) GetById(ctx helpers.Context, id string, params map[string][]string) map[string]interface{}

func (*UserRole) GetPaginated

func (o *UserRole) GetPaginated(ctx helpers.Context, params map[string][]string) map[string]interface{}

func (*UserRole) Schema

func (o *UserRole) Schema() map[string]interface{}

func (*UserRole) SetDefaultValue

func (o *UserRole) SetDefaultValue(ctx helpers.Context) (map[string]interface{}, error)

func (*UserRole) UpdateById

func (o *UserRole) UpdateById(ctx helpers.Context) map[string]interface{}

Jump to

Keyboard shortcuts

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