mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-19 11:08:48 +02:00
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase/models"
|
|
"slices"
|
|
)
|
|
|
|
type Events []Event
|
|
|
|
func (m Events) Contains(event Event) bool {
|
|
return slices.Contains(m, event)
|
|
}
|
|
|
|
type Event struct {
|
|
UUID string `db:"uuid" json:"uuid"`
|
|
Day string `db:"Day" json:"day"`
|
|
Week string `db:"Week" json:"week"`
|
|
Start string `db:"Start" json:"start"`
|
|
End string `db:"End" json:"end"`
|
|
Name string `db:"Name" json:"name"`
|
|
EventType string `db:"EventType" json:"eventType"`
|
|
Prof string `db:"Prof" json:"prof"`
|
|
Rooms string `db:"Rooms" json:"rooms"`
|
|
Notes string `db:"Notes" json:"notes"`
|
|
BookedAt string `db:"BookedAt" json:"bookedAt"`
|
|
Course string `db:"course" json:"course"`
|
|
Semester string `db:"semester" json:"semester"`
|
|
models.BaseModel
|
|
}
|
|
|
|
func (m *Event) Equals(event Event) bool {
|
|
return m.Day == event.Day &&
|
|
m.Week == event.Week &&
|
|
m.Start == event.Start &&
|
|
m.End == event.End &&
|
|
m.Name == event.Name &&
|
|
m.Course == event.Course &&
|
|
m.Prof == event.Prof &&
|
|
m.Rooms == event.Rooms &&
|
|
m.EventType == event.EventType
|
|
}
|
|
|
|
func (m *Event) TableName() string {
|
|
return "events"
|
|
}
|
|
|
|
// SetCourse func to set the course and returns the event
|
|
func (m *Event) SetCourse(course string) Event {
|
|
m.Course = course
|
|
return *m
|
|
}
|