mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-09 21:27:45 +02:00
Merge pull request #12 from masterElmar/1-preview-of-additional-modules
1 preview of additional modules
This commit is contained in:
@@ -24,6 +24,8 @@ func main() {
|
|||||||
|
|
||||||
service.AddRoutes(app)
|
service.AddRoutes(app)
|
||||||
|
|
||||||
|
service.AddSchedules(app)
|
||||||
|
|
||||||
if err := app.Start(); err != nil {
|
if err := app.Start(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,18 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
type Events []*Event
|
type Events []*Event
|
||||||
|
|
||||||
|
type Event struct {
|
||||||
|
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"`
|
||||||
|
}
|
||||||
|
9
backend/model/moduleModel.go
Normal file
9
backend/model/moduleModel.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type Module struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Prof string `json:"prof"`
|
||||||
|
Course string `json:"course"`
|
||||||
|
Semester string `json:"semester"`
|
||||||
|
Events Events `json:"events"`
|
||||||
|
}
|
@@ -9,18 +9,3 @@ type SeminarGroup struct {
|
|||||||
FacultyId string
|
FacultyId string
|
||||||
Events []Event
|
Events []Event
|
||||||
}
|
}
|
||||||
|
|
||||||
type Event struct {
|
|
||||||
Day string `db:"course"`
|
|
||||||
Week string `db:"Week"`
|
|
||||||
Start string `db:"Start"`
|
|
||||||
End string `db:"End"`
|
|
||||||
Name string `db:"Name"`
|
|
||||||
EventType string `db:"EventType"`
|
|
||||||
Prof string `db:"Prof"`
|
|
||||||
Rooms string `db:"Rooms"`
|
|
||||||
Notes string `db:"Notes"`
|
|
||||||
BookedAt string `db:"BookedAt"`
|
|
||||||
Course string `db:"course"`
|
|
||||||
Semester string `db:"semester"`
|
|
||||||
}
|
|
||||||
|
@@ -9,7 +9,9 @@ import (
|
|||||||
"htwkalender/service/fetch"
|
"htwkalender/service/fetch"
|
||||||
"htwkalender/service/ical"
|
"htwkalender/service/ical"
|
||||||
"htwkalender/service/room"
|
"htwkalender/service/room"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,6 +73,7 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// API Endpoint to get all events for a specific room on a specific day
|
||||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
_, err := e.Router.AddRoute(echo.Route{
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
@@ -90,12 +93,19 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// API Endpoint to create a new iCal feed
|
||||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
_, err := e.Router.AddRoute(echo.Route{
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/api/createFeed",
|
Path: "/api/createFeed",
|
||||||
Handler: func(c echo.Context) error {
|
Handler: func(c echo.Context) error {
|
||||||
return ical.CreateIndividualFeed(c, app)
|
requestBody, _ := io.ReadAll(c.Request().Body)
|
||||||
|
result, err := ical.CreateIndividualFeed(requestBody, app)
|
||||||
|
if err != nil {
|
||||||
|
return c.JSON(http.StatusInternalServerError, err)
|
||||||
|
}
|
||||||
|
return c.JSON(http.StatusOK, result)
|
||||||
|
|
||||||
},
|
},
|
||||||
Middlewares: []echo.MiddlewareFunc{
|
Middlewares: []echo.MiddlewareFunc{
|
||||||
apis.ActivityLogger(app),
|
apis.ActivityLogger(app),
|
||||||
@@ -132,7 +142,13 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
|||||||
Handler: func(c echo.Context) error {
|
Handler: func(c echo.Context) error {
|
||||||
course := c.QueryParam("course")
|
course := c.QueryParam("course")
|
||||||
semester := c.QueryParam("semester")
|
semester := c.QueryParam("semester")
|
||||||
return events.GetModulesForCourseDistinct(app, c, course, semester)
|
modules, err := events.GetModulesForCourseDistinct(app, course, semester)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return c.JSON(400, err)
|
||||||
|
} else {
|
||||||
|
return c.JSON(200, modules)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Middlewares: []echo.MiddlewareFunc{
|
Middlewares: []echo.MiddlewareFunc{
|
||||||
apis.ActivityLogger(app),
|
apis.ActivityLogger(app),
|
||||||
@@ -161,12 +177,62 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/api/module",
|
||||||
|
Handler: func(c echo.Context) error {
|
||||||
|
name := c.Request().Header.Get("Name")
|
||||||
|
name, err := url.QueryUnescape(name)
|
||||||
|
module, err := events.GetModuleByName(app, name)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return c.JSON(400, err)
|
||||||
|
} else {
|
||||||
|
return c.JSON(200, module)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Middlewares: []echo.MiddlewareFunc{
|
||||||
|
apis.ActivityLogger(app),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
_, err := e.Router.AddRoute(echo.Route{
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
Path: "/api/courses",
|
Path: "/api/courses",
|
||||||
Handler: func(c echo.Context) error {
|
Handler: func(c echo.Context) error {
|
||||||
return events.GetAllCourses(app, c)
|
courses := events.GetAllCourses(app)
|
||||||
|
return c.JSON(200, courses)
|
||||||
|
},
|
||||||
|
Middlewares: []echo.MiddlewareFunc{
|
||||||
|
apis.ActivityLogger(app),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
|
Method: http.MethodDelete,
|
||||||
|
Path: "/api/events",
|
||||||
|
Handler: func(c echo.Context) error {
|
||||||
|
course := c.QueryParam("course")
|
||||||
|
semester := c.QueryParam("semester")
|
||||||
|
err := events.DeleteAllEventsByCourseAndSemester(app, course, semester)
|
||||||
|
if err != nil {
|
||||||
|
return c.JSON(400, err)
|
||||||
|
} else {
|
||||||
|
return c.JSON(200, "Events deleted")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Middlewares: []echo.MiddlewareFunc{
|
Middlewares: []echo.MiddlewareFunc{
|
||||||
apis.ActivityLogger(app),
|
apis.ActivityLogger(app),
|
||||||
|
40
backend/service/addSchedule.go
Normal file
40
backend/service/addSchedule.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pocketbase/pocketbase"
|
||||||
|
"github.com/pocketbase/pocketbase/core"
|
||||||
|
"github.com/pocketbase/pocketbase/tools/cron"
|
||||||
|
"htwkalender/service/events"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AddSchedules(app *pocketbase.PocketBase) {
|
||||||
|
|
||||||
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
scheduler := cron.New()
|
||||||
|
|
||||||
|
// Every hour update all courses (5 segments - minute, hour, day, month, weekday) "0 * * * *"
|
||||||
|
// Every three hours update all courses (5 segments - minute, hour, day, month, weekday) "0 */3 * * *"
|
||||||
|
// Every 10 minutes update all courses (5 segments - minute, hour, day, month, weekday) "*/10 * * * *"
|
||||||
|
scheduler.MustAdd("updateCourse", "0 */3 * * *", func() {
|
||||||
|
|
||||||
|
courses := events.GetAllCourses(app)
|
||||||
|
|
||||||
|
for _, course := range courses {
|
||||||
|
err := events.UpdateModulesForCourse(app, course)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Update Course: " + course + " failed")
|
||||||
|
log.Println(err)
|
||||||
|
} else {
|
||||||
|
log.Println("Update Course: " + course + " successful")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
scheduler.Start()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
@@ -77,6 +77,8 @@ func findEventByDayWeekStartEndNameCourse(event model.Event, course string, app
|
|||||||
return &event, err
|
return &event, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPlanForModules returns all events for the given modules with the given course
|
||||||
|
// used for the ical feed
|
||||||
func GetPlanForModules(app *pocketbase.PocketBase, modules []model.FeedCollection) model.Events {
|
func GetPlanForModules(app *pocketbase.PocketBase, modules []model.FeedCollection) model.Events {
|
||||||
|
|
||||||
// build query functions with name equals elements in modules for dbx query
|
// build query functions with name equals elements in modules for dbx query
|
||||||
@@ -100,51 +102,50 @@ func GetPlanForModules(app *pocketbase.PocketBase, modules []model.FeedCollectio
|
|||||||
return events
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAllModulesForCourse(app *pocketbase.PocketBase, course string, semester string) ([]string, error) {
|
func GetAllModulesForCourse(app *pocketbase.PocketBase, course string, semester string) (model.Events, error) {
|
||||||
var events []struct {
|
var events model.Events
|
||||||
Name string `db:"Name" json:"Name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var eventArray []string
|
|
||||||
|
|
||||||
// get all events from event records in the events collection
|
// get all events from event records in the events collection
|
||||||
err := app.Dao().DB().Select("Name").From("events").Where(dbx.NewExp("course = {:course} AND semester = {:semester}", dbx.Params{"course": course, "semester": semester})).Distinct(true).All(&events)
|
err := app.Dao().DB().Select("*").From("events").Where(dbx.NewExp("course = {:course} AND semester = {:semester}", dbx.Params{"course": course, "semester": semester})).GroupBy("Name").Distinct(true).All(&events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
print("Error while getting events from database: ", err)
|
print("Error while getting events from database: ", err)
|
||||||
return eventArray, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, event := range events {
|
return events, nil
|
||||||
eventArray = append(eventArray, event.Name)
|
|
||||||
}
|
|
||||||
return eventArray, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAllModulesDistinct(app *pocketbase.PocketBase) ([]struct {
|
func GetAllModulesDistinctByNameAndCourse(app *pocketbase.PocketBase) (model.Events, error) {
|
||||||
Name string
|
var events model.Events
|
||||||
Course string
|
|
||||||
}, error) {
|
|
||||||
var events []struct {
|
|
||||||
Name string `db:"Name" json:"Name"`
|
|
||||||
Course string `db:"course" json:"course"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var eventArray []struct {
|
err := app.Dao().DB().Select("*").From("events").GroupBy("Name", "course").Distinct(true).All(&events)
|
||||||
Name string
|
|
||||||
Course string
|
|
||||||
}
|
|
||||||
|
|
||||||
err := app.Dao().DB().Select("Name", "course").From("events").Distinct(true).All(&events)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
print("Error while getting events from database: ", err)
|
print("Error while getting events from database: ", err)
|
||||||
return eventArray, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, event := range events {
|
return events, nil
|
||||||
eventArray = append(eventArray, struct {
|
}
|
||||||
Name string
|
|
||||||
Course string
|
func DeleteAllEventsForCourse(app *pocketbase.PocketBase, course string, semester string) error {
|
||||||
}{event.Name, event.Course})
|
_, err := app.Dao().DB().Delete("events", dbx.NewExp("course = {:course} AND semester = {:semester}", dbx.Params{"course": course, "semester": semester})).Execute()
|
||||||
}
|
|
||||||
return eventArray, nil
|
if err != nil {
|
||||||
|
print("Error while deleting events from database: ", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindAllEventsByModule(app *pocketbase.PocketBase, moduleName string) (model.Events, error) {
|
||||||
|
var events model.Events
|
||||||
|
|
||||||
|
err := app.Dao().DB().Select("*").From("events").Where(dbx.NewExp("Name = {:moduleName}", dbx.Params{"moduleName": moduleName})).All(&events)
|
||||||
|
if err != nil {
|
||||||
|
print("Error while getting events from database: ", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return events, nil
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,10 @@
|
|||||||
package events
|
package events
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v5"
|
|
||||||
"github.com/pocketbase/pocketbase"
|
"github.com/pocketbase/pocketbase"
|
||||||
"htwkalender/service/db"
|
"htwkalender/service/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAllCourses(app *pocketbase.PocketBase, c echo.Context) error {
|
func GetAllCourses(app *pocketbase.PocketBase) []string {
|
||||||
courses := db.GetAllCourses(app)
|
return db.GetAllCourses(app)
|
||||||
return c.JSON(200, courses)
|
|
||||||
}
|
}
|
||||||
|
@@ -3,36 +3,24 @@ package events
|
|||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v5"
|
"github.com/labstack/echo/v5"
|
||||||
"github.com/pocketbase/pocketbase"
|
"github.com/pocketbase/pocketbase"
|
||||||
|
"github.com/pocketbase/pocketbase/apis"
|
||||||
|
"htwkalender/model"
|
||||||
"htwkalender/service/db"
|
"htwkalender/service/db"
|
||||||
|
"htwkalender/service/fetch"
|
||||||
"htwkalender/service/functions"
|
"htwkalender/service/functions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetModulesForCourseDistinct(app *pocketbase.PocketBase, c echo.Context, course string, semester string) error {
|
func GetModulesForCourseDistinct(app *pocketbase.PocketBase, course string, semester string) (model.Events, error) {
|
||||||
|
|
||||||
modules, err := db.GetAllModulesForCourse(app, course, semester)
|
modules, err := db.GetAllModulesForCourse(app, course, semester)
|
||||||
replaceEmptyEntryInStringArray(modules, "Sonderveranstaltungen")
|
replaceEmptyEntry(modules, "Sonderveranstaltungen")
|
||||||
|
return modules, err
|
||||||
if err != nil {
|
|
||||||
return c.JSON(400, err)
|
|
||||||
} else {
|
|
||||||
return c.JSON(200, modules)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func replaceEmptyEntryInStringArray(modules []string, replacement string) {
|
// replaceEmptyEntry replaces an empty entry in a module with a replacement string
|
||||||
//replace empty functions with "Sonderveranstaltungen"
|
// If the module is not empty, nothing happens
|
||||||
for i, module := range modules {
|
func replaceEmptyEntry(modules model.Events, replacement string) {
|
||||||
if functions.OnlyWhitespace(module) {
|
|
||||||
modules[i] = replacement
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func replaceEmptyEntry(modules []struct {
|
|
||||||
Name string
|
|
||||||
Course string
|
|
||||||
}, replacement string) {
|
|
||||||
//replace empty functions with "Sonderveranstaltungen"
|
|
||||||
for i, module := range modules {
|
for i, module := range modules {
|
||||||
if functions.OnlyWhitespace(module.Name) {
|
if functions.OnlyWhitespace(module.Name) {
|
||||||
modules[i].Name = replacement
|
modules[i].Name = replacement
|
||||||
@@ -40,8 +28,10 @@ func replaceEmptyEntry(modules []struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAllModulesDistinct returns all modules distinct by name and course from the database
|
||||||
|
// That means you get all modules with duplicates if they have different courses
|
||||||
func GetAllModulesDistinct(app *pocketbase.PocketBase, c echo.Context) error {
|
func GetAllModulesDistinct(app *pocketbase.PocketBase, c echo.Context) error {
|
||||||
modules, err := db.GetAllModulesDistinct(app)
|
modules, err := db.GetAllModulesDistinctByNameAndCourse(app)
|
||||||
|
|
||||||
replaceEmptyEntry(modules, "Sonderveranstaltungen")
|
replaceEmptyEntry(modules, "Sonderveranstaltungen")
|
||||||
|
|
||||||
@@ -51,3 +41,134 @@ func GetAllModulesDistinct(app *pocketbase.PocketBase, c echo.Context) error {
|
|||||||
return c.JSON(200, modules)
|
return c.JSON(200, modules)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetModuleByName returns a module by its name
|
||||||
|
// If the module does not exist, an error is returned
|
||||||
|
// If the module exists, the module is returned
|
||||||
|
// Module is a struct that exists in database as events
|
||||||
|
func GetModuleByName(app *pocketbase.PocketBase, name string) (model.Module, error) {
|
||||||
|
events, err := db.FindAllEventsByModule(app, name)
|
||||||
|
|
||||||
|
if err != nil || len(events) == 0 {
|
||||||
|
return model.Module{}, err
|
||||||
|
} else {
|
||||||
|
return model.Module{
|
||||||
|
Name: name,
|
||||||
|
Events: events,
|
||||||
|
Prof: events[0].Prof,
|
||||||
|
Course: events[0].Course,
|
||||||
|
Semester: events[0].Semester,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteAllEventsByCourseAndSemester deletes all events for a course and a semester
|
||||||
|
// If the deletion was successful, nil is returned
|
||||||
|
// If the deletion was not successful, an error is returned
|
||||||
|
func DeleteAllEventsByCourseAndSemester(app *pocketbase.PocketBase, course string, semester string) error {
|
||||||
|
err := db.DeleteAllEventsForCourse(app, course, semester)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateModulesForCourse updates all modules for a course
|
||||||
|
// Does Updates for ws and ss semester sequentially
|
||||||
|
// Update runs through the following steps:
|
||||||
|
// 1. Delete all events for the course and the semester
|
||||||
|
// 2. Fetch all events for the course and the semester
|
||||||
|
// 3. Save all events for the course and the semester
|
||||||
|
// If the update was successful, nil is returned
|
||||||
|
// If the update was not successful, an error is returned
|
||||||
|
func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
|
||||||
|
|
||||||
|
//new string array with one element (course)
|
||||||
|
var courses []string
|
||||||
|
courses = append(courses, course)
|
||||||
|
|
||||||
|
seminarGroups := fetch.GetSeminarGroupsEventsFromHTML(courses)
|
||||||
|
|
||||||
|
collection, dbError := db.FindCollection(app, "events")
|
||||||
|
if dbError != nil {
|
||||||
|
return apis.NewNotFoundError("Collection not found", dbError)
|
||||||
|
}
|
||||||
|
|
||||||
|
seminarGroups = fetch.ClearEmptySeminarGroups(seminarGroups)
|
||||||
|
|
||||||
|
seminarGroups = fetch.ReplaceEmptyEventNames(seminarGroups)
|
||||||
|
|
||||||
|
//check if events in the seminarGroups Events are already in the database
|
||||||
|
//if yes, keep the database as it is
|
||||||
|
//if no, delete all events for the course and the semester and save the new events
|
||||||
|
//if there are no events in the database, save the new events
|
||||||
|
|
||||||
|
//get all events for the course and the semester
|
||||||
|
events, err := db.GetAllModulesForCourse(app, course, "ws")
|
||||||
|
if err != nil {
|
||||||
|
return apis.NewNotFoundError("Events for winter semester could not be found", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// append all events for the course and the semester to the events array for ss
|
||||||
|
summerEvents, err := db.GetAllModulesForCourse(app, course, "ss")
|
||||||
|
if err != nil {
|
||||||
|
return apis.NewNotFoundError("Events for summer semester could not be found", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
events = append(events, summerEvents...)
|
||||||
|
|
||||||
|
//if there are no events in the database, save the new events
|
||||||
|
if len(events) == 0 {
|
||||||
|
_, dbError = db.SaveEvents(seminarGroups, collection, app)
|
||||||
|
if dbError != nil {
|
||||||
|
return apis.NewNotFoundError("Events could not be saved", dbError)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//check if events in the seminarGroups Events are already in the database
|
||||||
|
//if yes, keep the database as it is
|
||||||
|
//if no, delete all events for the course and the semester and save the new events
|
||||||
|
for _, seminarGroup := range seminarGroups {
|
||||||
|
for _, event := range seminarGroup.Events {
|
||||||
|
// if the event is not in the database, delete all events for the course and the semester and save the new events
|
||||||
|
if !ContainsEvent(events, event) {
|
||||||
|
|
||||||
|
err = DeleteAllEventsByCourseAndSemester(app, course, "ws")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = DeleteAllEventsByCourseAndSemester(app, course, "ss")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
//save the new events
|
||||||
|
_, dbError = db.SaveEvents(seminarGroups, collection, app)
|
||||||
|
if dbError != nil {
|
||||||
|
return apis.NewNotFoundError("Events could not be saved", dbError)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ContainsEvent(events model.Events, event model.Event) bool {
|
||||||
|
for _, e := range events {
|
||||||
|
if e.Name == event.Name &&
|
||||||
|
e.Prof == event.Prof &&
|
||||||
|
e.Rooms == event.Rooms &&
|
||||||
|
e.Semester == event.Semester &&
|
||||||
|
e.Start == event.Start &&
|
||||||
|
e.End == event.End &&
|
||||||
|
e.Course == event.Course {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@@ -28,7 +28,9 @@ func GetSeminarEvents(c echo.Context, app *pocketbase.PocketBase) error {
|
|||||||
return apis.NewNotFoundError("Collection not found", dbError)
|
return apis.NewNotFoundError("Collection not found", dbError)
|
||||||
}
|
}
|
||||||
|
|
||||||
seminarGroups = clearEmptySeminarGroups(seminarGroups)
|
seminarGroups = ClearEmptySeminarGroups(seminarGroups)
|
||||||
|
|
||||||
|
seminarGroups = ReplaceEmptyEventNames(seminarGroups)
|
||||||
|
|
||||||
savedRecords, dbError := db.SaveEvents(seminarGroups, collection, app)
|
savedRecords, dbError := db.SaveEvents(seminarGroups, collection, app)
|
||||||
|
|
||||||
@@ -39,7 +41,18 @@ func GetSeminarEvents(c echo.Context, app *pocketbase.PocketBase) error {
|
|||||||
return c.JSON(http.StatusOK, savedRecords)
|
return c.JSON(http.StatusOK, savedRecords)
|
||||||
}
|
}
|
||||||
|
|
||||||
func clearEmptySeminarGroups(seminarGroups []model.SeminarGroup) []model.SeminarGroup {
|
func ReplaceEmptyEventNames(groups []model.SeminarGroup) []model.SeminarGroup {
|
||||||
|
for i, group := range groups {
|
||||||
|
for j, event := range group.Events {
|
||||||
|
if event.Name == "" {
|
||||||
|
groups[i].Events[j].Name = "Sonderveranstaltungen"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return groups
|
||||||
|
}
|
||||||
|
|
||||||
|
func ClearEmptySeminarGroups(seminarGroups []model.SeminarGroup) []model.SeminarGroup {
|
||||||
var newSeminarGroups []model.SeminarGroup
|
var newSeminarGroups []model.SeminarGroup
|
||||||
for _, seminarGroup := range seminarGroups {
|
for _, seminarGroup := range seminarGroups {
|
||||||
if len(seminarGroup.Events) > 0 && seminarGroup.Course != "" {
|
if len(seminarGroup.Events) > 0 && seminarGroup.Course != "" {
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
package fetch
|
package fetch
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"htwkalender/model"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
func Test_extractSemesterAndYear(t *testing.T) {
|
func Test_extractSemesterAndYear(t *testing.T) {
|
||||||
type args struct {
|
type args struct {
|
||||||
@@ -50,3 +54,68 @@ func Test_extractSemesterAndYear(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_replaceEmptyEventNames(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
groups []model.SeminarGroup
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
want []model.SeminarGroup
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Test 1",
|
||||||
|
args: args{
|
||||||
|
groups: []model.SeminarGroup{
|
||||||
|
{
|
||||||
|
Events: []model.Event{
|
||||||
|
{
|
||||||
|
Name: "Test",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: []model.SeminarGroup{
|
||||||
|
{
|
||||||
|
Events: []model.Event{
|
||||||
|
{
|
||||||
|
Name: "Test",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Test 1",
|
||||||
|
args: args{
|
||||||
|
groups: []model.SeminarGroup{
|
||||||
|
{
|
||||||
|
Events: []model.Event{
|
||||||
|
{
|
||||||
|
Name: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: []model.SeminarGroup{
|
||||||
|
{
|
||||||
|
Events: []model.Event{
|
||||||
|
{
|
||||||
|
Name: "Sonderveranstaltungen",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if got := ReplaceEmptyEventNames(tt.args.groups); !reflect.DeepEqual(got, tt.want) {
|
||||||
|
t.Errorf("ReplaceEmptyEventNames() = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -20,3 +20,10 @@ func Contains(s []string, e string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ReplaceEmptyString(word string, replacement string) string {
|
||||||
|
if OnlyWhitespace(word) {
|
||||||
|
return replacement
|
||||||
|
}
|
||||||
|
return word
|
||||||
|
}
|
||||||
|
@@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/apis"
|
"github.com/pocketbase/pocketbase/apis"
|
||||||
"htwkalender/model"
|
"htwkalender/model"
|
||||||
"htwkalender/service/db"
|
"htwkalender/service/db"
|
||||||
"io"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -63,18 +62,12 @@ func writeSuccess(message string, w http.ResponseWriter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateIndividualFeed(c echo.Context, app *pocketbase.PocketBase) error {
|
func CreateIndividualFeed(requestBody []byte, app *pocketbase.PocketBase) (string, error) {
|
||||||
|
|
||||||
// read json from request body
|
|
||||||
var modules []model.FeedCollection
|
var modules []model.FeedCollection
|
||||||
requestBodyBytes, err := io.ReadAll(c.Request().Body)
|
|
||||||
if err != nil {
|
|
||||||
return apis.NewApiError(400, "Could not bind request body", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal(requestBodyBytes, &modules)
|
err := json.Unmarshal(requestBody, &modules)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return apis.NewApiError(400, "Could not bind request body", err)
|
return "", apis.NewNotFoundError("Could not parse request body", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var feed model.Feed
|
var feed model.Feed
|
||||||
@@ -83,13 +76,13 @@ func CreateIndividualFeed(c echo.Context, app *pocketbase.PocketBase) error {
|
|||||||
|
|
||||||
collection, dbError := db.FindCollection(app, "feeds")
|
collection, dbError := db.FindCollection(app, "feeds")
|
||||||
if dbError != nil {
|
if dbError != nil {
|
||||||
return apis.NewNotFoundError("Collection not found", dbError)
|
return "", apis.NewNotFoundError("Collection could not be found", dbError)
|
||||||
}
|
}
|
||||||
|
|
||||||
record, err := db.SaveFeed(feed, collection, app)
|
record, err := db.SaveFeed(feed, collection, app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return apis.NewNotFoundError("Feed could not be saved", dbError)
|
return "", apis.NewNotFoundError("Could not save feed", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, record.Id)
|
return record.Id, nil
|
||||||
}
|
}
|
||||||
|
@@ -62,6 +62,9 @@ func generateDescription(event *model.Event) string {
|
|||||||
if !functions.OnlyWhitespace(event.Course) {
|
if !functions.OnlyWhitespace(event.Course) {
|
||||||
description += "Gruppe: " + event.Course + "\n"
|
description += "Gruppe: " + event.Course + "\n"
|
||||||
}
|
}
|
||||||
|
if !functions.OnlyWhitespace(event.EventType) {
|
||||||
|
description += "Typ: " + event.EventType + "\n"
|
||||||
|
}
|
||||||
|
|
||||||
return description
|
return description
|
||||||
}
|
}
|
||||||
|
@@ -24,8 +24,8 @@ export async function fetchModulesByCourseAndSemester(
|
|||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then((modulesResponse) => {
|
.then((modulesResponse) => {
|
||||||
modulesResponse.forEach((module: string) =>
|
modulesResponse.forEach((module: Module) =>
|
||||||
modules.push(new Module(module, course, module)),
|
modules.push(new Module(module.name, course, module.name)),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
return modules;
|
return modules;
|
||||||
@@ -39,7 +39,7 @@ export async function fetchAllModules(): Promise<Module[]> {
|
|||||||
})
|
})
|
||||||
.then((responseModules: Module[]) => {
|
.then((responseModules: Module[]) => {
|
||||||
responseModules.forEach((module: Module) => {
|
responseModules.forEach((module: Module) => {
|
||||||
modules.push(new Module(module.Name, module.Course, module.Name));
|
modules.push(new Module(module.name, module.course, module.name));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
27
frontend/src/api/fetchModule.ts
Normal file
27
frontend/src/api/fetchModule.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { Module } from "../model/module.ts";
|
||||||
|
|
||||||
|
export async function fetchModule( name: string): Promise<Module> {
|
||||||
|
const request = new Request("/api/module", {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Name: encodeURI(name),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return await fetch(request)
|
||||||
|
.then((response) => {
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(
|
||||||
|
(module: Module) =>
|
||||||
|
new Module(
|
||||||
|
module.name,
|
||||||
|
module.course,
|
||||||
|
module.name,
|
||||||
|
module.prof,
|
||||||
|
module.semester,
|
||||||
|
module.events,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
@@ -1,11 +1,15 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, Ref } from "vue";
|
import { defineAsyncComponent, ref, Ref } from "vue";
|
||||||
import { Module } from "../model/module.ts";
|
import { Module } from "../model/module.ts";
|
||||||
import { fetchAllModules } from "../api/fetchCourse.ts";
|
import { fetchAllModules } from "../api/fetchCourse.ts";
|
||||||
import moduleStore from "../store/moduleStore.ts";
|
import moduleStore from "../store/moduleStore.ts";
|
||||||
import { MultiSelectAllChangeEvent } from "primevue/multiselect";
|
import { MultiSelectAllChangeEvent } from "primevue/multiselect";
|
||||||
|
|
||||||
|
import { useDialog } from "primevue/usedialog";
|
||||||
|
const dialog = useDialog();
|
||||||
|
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
|
import { fetchModule } from "../api/fetchModule.ts";
|
||||||
|
|
||||||
const fetchedModules = async () => {
|
const fetchedModules = async () => {
|
||||||
return await fetchAllModules();
|
return await fetchAllModules();
|
||||||
@@ -30,7 +34,35 @@ async function nextStep() {
|
|||||||
await router.push("/rename-modules");
|
await router.push("/rename-modules");
|
||||||
}
|
}
|
||||||
|
|
||||||
const display = (module: Module) => module.Name + " (" + module.Course + ")";
|
const ModuleInformation = defineAsyncComponent(
|
||||||
|
() => import("./ModuleInformation.vue"),
|
||||||
|
);
|
||||||
|
|
||||||
|
//TODO add missing module prop informations for ModuleInformation.vue
|
||||||
|
async function showInfo(moduleName : string) {
|
||||||
|
|
||||||
|
const module: Ref<Module> = ref(new Module("", "", "", "", "", []));
|
||||||
|
await fetchModule(moduleName).then((data) => {
|
||||||
|
module.value = data;
|
||||||
|
});
|
||||||
|
dialog.open(ModuleInformation, {
|
||||||
|
props: {
|
||||||
|
style: {
|
||||||
|
width: "50vw",
|
||||||
|
},
|
||||||
|
breakpoints: {
|
||||||
|
"960px": "75vw",
|
||||||
|
"640px": "90vw",
|
||||||
|
},
|
||||||
|
modal: true,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
module: module,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const display = (module: Module) => module.name + " (" + module.course + ")";
|
||||||
|
|
||||||
const selectAll = ref(false);
|
const selectAll = ref(false);
|
||||||
|
|
||||||
@@ -69,10 +101,23 @@ function selectChange() {
|
|||||||
@selectall-change="onSelectAllChange($event)"
|
@selectall-change="onSelectAllChange($event)"
|
||||||
>
|
>
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div class="flex align-items-center">
|
<div class="flex justify-content-between w-full">
|
||||||
<p class="text-1xl white-space-normal">
|
<div class="flex align-items-center justify-content-center">
|
||||||
{{ display(slotProps.option) }}
|
<p class="text-1xl white-space-normal p-mb-0">
|
||||||
</p>
|
{{ display(slotProps.option) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex align-items-center justify-content-center ml-2">
|
||||||
|
<Button
|
||||||
|
icon="pi pi-info"
|
||||||
|
severity="secondary"
|
||||||
|
rounded
|
||||||
|
outlined
|
||||||
|
aria-label="Information"
|
||||||
|
@click.stop="showInfo(slotProps.option.name)"
|
||||||
|
></Button>
|
||||||
|
<DynamicDialog />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
38
frontend/src/components/ModuleInformation.vue
Normal file
38
frontend/src/components/ModuleInformation.vue
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { inject } from "vue";
|
||||||
|
import { Module } from "../model/module.ts";
|
||||||
|
|
||||||
|
const dialogRef = inject("dialogRef") as any;
|
||||||
|
const module = dialogRef.value.data.module as Module;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h2>{{ module.name }}</h2>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Course: {{ module.course }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Person: {{ module.prof }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Semester: {{ module.semester }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="card">
|
||||||
|
<DataTable :value="module.events" tableStyle="min-width: 50rem">
|
||||||
|
<Column field="day" header="Day"></Column>
|
||||||
|
<Column field="start" header="Start"></Column>
|
||||||
|
<Column field="end" header="End"></Column>
|
||||||
|
<Column field="rooms" header="Room"></Column>
|
||||||
|
<Column field="eventType" header="Type"></Column>
|
||||||
|
<Column field="week" header="Week"></Column>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</template>
|
@@ -105,7 +105,7 @@ function nextStep() {
|
|||||||
class="flex flex-column align-items-center sm:align-items-start gap-3"
|
class="flex flex-column align-items-center sm:align-items-start gap-3"
|
||||||
>
|
>
|
||||||
<div class="text-2xl">
|
<div class="text-2xl">
|
||||||
{{ slotProps.data.module.Name }}
|
{{ slotProps.data.module.name }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
@@ -7,7 +7,7 @@ import { ref } from "vue";
|
|||||||
|
|
||||||
const tableData = ref(moduleStore().modules.map((module) => {
|
const tableData = ref(moduleStore().modules.map((module) => {
|
||||||
return {
|
return {
|
||||||
Course: module.Course,
|
Course: module.course,
|
||||||
Module: module,
|
Module: module,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -36,14 +36,14 @@ async function finalStep() {
|
|||||||
<DataTable :value="tableData" editMode="cell" tableClass="editable-cells-table" responsiveLayout="scroll">
|
<DataTable :value="tableData" editMode="cell" tableClass="editable-cells-table" responsiveLayout="scroll">
|
||||||
<Column v-for="col of columns" :key="col.field" :field="col.field" :header="col.header">
|
<Column v-for="col of columns" :key="col.field" :field="col.field" :header="col.header">
|
||||||
<template #body="{ data, field }" >
|
<template #body="{ data, field }" >
|
||||||
<div>{{ field === 'Module' ? data[field].UserDefinedName : data[field] }}</div>
|
<div>{{ field === 'Module' ? data[field].userDefinedName : data[field] }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template #editor="{ data, field }">
|
<template #editor="{ data, field }">
|
||||||
<template v-if="field !== 'Module'">
|
<template v-if="field !== 'Module'">
|
||||||
<div>{{ data[field] }}</div>
|
<div>{{ data[field] }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<InputText class="w-full" v-model="data[field].UserDefinedName" autofocus />
|
<InputText class="w-full" v-model="data[field].userDefinedName" autofocus />
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
|
@@ -23,6 +23,9 @@ import Accordion from 'primevue/accordion';
|
|||||||
import AccordionTab from 'primevue/accordiontab';
|
import AccordionTab from 'primevue/accordiontab';
|
||||||
import DataTable from "primevue/datatable";
|
import DataTable from "primevue/datatable";
|
||||||
import Column from "primevue/column";
|
import Column from "primevue/column";
|
||||||
|
import DynamicDialog from 'primevue/dynamicdialog';
|
||||||
|
import DialogService from 'primevue/dialogservice';
|
||||||
|
import ProgressSpinner from 'primevue/progressspinner';
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
@@ -31,6 +34,7 @@ app.use(PrimeVue);
|
|||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(ToastService);
|
app.use(ToastService);
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
|
app.use(DialogService);
|
||||||
app.component("Button", Button);
|
app.component("Button", Button);
|
||||||
app.component("Menubar", Menubar);
|
app.component("Menubar", Menubar);
|
||||||
app.component("Dropdown", Dropdown);
|
app.component("Dropdown", Dropdown);
|
||||||
@@ -46,4 +50,6 @@ app.component("Accordion", Accordion);
|
|||||||
app.component("AccordionTab", AccordionTab);
|
app.component("AccordionTab", AccordionTab);
|
||||||
app.component("DataTable", DataTable);
|
app.component("DataTable", DataTable);
|
||||||
app.component("Column", Column);
|
app.component("Column", Column);
|
||||||
|
app.component("DynamicDialog", DynamicDialog);
|
||||||
|
app.component("ProgressSpinner", ProgressSpinner);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
14
frontend/src/model/event.ts
Normal file
14
frontend/src/model/event.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
export class Event {
|
||||||
|
constructor(
|
||||||
|
public name: string,
|
||||||
|
public day: string,
|
||||||
|
public start: string,
|
||||||
|
public end: string,
|
||||||
|
public prof: string,
|
||||||
|
public week: string,
|
||||||
|
public eventType: string,
|
||||||
|
public rooms: string,
|
||||||
|
public notes: string,
|
||||||
|
) {}
|
||||||
|
}
|
@@ -1,7 +1,12 @@
|
|||||||
|
import { Event } from './event';
|
||||||
|
|
||||||
export class Module {
|
export class Module {
|
||||||
constructor(
|
constructor(
|
||||||
public Name: string,
|
public name: string,
|
||||||
public Course: string,
|
public course: string,
|
||||||
public UserDefinedName: string,
|
public userDefinedName: string,
|
||||||
|
public prof: string,
|
||||||
|
public semester: string,
|
||||||
|
public events: Event[] = [],
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@ import Faq from "../components/FaqPage.vue";
|
|||||||
import CourseSelection from "../components/CourseSelection.vue";
|
import CourseSelection from "../components/CourseSelection.vue";
|
||||||
import AdditionalModules from "../components/AdditionalModules.vue";
|
import AdditionalModules from "../components/AdditionalModules.vue";
|
||||||
import CalendarLink from "../components/CalendarLink.vue";
|
import CalendarLink from "../components/CalendarLink.vue";
|
||||||
import Impress from "../components/Imprint.vue";
|
import Imprint from "../components/Imprint.vue";
|
||||||
import PrivacyPolicy from "../components/PrivacyPolicy.vue";
|
import PrivacyPolicy from "../components/PrivacyPolicy.vue";
|
||||||
import RenameModules from "../components/RenameModules.vue";
|
import RenameModules from "../components/RenameModules.vue";
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ const router = createRouter({
|
|||||||
component: PrivacyPolicy,
|
component: PrivacyPolicy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/impress",
|
path: "/imprint",
|
||||||
name: "impress",
|
name: "imprint",
|
||||||
component: Impress,
|
component: Imprint,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/rename-modules",
|
path: "/rename-modules",
|
||||||
|
Reference in New Issue
Block a user