model

package
v0.0.0-...-3c77d5a Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ItemTypeMessage  = "sprava"
	ItemTypeHomework = "homework"
)
View Source
var (
	ErrUnobtainableAttachments = errors.New("couldn't obtain attachments")
)
View Source
var (
	TimeFormat = "2006-01-02 15:04:05"
)
View Source
var (
	TimeFormatYearMonthDay = "2006-01-02"
)

Functions

func UnmarshalNestedString

func UnmarshalNestedString(src string, dst any) error

Types

type AbsentType

type AbsentType struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Short string `json:"short"`
}

type AllCreditInfo

type AllCreditInfo struct {
}

type BoarderRow

type BoarderRow struct {
	ID            string      `json:"stravnikid"`
	Edupage       string      `json:"edupage"`
	Type          string      `json:"typ"`
	AgendaID      string      `json:"agendaid"`
	Name          string      `json:"meno"`
	Surname       string      `json:"priezvisko"`
	Subname       interface{} `json:"subname"`
	Class         string      `json:"trieda"`
	Chips         string      `json:"cipy"`
	Credits       string      `json:"kredit"`
	Backup        interface{} `json:"zaloha"`
	AllCreditInfo string      `json:"allKreditInfo"`
	HardMode      bool        `json:"hardMode"`
	BoarderCount  json.Number `json:"pocetStravnikov"`
	Note          interface{} `json:"poznamka"`
	Alergens      interface{} `json:"alergeny"`
	Histamin      json.Number `json:"histamin"`
	Birthdate     string      `json:"birthdate"`
	DateTo        string      `json:"dateto"`
	AgeGroup      json.Number `json:"vekova_skupina"`
	Active        json.Number `json:"active"`
	Visible       json.Number `json:"visible"`
	DeletedByUser json.Number `json:"deletedByUser"`
	Status        string      `json:"stav"`
	RowChanged    string      `json:"row_changed"`
	User          string      `json:"user"`
	FullName      string      `json:"fullName"`
}

func (*BoarderRow) GetAllCreditInfo

func (b *BoarderRow) GetAllCreditInfo() AllCreditInfo

type Canteen

type Canteen struct {
	Info Info
	Days map[string]CanteenDay
}

func ParseCanteen

func ParseCanteen(data []byte) (Canteen, error)

type CanteenDay

type CanteenDay struct {
	AvailableFrom           string                   `json:"vydaj_od"`
	AvailableTo             string                   `json:"vydaj_do"`
	FoodTypes               json.Number              `json:"drugov_jedal"`
	IsCooking               bool                     `json:"isCooking"`
	IsPickUp                bool                     `json:"isPickUp"`
	IsChoosable             bool                     `json:"isChoosable"`
	VisibleMenus            map[json.Number]bool     `json:"visibleMenus"`
	ChoosableMenus          map[json.Number]bool     `json:"choosableMenus"`
	UnsubscribeOnlyWholeDay bool                     `json:"odhlasIbaCelyDen"`
	OrderableUntil          string                   `json:"prihlas_do"`
	CancelableUntil         string                   `json:"odhlas_do"`
	ChangeTo                string                   `json:"zmen_do"`
	Edupage                 string                   `json:"edupage"`
	IsSemiChoosable         string                   `json:"isSemiChoosable"`
	Rows                    []TicketRow              `json:"rows"`
	Name                    string                   `json:"nazov"`
	Alergens                string                   `json:"alergenyStr"`
	Menus                   map[json.Number]MenuItem `json:"menus"`
	MenuNames               map[json.Number]struct {
		Name      string `json:"nazov"`
		ShortName string `json:"skratka"`
	} `json:"nazvyMenu"`
	Evidence struct {
		Status       string `json:"stav"`
		Obj          string `json:"obj"`
		PovObj       string `json:"pov_obj"`
		RowChanged   string `json:"row_changed"`
		TZRowChanged string `json:"tz_row_changed"`
	} `json:"evidencia"`
	IsRating bool   `json:"isRating"`
	RateFrom string `json:"rate_od"`
	RateTo   string `json:"rate_do"`
}

