diff --git a/backend/service/fetch/v1/fetchSeminarEventService.go b/backend/service/fetch/v1/fetchSeminarEventService.go index 6fac5a3..eace23c 100644 --- a/backend/service/fetch/v1/fetchSeminarEventService.go +++ b/backend/service/fetch/v1/fetchSeminarEventService.go @@ -2,43 +2,18 @@ package v1 import ( "fmt" + "github.com/google/uuid" + "github.com/pocketbase/pocketbase/tools/types" + "golang.org/x/net/html" "htwkalender/model" "htwkalender/service/date" - "htwkalender/service/db" "htwkalender/service/fetch" - "net/http" "regexp" "strconv" "strings" "time" - - "github.com/google/uuid" - "github.com/labstack/echo/v5" - "github.com/pocketbase/pocketbase" - "github.com/pocketbase/pocketbase/apis" - "github.com/pocketbase/pocketbase/tools/types" - "golang.org/x/net/html" ) -func GetSeminarEvents(c echo.Context, app *pocketbase.PocketBase) error { - - seminarGroupsLabel := db.GetAllCourses(app) - - seminarGroups := GetSeminarGroupsEventsFromHTML(seminarGroupsLabel) - - seminarGroups = ClearEmptySeminarGroups(seminarGroups) - - seminarGroups = ReplaceEmptyEventNames(seminarGroups) - - dbError, savedRecords := db.SaveSeminarGroupEvents(seminarGroups, app) - - if dbError != nil { - return apis.NewNotFoundError("Events could not be saved", dbError.Error()) - } - - return c.JSON(http.StatusOK, savedRecords) -} - func ReplaceEmptyEventNames(groups []model.SeminarGroup) []model.SeminarGroup { for i, group := range groups { for j, event := range group.Events {