Merge remote-tracking branch 'htwk-org/development'

# Conflicts:
#	backend/go.mod
#	frontend/index.html
#	frontend/package-lock.json
#	frontend/package.json
#	frontend/public/themes/lara-dark-blue/theme.css
#	frontend/public/themes/lara-dark-blue/theme.css.map
#	frontend/public/themes/lara-light-blue/theme.css
#	frontend/public/themes/lara-light-blue/theme.css.map
#	frontend/src/App.vue
#	frontend/src/components/DarkModeSwitcher.vue
#	frontend/src/i18n/index.ts
#	frontend/src/main.ts
#	frontend/src/router/index.ts
#	frontend/src/view/CalendarLink.vue
#	frontend/src/view/edit/EditCalendar.vue
#	frontend/vite.config.ts
#	reverseproxy.conf
#	reverseproxy.local.conf
#	services/data-manager/main.go
#	services/data-manager/model/roomOccupancyModel.go
#	services/data-manager/service/addRoute.go
#	services/data-manager/service/addSchedule.go
#	services/data-manager/service/db/dbGroups.go
#	services/data-manager/service/feed/feedFunctions.go
#	services/data-manager/service/fetch/sport/sportFetcher.go
#	services/data-manager/service/fetch/v1/fetchSeminarEventService.go
#	services/data-manager/service/fetch/v1/fetchSeminarGroupService.go
#	services/data-manager/service/fetch/v2/fetcher.go
#	services/data-manager/service/functions/filter.go
#	services/data-manager/service/functions/filter_test.go
#	services/data-manager/service/functions/time/parse.go
#	services/data-manager/service/room/roomService.go
#	services/data-manager/service/room/roomService_test.go
#	services/go.sum
#	services/ical/service/connector/grpc/client.go
This commit is contained in:
Elmar Kresse
2024-07-24 12:16:51 +02:00
188 changed files with 9639 additions and 26900 deletions

View File

@@ -0,0 +1,104 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
import (
"slices"
"strings"
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/tools/types"
)
type Events []Event
func (m Events) Contains(event Event) bool {
return slices.Contains(m, event)
}
type AnonymizedEventDTO struct {
Day string `db:"Day" json:"day"`
Week string `db:"Week" json:"week"`
Start types.DateTime `db:"start" json:"start"`
End types.DateTime `db:"end" json:"end"`
Rooms string `db:"Rooms" json:"rooms"`
Free bool `json:"free"`
}
type Event struct {
UUID string `db:"uuid" json:"uuid"`
Day string `db:"Day" json:"day"`
Week string `db:"Week" json:"week"`
Start types.DateTime `db:"start" json:"start"`
End types.DateTime `db:"end" json:"end"`
Name string `db:"Name" json:"name"`
EventType string `db:"EventType" json:"eventType"`
Compulsory string `db:"Compulsory" json:"compulsory"`
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
}
type EventType struct {
EventType string `db:"EventType" json:"eventType"`
}
func (e *Event) Equals(event Event) bool {
return e.Day == event.Day &&
e.Week == event.Week &&
e.Start == event.Start &&
e.End == event.End &&
e.Name == event.Name &&
e.Course == event.Course &&
e.Prof == event.Prof &&
e.Rooms == event.Rooms &&
e.EventType == event.EventType
}
func (e *Event) TableName() string {
return "events"
}
// SetCourse func to set the course and returns the event
func (e *Event) SetCourse(course string) Event {
e.Course = course
return *e
}
// AnonymizeEvent Creates an AnonymizedEventDTO from an Event hiding all sensitive data
func (e *Event) AnonymizeEvent() AnonymizedEventDTO {
return AnonymizedEventDTO{
Day: e.Day,
Week: e.Week,
Start: e.Start,
End: e.End,
Rooms: e.Rooms,
Free: strings.Contains(strings.ToLower(e.Name), "zur freien verfügung"),
}
}
func (e *Event) GetName() string {
return e.Name
}
func (e *Event) SetName(name string) {
e.Name = name
}

View File