type Class

type Class struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Short       string `json:"short"`
	Grade       string `json:"grade"`
	TeacherID   string `json:"teacherid"`
	Teacher2ID  string `json:"teacher2id"`
	ClassroomID string `json:"classroomid"`
}

type Classroom

type Classroom struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Short string `json:"short"`
}

type DBI

type DBI struct {
	Teachers           map[string]Teacher           `json:"teachers"`
	Classes            map[string]Class             `json:"classes"`
	Subjects           map[string]Subject           `json:"subjects"`
	Classrooms         map[string]Classroom         `json:"classrooms"`
	Students           map[string]Students          `json:"students"`
	Parents            map[string]Parents           `json:"parents"`
	Periods            map[json.Number]Period       `json:"periods"`
	DayParts           map[string]DayParts          `json:"dayparts"`
	AbsentTypes        map[string]AbsentType        `json:"absenttypes"`
	SubstitutionTypes  map[string]SubstitionType    `json:"substitutiontypes"`
	StudentAbsentTypes map[string]StudentAbsentType `json:"studentabsenttypes"`
	EventTypes         map[string]UserEventType     `json:"eventtypes"`
	ProcessTypes       map[string]ProcessType       `json:"processtypes"`
	ProcessStates      map[string]ProcessState      `json:"processstates"`
	IsStudentAdult     bool                         `json:"isstudentadult"`
}

func (*DBI) UnmarshalJSON

func (dbi *DBI) UnmarshalJSON(data []byte) error

type Date

type Date struct {
	Plans          []Plan        `json:"plan"`
	StudentAbsents []interface{} `json:"student_absents"` //TODO: check type
	Number         json.Number   `json:"tt_num"`
	Day            json.Number   `json:"tt_day"`
	Week           json.Number   `json:"tt_week"`
	Term           json.Number   `json:"tt_term"`
}

type DayParts

type DayParts struct {
	ID        string `json:"id"`
	StartTime string `json:"starttime"`
	EndTime   string `json:"endtime"`
	Name      string `json:"name"`
	Short     string `json:"short"`
}

type DayPlan

type DayPlan struct {
	Dates map[string]Date `json:"dates"`
}

type Event

type Event struct {
	ID string `json:"UdalostID"`
}

type EventType

type EventType struct {
	ID            string   `json:"id"`
	C             string   `json:"c"`
	Name          string   `json:"name"`
	TTCancel      bool     `json:"ttcancel"`
	CTCan         bool     `json:"ctcan"`
	ClassRequired bool     `json:"classrequired"`
	Publish       string   `json:"publish"`
	NoCustomTime  bool     `json:"nocustomtime"`
	HideFields    []string `json:"hidefields"`
	DP            bool     `json:"dp"`
	Lesson        bool     `json:"lesson"`
	Attendance    bool     `json:"attendance"`
	DPrivacy      string   `json:"d_privacy"`
	CTEvent       bool     `json:"ctevent"`
	TemplateID    string   `json:"templateid"`
	CategoryID    string   `json:"categoryid"`
	SubID         string   `json:"subId"`
}

type Grade

type Grade struct {
	Provider    string `json:"provider"`
	ID          string `json:"znamkaid"`
	StudentID   string `json:"studentid"`
	SubjectID   string `json:"predmetid"`
	EventID     string `json:"udalostID"`
	Month       string `json:"mesiac"`
	Data        string `json:"data"`
	Date        Time   `json:"datum"`
	TeacherID   string `json:"ucitelid"`
	Signed      string `json:"podpisane"`
	SignedAdult string `json:"podpisane_rodic"`
	Timestamp   Time   `json:"timestamp"`
	State       string `json:"stav"`
}

type HeaderItem

type HeaderItem struct {
	SubjectID string      `json:"subjectid"`
	Changes   interface{} `json:"changes"`
}

type Homework

