models

package
v0.0.0-...-ff84f7d Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSectionToClass

func AddSectionToClass(cid primitive.ObjectID, section SectionWithName)

func AddUserToSection

func AddUserToSection(user User)

func CheckAdminAccount

func CheckAdminAccount()

Types

type Class

type Class struct {
	ID       primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Name     string             `json:"class_name" bson:"class_name" validate:"required,min=3,max=32"`
	Sections []SectionWithName  `json:"sections,omitempty" bson:"sections,omitempty"`
	// Sections  []SectionWithName `json:"sections" bson:"sections"`
	CreatedAt time.Time `json:"created_at" bson:"created_at"`
	UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
}

func CreateClass

func CreateClass(name string) (Class, error)

func GetClass

func GetClass(key, value string) (Class, error)

func GetClasses

func GetClasses() ([]Class, error)

type ClassSection

type ClassSection struct {
	ClassName   string             `json:"class_name" bson:"class_name"`
	SectionName string             `json:"section_name" bson:"section_name"`
	ClassID     primitive.ObjectID `json:"class_id" bson:"class_id" validate:"required"`
	SectionID   primitive.ObjectID `json:"section_id" bson:"section_id" validate:"required"`
}

type OnlineRoom

type OnlineRoom struct {
	ID             primitive.ObjectID   `json:"_id,omitempty" bson:"_id,omitempty"`
	Name           string               `json:"room_name" bson:"room_name" validate:"required,min=1,max=32"`
	ClassLive      bool                 `json:"class_live" bson:"class_live"`
	VirtualClass   primitive.ObjectID   `json:"virtualclass,omitempty" bson:"virtualclass,omitempty"`
	CurrentTeacher []primitive.ObjectID `json:"teachers,omitempty" bson:"teachers,omitempty"`
	StudentsJoined []primitive.ObjectID `json:"students,omitempty" bson:"students,omitempty"`
	CreatedAt      time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt      time.Time            `json:"updated_at" bson:"updated_at"`
}

this is an instance of an online class, one document per section of a class.

func CreateRoom

func CreateRoom(name string) (OnlineRoom, error)

func GetRoom

func GetRoom(key, value string) (OnlineRoom, error)

type Section

type Section struct {
	ID         primitive.ObjectID   `json:"_id,omitempty" bson:"_id,omitempty"`
	Name       string               `json:"section_name" bson:"section_name" validate:"required,min=1,max=32"`
	Students   []primitive.ObjectID `json:"students,omitempty" bson:"students,omitempty"`
	Teachers   []primitive.ObjectID `json:"teachers,omitempty" bson:"teachers,omitempty"`
	OnlineRoom primitive.ObjectID   `json:"online_room,omitempty" bson:"online_room,omitempty"`
	CreatedAt  time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt  time.Time            `json:"updated_at" bson:"updated_at"`
}

func CreateSection

func CreateSection(name string) (Section, error)

func GetSection

func GetSection(key, value string) (Section, error)

type SectionWithName

type SectionWithName struct {
	SectionID   primitive.ObjectID `json:"section_id,omitempty" bson:"section_id,omitempty"`
	SectionName string             `json:"section_name,omitempty" bson:"section_name,omitempty"`
}

type User

type User struct {
	ID         primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Name       string             `json:"name" bson:"name" validate:"required,min=3,max=32"`
	UserID     string             `json:"user_id" bson:"user_id" validate:"required,min=3,max=32"`
	Password   string             `json:"password,omitempty" bson:"password,omitempty"`
	Roles      []string           `json:"roles" bson:"roles" validate:"validRoles"`
	Experience string             `json:"experience,omitempty" bson:"experience,omitempty"`
	Expertise  string             `json:"expertise,omitempty" bson:"expertise,omitempty"`
	BelongsTo  ClassSection       `json:"belongs_to" bson:"belongs_to" validate:"required"`
	CreatedAt  time.Time          `json:"created_at" bson:"created_at"`
	UpdatedAt  time.Time          `json:"updated_at" bson:"updated_at"`
}

func CreateUser

func CreateUser(user User) (User, error)

func GetUser

func GetUser(key, value string) (User, error)

func GetUsers

func GetUsers(filters UserFilters) ([]User, error)

type UserFilters

type UserFilters struct {
	Role string
}

Jump to

Keyboard shortcuts

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