@@ -0,0 +1,480 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
import (
"reflect"
"testing"
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/tools/types"
)
func TestEventsContains(t *testing.T) {
specificTime, _ := types.ParseDateTime("2020-01-01 12:00:00.000Z")
type args struct {
event Event
}
tests := []struct {
name string
m Events
args args
want bool
}{
{
name: "event contains empty events",
m: Events{},
args: args{event: Event{}},
want: false,
},
{
name: "event contains one event",
m: Events{{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"}},
args: args{event: Event{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"}},
want: true,
},
{
name: "event contains two events",
m: Events{{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"}, {Day: "test2", Week: "test2", Start: specificTime, End: specificTime, Name: "test2", Course: "test2", Prof: "test2", Rooms: "test2", EventType: "test2"}},
args: args{event: Event{Day: "test2", Week: "test2", Start: specificTime, End: specificTime, Name: "test2", Course: "test2", Prof: "test2", Rooms: "test2", EventType: "test2"}},
want: true,
},
{
name: "event contains two events with different values",
m: Events{{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test", UUID: "439ßu56rf8u9ijn4f4-2345345"}, {Day: "test2", Week: "test2", Start: specificTime, End: specificTime, Name: "test2", Course: "test2", Prof: "test2", Rooms: "test2", EventType: "test2", UUID: "432a39ßu545349ijn4f4-23dsa45"}},
args: args{event: Event{Day: "test3", Week: "test3", Start: specificTime, End: specificTime, Name: "test3", Course: "test3", Prof: "test3", Rooms: "test3", EventType: "test3", UUID: "934mf43r34f-g68h7655tg3"}},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.m.Contains(tt.args.event); got != tt.want {
t.Errorf("Contains() = %v, want %v", got, tt.want)
}
})
}
}
func TestEventEquals(t *testing.T) {
specificTime, _ := types.ParseDateTime("2020-01-01 12:00:00.000Z")
type fields struct {
UUID string
Day string
Week string
Start types.DateTime
End types.DateTime
Name string
EventType string
Prof string
Rooms string
Notes string
BookedAt string
Course string
Semester string
BaseModel models.BaseModel
}
type args struct {
event Event
}
tests := []struct {
name string
fields fields
args args
want bool
}{
{
name: "event equals empty events",
fields: fields{},
args: args{event: Event{}},
want: true,
},
{
name: "event equals one empty one not",
fields: fields{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"},
args: args{event: Event{}},
want: false,
},
{
name: "event equals one event",
fields: fields{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"},
args: args{event: Event{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"}},
want: true,
},
{
name: "event equals two events",
fields: fields{Day: "test", Week: "test", Start: specificTime, End: specificTime, Name: "test", Course: "test", Prof: "test", Rooms: "test", EventType: "test"},
args: args{event: Event{Day: "test2", Week: "test2", Start: specificTime, End: specificTime, Name: "test2", Course: "test2", Prof: "test2", Rooms: "test2", EventType: "test2"}},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m := &Event{
UUID: tt.fields.UUID,
Day: tt.fields.Day,
Week: tt.fields.Week,
Start: tt.fields.Start,
End: tt.fields.End,
Name: tt.fields.Name,
EventType: tt.fields.EventType,
Prof: tt.fields.Prof,
Rooms: tt.fields.Rooms,
Notes: tt.fields.Notes,
BookedAt: tt.fields.BookedAt,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
BaseModel: tt.fields.BaseModel,
}
if got := m.Equals(tt.args.event); got != tt.want {
t.Errorf("Equals() = %v, want %v", got, tt.want)
}
})
}
}
func TestEventAnonymizeEvent(t *testing.T) {
type fields struct {
UUID string
Day string
Week string
Start types.DateTime
End types.DateTime
Name string
EventType string
Compulsory string
Prof string
Rooms string
Notes string
BookedAt string
Course string
Semester string
BaseModel models.BaseModel
}
tests := []struct {
name string
fields fields
want AnonymizedEventDTO
}{
{
name: "event anonymize empty event",
fields: fields{},
want: AnonymizedEventDTO{Day: "", Week: "", Start: types.DateTime{}, End: types.DateTime{}, Rooms: "", Free: false},
},
{
name: "event anonymize one event",
fields: fields{Name: "Event", Day: "test", Week: "test", Rooms: "test"},
want: AnonymizedEventDTO{Day: "test", Week: "test", Start: types.DateTime{}, End: types.DateTime{}, Rooms: "test", Free: false},
},
{
name: "event anonymize one event with free",
fields: fields{Name: "Räume zur freien Verfügung", Day: "test", Week: "test", Rooms: "test", Course: "test"},
want: AnonymizedEventDTO{Day: "test", Week: "test", Start: types.DateTime{}, End: types.DateTime{}, Rooms: "test", Free: true},
},
{
name: "event anonymize another free event",
fields: fields{Name: "Zur freien Verfügung", Day: "Montag", Week: "5", Start: types.DateTime{}, End: types.DateTime{}, Rooms: "TR_A1.28-S", Course: "42INM-3"},
want: AnonymizedEventDTO{Day: "Montag", Week: "5", Start: types.DateTime{}, End: types.DateTime{}, Rooms: "TR_A1.28-S", Free: true},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m := &Event{
UUID: tt.fields.UUID,
Day: tt.fields.Day,
Week: tt.fields.Week,
Start: tt.fields.Start,
End: tt.fields.End,
Name: tt.fields.Name,
EventType: tt.fields.EventType,
Compulsory: tt.fields.Compulsory,
Prof: tt.fields.Prof,
Rooms: tt.fields.Rooms,
Notes: tt.fields.Notes,
BookedAt: tt.fields.BookedAt,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
BaseModel: tt.fields.BaseModel,
}
if got := m.AnonymizeEvent(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Event.AnonymizeEvent() = %v, want %v", got, tt.want)
}
})
}
}
func TestEventGetName(t *testing.T) {
type fields struct {
UUID string
Day string
Week string
Start types.DateTime
End types.DateTime
Name string
EventType string
Compulsory string
Prof string
Rooms string
Notes string
BookedAt string
Course string
Semester string
BaseModel models.BaseModel
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "event get name - empty event",
fields: fields{},
want: "",
},
{
name: "event get name - one event",
fields: fields{Name: "Event"},
want: "Event",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
e := &Event{
UUID: tt.fields.UUID,
Day: tt.fields.Day,
Week: tt.fields.Week,
Start: tt.fields.Start,
End: tt.fields.End,
Name: tt.fields.Name,
EventType: tt.fields.EventType,
Compulsory: tt.fields.Compulsory,
Prof: tt.fields.Prof,
Rooms: tt.fields.Rooms,
Notes: tt.fields.Notes,
BookedAt: tt.fields.BookedAt,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
BaseModel: tt.fields.BaseModel,
}
if got := e.GetName(); got != tt.want {
t.Errorf("GetName() = %v, want %v", got, tt.want)
}
})
}
}
func TestEventSetCourse(t *testing.T) {
type fields struct {
UUID string
Day string
Week string
Start types.DateTime
End types.DateTime
Name string
EventType string
Compulsory string
Prof string
Rooms string
Notes string
BookedAt string
Course string
Semester string
BaseModel models.BaseModel
}
type args struct {
course string
}
tests := []struct {
name string
fields fields
args args
want Event
}{
{
name: "set course",
fields: fields{},
args: args{course: "test"},
want: Event{Course: "test"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
e := &Event{
UUID: tt.fields.UUID,
Day: tt.fields.Day,
Week: tt.fields.Week,
Start: tt.fields.Start,
End: tt.fields.End,
Name: tt.fields.Name,
EventType: tt.fields.EventType,
Compulsory: tt.fields.Compulsory,
Prof: tt.fields.Prof,
Rooms: tt.fields.Rooms,
Notes: tt.fields.Notes,
BookedAt: tt.fields.BookedAt,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
BaseModel: tt.fields.BaseModel,
}
if got := e.SetCourse(tt.args.course); !reflect.DeepEqual(got, tt.want) {
t.Errorf("SetCourse() = %v, want %v", got, tt.want)
}
})
}
}
func TestEventSetName(t *testing.T) {
type fields struct {
UUID string
Day string
Week string
Start types.DateTime
End types.DateTime
Name string
EventType string
Compulsory string
Prof string
Rooms string
Notes string
BookedAt string
Course string
Semester string
BaseModel models.BaseModel
}
type args struct {
name string
}
tests := []struct {
name string
fields fields
args args
}{
{
name: "set name",
fields: fields{
Name: "name",
},
args: args{
name: "name",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
e := &Event{
UUID: tt.fields.UUID,
Day: tt.fields.Day,
Week: tt.fields.Week,
Start: tt.fields.Start,
End: tt.fields.End,
Name: tt.fields.Name,
EventType: tt.fields.EventType,
Compulsory: tt.fields.Compulsory,
Prof: tt.fields.Prof,
Rooms: tt.fields.Rooms,
Notes: tt.fields.Notes,
BookedAt: tt.fields.BookedAt,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
BaseModel: tt.fields.BaseModel,
}
e.SetName(tt.args.name)
})
}
}
func TestEventTableName(t *testing.T) {
type fields struct {
UUID string
Day string
Week string
Start types.DateTime
End types.DateTime
Name string
EventType string
Compulsory string
Prof string
Rooms string
Notes string
BookedAt string
Course string
Semester string
BaseModel models.BaseModel
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "table name",
fields: fields{},
want: "events",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
e := &Event{
UUID: tt.fields.UUID,
Day: tt.fields.Day,
Week: tt.fields.Week,
Start: tt.fields.Start,
End: tt.fields.End,
Name: tt.fields.Name,
EventType: tt.fields.EventType,
Compulsory: tt.fields.Compulsory,
Prof: tt.fields.Prof,
Rooms: tt.fields.Rooms,
Notes: tt.fields.Notes,
BookedAt: tt.fields.BookedAt,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
BaseModel: tt.fields.BaseModel,
}
if got := e.TableName(); got != tt.want {
t.Errorf("TableName() = %v, want %v", got, tt.want)
}
})
}
}
func TestEventsContains1(t *testing.T) {
type args struct {
event Event
}
tests := []struct {
name string
m Events
args args
want bool
}{
{
name: "event contains - empty events",
m: Events{},
args: args{event: Event{}},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.m.Contains(tt.args.event); got != tt.want {
t.Errorf("Contains() = %v, want %v", got, tt.want)
}
})
}
}

View File

@@ -0,0 +1,38 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
import (
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/tools/types"
)
type Feed struct {
Modules string `db:"modules" json:"modules"`
Retrieved types.DateTime `db:"retrieved" json:"retrieved"`
Deleted bool `db:"deleted" json:"deleted"`
models.BaseModel
}
func (f *Feed) TableName() string {
return "feeds"
}
// SetModules set modules field
func (f *Feed) SetModules(modules string) {
f.Modules = modules
}

View File

@@ -0,0 +1,45 @@
package model
import (
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/tools/types"
"testing"
)
func TestFeedSetModules(t *testing.T) {
type fields struct {
Modules string
Retrieved types.DateTime
BaseModel models.BaseModel
}
type args struct {
modules string
}
tests := []struct {
name string
fields fields
args args
}{
{
name: "set modules",
fields: fields{
Modules: "",
Retrieved: types.DateTime{},
BaseModel: models.BaseModel{},
},
args: args{
modules: "modules",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
f := &Feed{
Modules: tt.fields.Modules,
Retrieved: tt.fields.Retrieved,
BaseModel: tt.fields.BaseModel,
}
f.SetModules(tt.args.modules)
})
}
}

View File

@@ -0,0 +1,47 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
import (
"time"
)
// FeedModel is an iCal feed
type FeedModel struct {
Content string
ExpiresAt time.Time
Semester string
Course string
}
// Entry is a time entry
type Entry struct {
DateStart time.Time `json:"dateStart"`
DateEnd time.Time `json:"dateEnd"`
Description string `json:"description"`
}
// Entries is a collection of entries
type Entries []*Entry
type FeedCollection struct {
UUID string `db:"uuid" json:"uuid"`
Name string `db:"Name" json:"name"`
Course string `db:"course" json:"course"`
UserDefinedName string `db:"userDefinedName" json:"userDefinedName"`
Reminder bool `db:"reminder" json:"reminder"`
}

View File

@@ -0,0 +1,47 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
type Module struct {
UUID string `json:"uuid" db:"uuid"`
Name string `json:"name" db:"Name"`
Prof string `json:"prof" db:"Prof"`
Course string `json:"course" db:"course"`
Semester string `json:"semester" db:"semester"`
Events Events `json:"events"`
}
func (m *Module) SetName(name string) {
m.Name = name
}
type ModuleDTO struct {
UUID string `json:"uuid" db:"uuid"`
Name string `json:"name" db:"Name"`
Prof string `json:"prof" db:"Prof"`
Course string `json:"course" db:"course"`
Semester string `json:"semester" db:"semester"`
EventType string `db:"EventType" json:"eventType"`
}
func (m *ModuleDTO) GetName() string {
return m.Name
}
func (m *ModuleDTO) SetName(name string) {
m.Name = name
}

View File

@@ -0,0 +1,126 @@
package model
import "testing"
func TestModuleDTOGetName(t *testing.T) {
type fields struct {
UUID string
Name string
Prof string
Course string
Semester string
EventType string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "get name",
fields: fields{
Name: "name",
},
want: "name",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m := &ModuleDTO{
UUID: tt.fields.UUID,
Name: tt.fields.Name,
Prof: tt.fields.Prof,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
EventType: tt.fields.EventType,
}
if got := m.GetName(); got != tt.want {
t.Errorf("GetName() = %v, want %v", got, tt.want)
}
})
}
}
func TestModuleDTOSetName(t *testing.T) {
type fields struct {
UUID string
Name string
Prof string
Course string
Semester string
EventType string
}
type args struct {
name string
}
tests := []struct {
name string
fields fields
args args
}{
{
name: "set name",
fields: fields{
Name: "name",
},
args: args{
name: "name",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m := &ModuleDTO{
UUID: tt.fields.UUID,
Name: tt.fields.Name,
Prof: tt.fields.Prof,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
EventType: tt.fields.EventType,
}
m.SetName(tt.args.name)
})
}
}
func TestModuleSetName(t *testing.T) {
type fields struct {
UUID string
Name string
Prof string
Course string
Semester string
Events Events
}
type args struct {
name string
}
tests := []struct {
name string
fields fields
args args
}{
{
name: "set name",
fields: fields{
Name: "name",
},
args: args{
name: "name",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m := &Module{
UUID: tt.fields.UUID,
Name: tt.fields.Name,
Prof: tt.fields.Prof,
Course: tt.fields.Course,
Semester: tt.fields.Semester,
Events: tt.fields.Events,
}
m.SetName(tt.args.name)
})
}
}

View File

@@ -0,0 +1,28 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
type SeminarGroup struct {
University string
GroupShortcut string
GroupId string
Course string
Faculty string
FacultyId string
Semester string
Events []Event
}

View File

@@ -0,0 +1,45 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
import (
"encoding/xml"
)
type Studium struct {
XMLName xml.Name `xml:"studium"`
Faculty []Faculty `xml:"fakultaet"`
}
type Faculty struct {
XMLName xml.Name `xml:"fakultaet"`
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
Studiengang []Studiengang `xml:"studiengang"`
}
type Studiengang struct {
XMLName xml.Name `xml:"studiengang"`
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
Semgrp []Semgrp `xml:"semgrp"`
}
type Semgrp struct {
XMLName xml.Name `xml:"semgrp"`
Name string `xml:"name,attr"`
}

View File

@@ -0,0 +1,12 @@
package serviceModel
import (
"github.com/pocketbase/pocketbase"
"htwkalender/data-manager/service/events"
)
type Service struct {
App *pocketbase.PocketBase
EventService events.EventService
CourseService events.CourseService
}

View File

@@ -0,0 +1,72 @@
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
//Copyright (C) 2024 HTWKalender support@htwkalender.de
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <https://www.gnu.org/licenses/>.
package model
import "time"
// MODELS
// SportEntry represents the overall event details.
type SportEntry struct {
Title string
Details EventDetails
AdditionalNote string
ID string
}
// EventDetails represents detailed information about the event.
type EventDetails struct {
DateRange DateRange
Cycle string
Gender string
CourseLead CourseLead
Location Location
Participants Participants
Cost string
Type string
}
// DateRange represents a start and end date.
type DateRange struct {
Start time.Time
End time.Time
}
// CourseLead represents a person with a name and a contact link.
type CourseLead struct {
Name string
Link string
}
// Location represents the location of the event.
type Location struct {
Name string
Address string
}
// Participants represents the participants' details.
type Participants struct {
Bookings int
TotalPlaces int
WaitList int
}
type SportDayStartEnd struct {
Start time.Time
End time.Time
Day time.Weekday
}