type Homework struct {
	ID                string           `json:"hwkid"`
	HomeworkID        string           `json:"homeworkid"`
	ESuperID          string           `json:"e_superid"`
	UserID            string           `json:"userid"`
	LessonID          json.Number      `json:"predmetid"`
	PlanID            string           `json:"planid"`
	Name              string           `json:"name"`
	Details           string           `json:"details"`
	DateTo            string           `json:"dateto"`
	DateFrom          string           `json:"datefrom"`
	DatetimeTo        string           `json:"datetimeto"`
	DatetimeFrom      string           `json:"datetimefrom"`
	DateCreated       string           `json:"datecreated"`
	Period            interface{}      `json:"period"`
	Timestamp         string           `json:"timestamp"`
	TestID            string           `json:"testid"`
	Type              string           `json:"typ"`
	LikeCount         json.Number      `json:"pocet_like"`
	ReactionCount     json.Number      `json:"pocet_reakcii"`
	DoneCount         json.Number      `json:"pocet_done"`
	State             string           `json:"stav"`
	LastResult        string           `json:"posledny_vysledok"`
	Groups            []string         `json:"skupiny"`
	ETestCards        int              `json:"etestCards"`
	ETestAnswerCards  int              `json:"etestAnswerCards"`
	StudyTopics       interface{}      `json:"studyTopics"`
	GradeEventID      interface{}      `json:"znamky_udalostid"`
	StudentsHidden    string           `json:"students_hidden"`
	Data              StringJsonObject `json:"data"`
	EvaluationStatus  string           `json:"stavhodnotetimelinePathd"`
	Ended             interface{}      `json:"skoncil"`
	MissingNextLesson bool             `json:"missingNextLesson"`
	Attachments       interface{}      `json:"attachements"`
	AuthorName        string           `json:"autor_meno"`
	LessonName        string           `json:"predmet_meno"`
}

type Info

type Info struct {
	Credit             float64     `json:"kredit"`
	CreditBackup       interface{} `json:"zalohaKredit"`
	FirstMinusDate     string      `json:"prvyMinusDate"`
	LastOkDate         string      `json:"poslednyOkDate"`
	InterruptDay       interface{} `json:"prerusDen"`
	HasInterruptObject interface{} `json:"maPreruseneObj"`
	BoarderID          string      `json:"stravnikid"`
	Info2              struct {
		Credit    float64       `json:"kredit"`
		PomCredit string        `json:"pomKredit"`
		DayCount  int           `json:"pocetDni"`
		DebugDays []interface{} `json:"debugDni"`
		Done      bool          `json:"done"`
	} `json:"info2"`
	HistaminShow string `json:"showOnlyAffected"`
	Alergens     map[json.Number]struct {
		ID      int    `json:"id"`
		Tag     string `json:"ozn"`
		Name    string `json:"nazov"`
		Visible bool   `json:"visible"`
	} `json:"alergenyIDS"`
	BoarderRow BoarderRow `json:"strRow"`
}
type MenuItem struct {
	Name          string               `json:"nazov"`
	MenuName      string               `json:"nazovMenu"`
	MenuShortName string               `json:"skratkaMenu"`
	Alergens      string               `json:"alergenyStr"`
	AlergenIDs    map[json.Number]bool `json:"alergenyIDS"`
	Weights       string               `json:"hmotnostiStr"`
	MeatOrigin    map[string]bool      `json:"povodMasa"`
}

type Mergeable

type Mergeable interface {
	Merge(src *Mergeable)
}

type Note

type Note struct {
	ID        string `json:"VcelickaID"`
	Date      string `json:"p_datum"`
	Text      string `json:"p_text"`
	Type      string `json:"p_typ"`
	SubjectID string `json:"PredmetID"`
}

type Parents

type Parents struct {
	ID        string `json:"id"`
	Firstname string `json:"firstname"`
	Lastname  string `json:"lastname"`
	Gender    string `json:"gender"`
}

type Period

