types

package
v0.0.0-...-03d29b6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	End int64  `json:"end" yaml:"end"`
	Msg string `json:"msg" yaml:"msg"`
}

Announcement contains the message to broadcast and the date that it expires

type AuthToken

type AuthToken struct {
	TokenType string `json:"token_type"`
	Token     string `json:"access_token"`
	ExpiresIn int64  `json:"expires_in"`
}

AuthToken Bearer auth token

type AuthTokenClaim

type AuthTokenClaim struct {
	*jwt.StandardClaims
	Username string
}

AuthTokenClaim a auth token claim from a user

type Break

type Break struct {
	Winter  StartEnd  `yaml:"winter"`
	Sprint  StartEnd  `yaml:"sprint"`
	Various []*string `yaml:"various"`
}

Break contains the periods of the breaks for semester breaks and national holidays

type Calendar

type Calendar struct {
	Semesters Semester `yaml:"semesters"`
	Exams     Exam     `yaml:"exams"`
	Breaks    Break    `yaml:"breaks"`
}

Calendar contains semesters, exams and breaks in an academic year

func LoadCalendar

func LoadCalendar(file string) (*Calendar, error)

LoadCalendar reads a yaml file and returns calendar struct

type Configuration

type Configuration struct {
	ExamsLink   string `yaml:"exams"`
	Hostname    string `yaml:"hostname"`
	Secret      string `yaml:"secret"`
	Port        int    `yaml:"port"`
	RedisConfig Redis  `yaml:"redis"`
}

Configuration contains all the configuration parameters.

func LoadConfiguration

func LoadConfiguration(file string) (*Configuration, error)

LoadConfiguration reads a configuration file and returns a struct.

type Context

type Context struct {
	echo.Context
	Calendar    *Calendar
	DB          *gorm.DB
	RedisClient *redis.Client
	AuthUsers   *redis.Client
	Tokens      *redis.Client
	Secret      string
}

func NewContext

func NewContext(cont echo.Context, db *gorm.DB, redis *redis.Client, auth *redis.Client, tokens *redis.Client, secret string) *Context

type DBScheduleSlot

type DBScheduleSlot struct {
	gorm.Model `json:"db_info"`
	ScheduleSlot
}

type ErrorMsg

type ErrorMsg struct {
	Message string `json:"message"`
}

ErrorMsg has an error message

type Exam

type Exam struct {
	September StartEnd `yaml:"september"`
	Winter    StartEnd `yaml:"winter"`
	Sprint    StartEnd `yaml:"sprint"`
}

Exam there are 3 exam periods, winter, sprint and September

type Holiday

type Holiday struct {
	Date    string `json:"date"`
	Name    string `json:"localName"`
	IntName string `json:"name"`
}

Holiday struct that defines a holiday

type Info

type Info struct {
	IsWeekend      bool `json:"weekend"`
	IsBreak        bool `json:"break"`
	IsExamsPeriod  bool `json:"exams"`
	IsNormalPeriod bool `json:"normal"`
}

Info contains the booleans to determine the current state of the university

type Reader

type Reader struct {
	Announcement      *Announcement            `yaml:"announcement"`
	RoomAnnouncements map[string]*Announcement `yaml:"room_announcements"`
	Comment           *Announcement            `yaml:"comment"`
}

Reader struct that contains all announcements from existing.yml

type Redis

type Redis struct {
	Ann_DB    int `yaml:"Ann_DB"`
	Users_DB  int `yaml:"Users_DB"`
	Tokens_DB int `yaml:"Tokens_DB"`
}

type RoomMap

type RoomMap struct {
	Rooms map[string]string `yaml:"rooms,omitempty"`
}

RoomMap contains a map for english-greek room name mapping

type Schedule

type Schedule struct {
	Slots []*ScheduleSlot `json:"slots"`
}

Schedule The schedule object containing all the schedule slots.

type ScheduleNow

type ScheduleNow struct {
	Now  *ScheduleSlot   `json:"now"`
	Next []*ScheduleSlot `json:"next"`
}

type ScheduleSlot

type ScheduleSlot struct {
	//ID int `gorm:"AUTO_INCREMENT;primary_key;not_null;unique_index"`
	Room string `json:"room" gorm:"text;not_null"`
	// Day is the days after the start of the week (0 = Sunday)
	Day int `json:"day" gorm:"-"`
	// Start is seconds after the start of day.
	Start int64 `json:"start" gorm:"numeric;not_null"`
	// End is seconds after the start of day.
	End      int64  `json:"end" gorm:"numeric;not_null"`
	Title    string `json:"title" gorm:"text;not_null"`
	Host     string `json:"host" gorm:"text;not_null"`
	Semester string `json:"semester" gorm:"-"`
	DayNum   int    `json:"-" gorm:"-"`
	MonthNum int    `json:"-" gorm:"-"`
	IsExam   bool   `json:"isExam" gorm:"boolean;not_null"`
}

ScheduleSlot Contains information about a schedule slot, like times, room and subject.

type Semester

type Semester struct {
	Winter StartEnd `yaml:"winter"`
	Sprint StartEnd `yaml:"sprint"`
}

Semester there are two semesters, winter and sprint

type StartEnd

type StartEnd struct {
	Start string `yaml:"start"`
	End   string `yaml:"end"`
}

StartEnd contains when a period starts and ends

type User

type User struct {
	gorm.Model
	Username string `json:"username" gorm:"string;not_null"`
	Password string `json:"password" gorm:"-"`
}

User basic struct of a user

Jump to

Keyboard shortcuts

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