models

package
v0.0.0-...-4c1f3c0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassesAsApiClassList

func ClassesAsApiClassList(classes []Class) api.ClassList

func GradesAsApiGradeList

func GradesAsApiGradeList(students []Grade) api.GradeList

func StudentsAsApiStudentList

func StudentsAsApiStudentList(students []Student) api.StudentList

func TeachersAsApiTeacherList

func TeachersAsApiTeacherList(teachers []Teacher) api.TeacherList

Types

type BaseMetadata

type BaseMetadata struct {
	// Id is the cuid of the class
	Id string `json:"id"`

	// CreatedAt is the time at which this class was created.
	CreatedAt time.Time `json:"created_at"`

	// UpdatedAt is the time at which this class was updated.
	UpdatedAt time.Time `json:"updated_at"`
}

type Class

type Class struct {
	// Name is the computer-friendly name of the class
	Name string `json:"name"`

	// DisplayName is the human-friendly name of the class
	DisplayName string `json:"display_name"`

	// Description is the human-readable description of what the class teaches.
	Description *string `json:"description"`

	StudentIds []string `json:"studentIds"`

	StartDate time.Time `json:"startDate"`
	EndDate   time.Time `json:"endDate"`

	BaseMetadata
}

Class represents a class students can attend

func (*Class) AsApiClass

func (c *Class) AsApiClass() api.Class

func (*Class) ReconcileWithApiClass

func (c *Class) ReconcileWithApiClass(description *string, displayName *string) *Class

type Grade

type Grade struct {
	BaseMetadata

	ClassId string `json:"classId"`

	// StudentId is the ID of the student this Grade applies to.
	StudentId string `json:"studentId"`

	// Value is the value of the Grade.
	Value int `json:"value"`
}

func (*Grade) AsApiGrade

func (s *Grade) AsApiGrade() api.Grade

type Student

type Student struct {
	BaseMetadata

	// FullName is the student's full legal name.
	FullName string `json:"fullName"`

	ClassId string `json:"classId"`
}

func (*Student) AsApiStudent

func (s *Student) AsApiStudent() api.Student

type Teacher

type Teacher struct {
	FullName     string `json:"fullName"`
	Email        string `json:"email"`
	PasswordHash string `json:"-"`
	BaseMetadata
}

func (*Teacher) AsApiTeacher

func (c *Teacher) AsApiTeacher() api.Teacher

type User

type User[T interface{}] struct {
	BaseMetadata
	PersonId string
	Person   *T
}

func (*User[T]) Jwt

func (u *User[T]) Jwt() (string, error)

Jump to

Keyboard shortcuts

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