type Period struct {
	ID        string `json:"id"`
	StartTime string `json:"starttime"`
	EndTime   string `json:"endtime"`
	Name      string `json:"name"`
	Short     string `json:"short"`
}

type Plan

type Plan struct {
	Period       string       `json:"uniperiod"`
	Type         string       `json:"type"`
	Header       []HeaderItem `json:"header"`
	SubjectID    string       `json:"subjectid"`
	ClassIDs     []string     `json:"classids"`
	GroupNames   []string     `json:"groupnames"`
	LID          string       `json:"lid"`
	TeacherIDs   []string     `json:"teacherids"`
	ClassroomIDs []string     `json:"classroomids"`
	StudentIDs   []string     `json:"studentids"`
	StartTime    string       `json:"starttime"`
	EndTime      string       `json:"endtime"`
}

type ProcessState

type ProcessState struct {
	ID      string            `json:"id"`
	Name    string            `json:"name"`
	Icon    string            `json:"icon"`
	Color   string            `json:"color"`
	Next    map[string]string `json:"next"`
	Changes map[string]string `json:"changes"`
}

type ProcessType

type ProcessType struct {
	ID           string   `json:"id"`
	User         string   `json:"user"`
	Name         string   `json:"name"`
	Workflow     string   `json:"workflow"`
	Enabled      bool     `json:"enabled"`
	TextOptional bool     `json:"textoptional"`
	DataColumns  []string `json:"datacolumns"`
}

type Results

type Results struct {
	Grades map[string]Grade
	Events map[string]Event
	Notes  map[string]Note
}

func ParseResults

func ParseResults(jsondata []byte) (Results, error)

func (*Results) Merge

func (dst *Results) Merge(src *Results)

type StringJsonObject

type StringJsonObject struct {
	Value map[string]interface{}
}

StringJsonObject contains stringed json object

func (*StringJsonObject) MarshalJSON

func (n *StringJsonObject) MarshalJSON() ([]byte, error)

func (*StringJsonObject) UnmarshalJSON

func (n *StringJsonObject) UnmarshalJSON(b []byte) error

type StudentAbsentType

type StudentAbsentType struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Short      string `json:"short"`
	Color      string `json:"color"`
	ExcuseType string `json:"excusetype"`
}

type Students

type Students struct {
	ID            string `json:"id"`
	ClassroomID   string `json:"classroomid"`
	Firstname     string `json:"firstname"`
	Lastname      string `json:"lastname"`
	Parent1ID     string `json:"parent1id"`
	Parent2ID     string `json:"parent2id"`
	Parent3ID     string `json:"parent3id"`
	Gender        string `json:"gender"`
	DateFrom      string `json:"datefrom"`
	DateTo        string `json:"dateto"`
	NumberInClass string `json:"numberinclass"`
	IsOut         bool   `json:"isout"`
	Number        string `json:"number"`
	DataCopy      string `json:"kopiadata"`
}

type Subject

type Subject struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Short    string `json:"short"`
	CBHidden bool   `json:"cbhidden"`
}

type SubstitionType

type SubstitionType struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Short string `json:"short"`
}

type Teacher

type Teacher struct {
	ID          string `json:"id"`
	Firstname   string `json:"firstname"`
	Lastname    string `json:"lastname"`
	Short       string `json:"short"`
	Gender      string `json:"gender"`
	ClassroomID string `json:"classroomid"`
	DateFrom    string `json:"datefrom"`
	DateTo      string `json:"dateto"`
	IsOut       bool   `json:"isout"`
}

type TicketRow

type TicketRow struct {
	Histamin    int                  `json:"histamin"`
	ReceptureID json.Number          `json:"receptura_id"`
	AlergenIDs  map[json.Number]bool `json:"alegenyIDS"`
	Name        string               `json:"nazov"`
	Alergens    string               `json:"alergenyStr"`
	Weights     json.Number          `json:"hmotnostiStr"`
}

type Time

type Time struct {
	time.Time
}

Time is a representation of time instances to help with parsing.

func (*Time) MarshalJSON

func (n *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (n *Time) UnmarshalJSON(b []byte) error

type Timeline

type Timeline struct {
	Homeworks map[string]Homework
	Items     map[string]TimelineItem
}

Timeline contains all timeline information

func ParseTimeline

func ParseTimeline(data []byte) (Timeline, error)

func (*Timeline) GetHomeworkFromTimeline

func (t *Timeline) GetHomeworkFromTimeline(superid string) (Homework, error)

func (*Timeline) Merge

func (t *Timeline) Merge(src *Timeline)

type TimelineItem

type TimelineItem struct {
	ID              string           `json:"timelineid"`
	Timestamp       Time             `json:"timestamp"`
	ReactionTo      string           `json:"reakcia_na"`
	Type            string           `json:"typ"`
	User            string           `json:"user"`
	TargetUser      string           `json:"target_user"`
	UserName        string           `json:"user_meno"`
	OtherID         string           `json:"ineid"`
	Text            string           `json:"text"`
	TimeAdded       Time             `json:"cas_pridania"`
	TimeEvent       Time             `json:"cas_udalosti"`
	Data            StringJsonObject `json:"data"`
	Owner           string           `json:"vlastnik"`
	OwnerName       string           `json:"vlastnik_meno"`
	ReactionCount   int              `json:"poct_reakcii"`
	LastReaction    string           `json:"posledna_reakcia"`
	PomocnyZaznam   string           `json:"pomocny_zaznam"`
	Removed         json.Number      `json:"removed"`
	TimeAddedBTC    Time             `json:"cas_pridania_btc"`
	LastReactionBTC Time             `json:"cas_udalosti_btc"`
}

func (*TimelineItem) GetAttachments

func (i *TimelineItem) GetAttachments() (map[string]string, error)

func (*TimelineItem) IsHomeworkWithAttachments

func (i *TimelineItem) IsHomeworkWithAttachments() bool

type Timetable

type Timetable struct {
	Days map[string][]TimetableItem // key format is YYYY-MM-dd or 2006-01-02
}

func ParseTimetable

func ParseTimetable(data []byte) (Timetable, error)

func (*Timetable) Merge

func (t *Timetable) Merge(src *Timetable)

type TimetableItem

type TimetableItem struct {
	Type         string      `json:"type"`
	Date         string      `json:"date"`
	Period       string      `json:"uniperiod"`
	StartTime    string      `json:"starttime"`
	EndTime      string      `json:"endtime"`
	SubjectID    string      `json:"subjectid"`
	ClassIDs     []string    `json:"classids"`
	GroupNames   []string    `json:"groupnames"`
	IGroupID     string      `json:"igroupid"`
	TeacherIDs   []string    `json:"teacherids"`
	ClassroomIDs []string    `json:"classroomids"`
	StudentIDs   []string    `json:"studentids"`
	Colors       []string    `json:"colors"`
	Duration     json.Number `json:"durationperiods"`
}

type User

type User struct {
	Edubar           map[string]interface{} `json:"_edubar"`
	Timeline         []TimelineItem         `json:"items"` // Only recent timeline, see EdupageClient.Timeline for more
	DBI              DBI                    `json:"dbi"`
	UserRow          UserRow                `json:"userrow"`
	EventTypes       []EventType            `json:"eventtypes"`
	UserGroups       []string               `json:"usergroups"`
	DayPlan          DayPlan                `json:"dp"`
	NamedayToday     string                 `json:"meninyDnes"`
	NamedayTommorrow string                 `json:"meninyZajtra"`
}

type UserEventType

type UserEventType struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

type UserRow

type UserRow struct {
	UserID    string `json:"UserID"`
	StudentID string `json:"StudentID"`
	Firstname string `json:"p_meno"`
	Lastname  string `json:"p_priezvisko"`
	Email     string `json:"p_mail"`
	ClassID   string `json:"TriedaID"`
}

Jump to

Keyboard shortcuts

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