From 42f585687072d3b91a7c9ee7168d12a0f01cd68b Mon Sep 17 00:00:00 2001 From: Elmar Kresse Date: Sun, 20 Apr 2025 15:46:43 +0200 Subject: [PATCH] feat:#65 adjusted missing changes backend migration --- .../1695150679_collections_snapshot.go | 399 ------ .../1695151278_add_admin_account.go | 50 - .../1697532023_collections_snapshot.go | 400 ------ .../1697570688_collections_snapshot.go | 400 ------ .../migrations/1698017941_updated_events.go | 68 - .../migrations/1698770845_updated_events.go | 157 -- .../migrations/1698770863_updated_events.go | 53 - .../1698770891_collections_snapshot.go | 447 ------ .../migrations/1700512738_updated_feeds.go | 68 - .../1700512916_collections_snapshot.go | 460 ------ .../1706827339_collections_snapshot.go | 477 ------ .../migrations/1706827586_updated_groups.go | 55 - .../1720871249_collections_snapshot.go | 461 ------ .../migrations/1720871405_updated_feeds.go | 51 - .../migrations/1741706407_updated_users.go | 44 - .../1745155564_collections_snapshot.go | 1273 +++++++++++++++++ .../data-manager/model/eventModel_test.go | 14 +- services/data-manager/model/feedModel_test.go | 6 +- .../service/db/{ => test}/dbFeeds_test.go | 60 +- .../feed/{ => test}/feedFunctions_test.go | 56 +- .../data-manager/service/fetch/v2/fetcher.go | 2 +- services/ical/model/eventModel_test.go | 14 +- services/ical/service/ical/ical.go | 4 +- services/ical/service/routes.go | 2 +- 24 files changed, 1348 insertions(+), 3673 deletions(-) delete mode 100644 services/data-manager/migrations/1695150679_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1695151278_add_admin_account.go delete mode 100644 services/data-manager/migrations/1697532023_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1697570688_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1698017941_updated_events.go delete mode 100644 services/data-manager/migrations/1698770845_updated_events.go delete mode 100644 services/data-manager/migrations/1698770863_updated_events.go delete mode 100644 services/data-manager/migrations/1698770891_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1700512738_updated_feeds.go delete mode 100644 services/data-manager/migrations/1700512916_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1706827339_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1706827586_updated_groups.go delete mode 100644 services/data-manager/migrations/1720871249_collections_snapshot.go delete mode 100644 services/data-manager/migrations/1720871405_updated_feeds.go delete mode 100644 services/data-manager/migrations/1741706407_updated_users.go create mode 100644 services/data-manager/migrations/1745155564_collections_snapshot.go rename services/data-manager/service/db/{ => test}/dbFeeds_test.go (56%) rename services/data-manager/service/feed/{ => test}/feedFunctions_test.go (84%) diff --git a/services/data-manager/migrations/1695150679_collections_snapshot.go b/services/data-manager/migrations/1695150679_collections_snapshot.go deleted file mode 100644 index 4e2da1a..0000000 --- a/services/data-manager/migrations/1695150679_collections_snapshot.go +++ /dev/null @@ -1,399 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "_pb_users_auth_", - "created": "2023-09-19 17:30:50.598Z", - "updated": "2023-09-19 17:31:15.957Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - }, - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-09-19 17:31:15.957Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-09-19 17:31:15.957Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-19 17:31:15.958Z", - "updated": "2023-09-19 17:31:15.958Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "7vsr9h6p", - "name": "Start", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "wwpokofe", - "name": "End", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_orp1NWL` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Day` + "`" + `,\n ` + "`" + `Week` + "`" + `,\n ` + "`" + `Start` + "`" + `,\n ` + "`" + `End` + "`" + `,\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `Prof` + "`" + `,\n ` + "`" + `Rooms` + "`" + `,\n ` + "`" + `EventType` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - } - ]` - - var collections []*models.Collection - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1695151278_add_admin_account.go b/services/data-manager/migrations/1695151278_add_admin_account.go deleted file mode 100644 index f5cde04..0000000 --- a/services/data-manager/migrations/1695151278_add_admin_account.go +++ /dev/null @@ -1,50 +0,0 @@ -//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 . - -package migrations - -import ( - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - admin := &models.Admin{} - admin.Email = "demo@htwkalender.de" - err := admin.SetPassword("htwkalender-demo") - if err != nil { - return err - } - - return dao.SaveAdmin(admin) - }, func(db dbx.Builder) error { // optional revert operation - - dao := daos.New(db) - - admin, _ := dao.FindAdminByEmail("test@example.com") - if admin != nil { - return dao.DeleteAdmin(admin) - } - - // already deleted - return nil - }) -} diff --git a/services/data-manager/migrations/1697532023_collections_snapshot.go b/services/data-manager/migrations/1697532023_collections_snapshot.go deleted file mode 100644 index de0e401..0000000 --- a/services/data-manager/migrations/1697532023_collections_snapshot.go +++ /dev/null @@ -1,400 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-09-19 17:31:15.957Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-10-17 08:37:17.943Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": null, - "viewRule": "", - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-19 17:31:15.958Z", - "updated": "2023-09-19 17:31:15.958Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "7vsr9h6p", - "name": "Start", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "wwpokofe", - "name": "End", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_orp1NWL` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Day` + "`" + `,\n ` + "`" + `Week` + "`" + `,\n ` + "`" + `Start` + "`" + `,\n ` + "`" + `End` + "`" + `,\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `Prof` + "`" + `,\n ` + "`" + `Rooms` + "`" + `,\n ` + "`" + `EventType` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "_pb_users_auth_", - "created": "2023-10-08 16:32:34.131Z", - "updated": "2023-10-08 16:32:34.315Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - } - ]` - - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1697570688_collections_snapshot.go b/services/data-manager/migrations/1697570688_collections_snapshot.go deleted file mode 100644 index bc8621d..0000000 --- a/services/data-manager/migrations/1697570688_collections_snapshot.go +++ /dev/null @@ -1,400 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-10-17 10:50:08.270Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-10-17 18:47:10.221Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": null, - "viewRule": "", - "createRule": null, - "updateRule": "", - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-19 17:31:15.958Z", - "updated": "2023-10-17 10:50:08.270Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "7vsr9h6p", - "name": "Start", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "wwpokofe", - "name": "End", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_orp1NWL` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Day` + "`" + `,\n ` + "`" + `Week` + "`" + `,\n ` + "`" + `Start` + "`" + `,\n ` + "`" + `End` + "`" + `,\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `Prof` + "`" + `,\n ` + "`" + `Rooms` + "`" + `,\n ` + "`" + `EventType` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "_pb_users_auth_", - "created": "2023-09-22 09:31:11.498Z", - "updated": "2023-10-17 10:50:08.270Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - } - ]` - - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1698017941_updated_events.go b/services/data-manager/migrations/1698017941_updated_events.go deleted file mode 100644 index 6756ccc..0000000 --- a/services/data-manager/migrations/1698017941_updated_events.go +++ /dev/null @@ -1,68 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models/schema" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("7her4515qsmrxe8") - if err != nil { - return err - } - - // add - new_uuid := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "0kahthzr", - "name": "uuid", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }`), new_uuid) - collection.Schema.AddField(new_uuid) - - return dao.SaveCollection(collection) - }, func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("7her4515qsmrxe8") - if err != nil { - return err - } - - // remove - collection.Schema.RemoveField("0kahthzr") - - return dao.SaveCollection(collection) - }) -} diff --git a/services/data-manager/migrations/1698770845_updated_events.go b/services/data-manager/migrations/1698770845_updated_events.go deleted file mode 100644 index 2b8fde5..0000000 --- a/services/data-manager/migrations/1698770845_updated_events.go +++ /dev/null @@ -1,157 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models/schema" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("7her4515qsmrxe8") - if err != nil { - return err - } - - json.Unmarshal([]byte(`[]`), &collection.Indexes) - - // remove - collection.Schema.RemoveField("7vsr9h6p") - - // remove - collection.Schema.RemoveField("wwpokofe") - - // add - new_start := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "6hkjwgb4", - "name": "start", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }`), new_start) - collection.Schema.AddField(new_start) - - // add - new_end := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "szbefpjf", - "name": "end", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }`), new_end) - collection.Schema.AddField(new_end) - - // add - new_Compulsory := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "nlnnxu7x", - "name": "Compulsory", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }`), new_Compulsory) - collection.Schema.AddField(new_Compulsory) - - return dao.SaveCollection(collection) - }, func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("7her4515qsmrxe8") - if err != nil { - return err - } - - json.Unmarshal([]byte(`[ - "CREATE UNIQUE INDEX `+"`"+`idx_orp1NWL`+"`"+` ON `+"`"+`events`+"`"+` (\n `+"`"+`Day`+"`"+`,\n `+"`"+`Week`+"`"+`,\n `+"`"+`Start`+"`"+`,\n `+"`"+`End`+"`"+`,\n `+"`"+`Name`+"`"+`,\n `+"`"+`course`+"`"+`,\n `+"`"+`Prof`+"`"+`,\n `+"`"+`Rooms`+"`"+`,\n `+"`"+`EventType`+"`"+`\n)" - ]`), &collection.Indexes) - - // add - del_Start := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "7vsr9h6p", - "name": "Start", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }`), del_Start) - collection.Schema.AddField(del_Start) - - // add - del_End := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "wwpokofe", - "name": "End", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }`), del_End) - collection.Schema.AddField(del_End) - - // remove - collection.Schema.RemoveField("6hkjwgb4") - - // remove - collection.Schema.RemoveField("szbefpjf") - - // remove - collection.Schema.RemoveField("nlnnxu7x") - - return dao.SaveCollection(collection) - }) -} diff --git a/services/data-manager/migrations/1698770863_updated_events.go b/services/data-manager/migrations/1698770863_updated_events.go deleted file mode 100644 index fd2f613..0000000 --- a/services/data-manager/migrations/1698770863_updated_events.go +++ /dev/null @@ -1,53 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("7her4515qsmrxe8") - if err != nil { - return err - } - - json.Unmarshal([]byte(`[ - "CREATE INDEX `+"`"+`idx_4vOTAiC`+"`"+` ON `+"`"+`events`+"`"+` (\n `+"`"+`Name`+"`"+`,\n `+"`"+`course`+"`"+`,\n `+"`"+`start`+"`"+`,\n `+"`"+`end`+"`"+`,\n `+"`"+`semester`+"`"+`,\n `+"`"+`EventType`+"`"+`,\n `+"`"+`Compulsory`+"`"+`\n)" - ]`), &collection.Indexes) - - return dao.SaveCollection(collection) - }, func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("7her4515qsmrxe8") - if err != nil { - return err - } - - json.Unmarshal([]byte(`[]`), &collection.Indexes) - - return dao.SaveCollection(collection) - }) -} diff --git a/services/data-manager/migrations/1698770891_collections_snapshot.go b/services/data-manager/migrations/1698770891_collections_snapshot.go deleted file mode 100644 index feb273a..0000000 --- a/services/data-manager/migrations/1698770891_collections_snapshot.go +++ /dev/null @@ -1,447 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "_pb_users_auth_", - "created": "2023-09-20 10:23:59.315Z", - "updated": "2023-10-17 22:18:39.192Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - }, - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-21 16:53:51.811Z", - "updated": "2023-10-17 22:18:39.190Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-21 16:53:51.812Z", - "updated": "2023-10-17 22:18:39.191Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "presentable": false, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": null, - "viewRule": "", - "createRule": null, - "updateRule": "", - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-28 12:07:17.340Z", - "updated": "2023-10-31 16:47:43.090Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "0kahthzr", - "name": "uuid", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "6hkjwgb4", - "name": "start", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "szbefpjf", - "name": "end", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "nlnnxu7x", - "name": "Compulsory", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE INDEX ` + "`" + `idx_4vOTAiC` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `start` + "`" + `,\n ` + "`" + `end` + "`" + `,\n ` + "`" + `semester` + "`" + `,\n ` + "`" + `EventType` + "`" + `,\n ` + "`" + `Compulsory` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - } - ]` - - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1700512738_updated_feeds.go b/services/data-manager/migrations/1700512738_updated_feeds.go deleted file mode 100644 index 0a1bc52..0000000 --- a/services/data-manager/migrations/1700512738_updated_feeds.go +++ /dev/null @@ -1,68 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models/schema" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("d65h4wh7zk13gxp") - if err != nil { - return err - } - - // add - new_retrieved := &schema.SchemaField{} - json.Unmarshal([]byte(`{ - "system": false, - "id": "wmmney8x", - "name": "retrieved", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }`), new_retrieved) - collection.Schema.AddField(new_retrieved) - - return dao.SaveCollection(collection) - }, func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("d65h4wh7zk13gxp") - if err != nil { - return err - } - - // remove - collection.Schema.RemoveField("wmmney8x") - - return dao.SaveCollection(collection) - }) -} diff --git a/services/data-manager/migrations/1700512916_collections_snapshot.go b/services/data-manager/migrations/1700512916_collections_snapshot.go deleted file mode 100644 index deb0aaa..0000000 --- a/services/data-manager/migrations/1700512916_collections_snapshot.go +++ /dev/null @@ -1,460 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-11-01 21:17:43.567Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2023-11-20 20:38:58.258Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "presentable": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "wmmney8x", - "name": "retrieved", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": "", - "createRule": null, - "updateRule": "", - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-19 17:31:15.958Z", - "updated": "2023-11-01 21:17:43.567Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "0kahthzr", - "name": "uuid", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "6hkjwgb4", - "name": "start", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "szbefpjf", - "name": "end", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "nlnnxu7x", - "name": "Compulsory", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE INDEX ` + "`" + `idx_4vOTAiC` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `start` + "`" + `,\n ` + "`" + `end` + "`" + `,\n ` + "`" + `semester` + "`" + `,\n ` + "`" + `EventType` + "`" + `,\n ` + "`" + `Compulsory` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "_pb_users_auth_", - "created": "2023-11-01 21:17:43.390Z", - "updated": "2023-11-01 21:17:43.567Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - } - ]` - - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1706827339_collections_snapshot.go b/services/data-manager/migrations/1706827339_collections_snapshot.go deleted file mode 100644 index 62b66f8..0000000 --- a/services/data-manager/migrations/1706827339_collections_snapshot.go +++ /dev/null @@ -1,477 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2024-02-01 22:35:50.512Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "bdhcrksy", - "name": "semester", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 2, - "pattern": "ws|ss" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2024-02-01 13:34:43.834Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } - }, - { - "system": false, - "id": "wmmney8x", - "name": "retrieved", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": "", - "createRule": null, - "updateRule": "", - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-19 17:31:15.958Z", - "updated": "2024-02-01 13:34:43.833Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "0kahthzr", - "name": "uuid", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "6hkjwgb4", - "name": "start", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "szbefpjf", - "name": "end", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "nlnnxu7x", - "name": "Compulsory", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE INDEX ` + "`" + `idx_4vOTAiC` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `start` + "`" + `,\n ` + "`" + `end` + "`" + `,\n ` + "`" + `semester` + "`" + `,\n ` + "`" + `EventType` + "`" + `,\n ` + "`" + `Compulsory` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "_pb_users_auth_", - "created": "2024-02-01 13:34:43.663Z", - "updated": "2024-02-01 13:34:43.833Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "maxSelect": 1, - "maxSize": 5242880, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "onlyVerified": false, - "requireEmail": false - } - } - ]` - - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1706827586_updated_groups.go b/services/data-manager/migrations/1706827586_updated_groups.go deleted file mode 100644 index 643ba94..0000000 --- a/services/data-manager/migrations/1706827586_updated_groups.go +++ /dev/null @@ -1,55 +0,0 @@ -//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 . - -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("cfq9mqlmd97v8z5") - if err != nil { - return err - } - - json.Unmarshal([]byte(`[ - "CREATE UNIQUE INDEX `+"`"+`idx_rcaN2Oq`+"`"+` ON `+"`"+`groups`+"`"+` (\n `+"`"+`course`+"`"+`,\n `+"`"+`semester`+"`"+`\n)" - ]`), &collection.Indexes) - - return dao.SaveCollection(collection) - }, func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("cfq9mqlmd97v8z5") - if err != nil { - return err - } - - json.Unmarshal([]byte(`[ - "CREATE UNIQUE INDEX `+"`"+`idx_rcaN2Oq`+"`"+` ON `+"`"+`groups`+"`"+` (`+"`"+`course`+"`"+`)" - ]`), &collection.Indexes) - - return dao.SaveCollection(collection) - }) -} diff --git a/services/data-manager/migrations/1720871249_collections_snapshot.go b/services/data-manager/migrations/1720871249_collections_snapshot.go deleted file mode 100644 index 4075f65..0000000 --- a/services/data-manager/migrations/1720871249_collections_snapshot.go +++ /dev/null @@ -1,461 +0,0 @@ -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" -) - -func init() { - m.Register(func(db dbx.Builder) error { - jsonData := `[ - { - "id": "cfq9mqlmd97v8z5", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2024-07-13 11:37:49.151Z", - "name": "groups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "85msl21p", - "name": "university", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "2sii4dtp", - "name": "shortcut", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "uiwgo28f", - "name": "groupId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "y0l1lrzs", - "name": "course", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "kr62mhbz", - "name": "faculty", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ya6znpez", - "name": "facultyId", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "bdhcrksy", - "name": "semester", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 2, - "pattern": "ws|ss" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (\n ` + "`" + `course` + "`" + `,\n ` + "`" + `semester` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "d65h4wh7zk13gxp", - "created": "2023-09-19 17:31:15.957Z", - "updated": "2024-07-13 11:37:49.145Z", - "name": "feeds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "cowxjfmc", - "name": "modules", - "type": "json", - "required": true, - "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } - }, - { - "system": false, - "id": "wmmney8x", - "name": "retrieved", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": "", - "createRule": null, - "updateRule": "", - "deleteRule": null, - "options": {} - }, - { - "id": "7her4515qsmrxe8", - "created": "2023-09-19 17:31:15.958Z", - "updated": "2024-07-13 11:37:49.145Z", - "name": "events", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "m8ne8e3m", - "name": "Day", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xnsxqp7j", - "name": "Week", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "aeuskrjo", - "name": "Name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "klrzqyw0", - "name": "EventType", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "5zltexoy", - "name": "Prof", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gy3nvfmx", - "name": "Rooms", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "hn7b8dfy", - "name": "Notes", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "axskpwm8", - "name": "BookedAt", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vyyefxp7", - "name": "course", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vlbpm9fz", - "name": "semester", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "0kahthzr", - "name": "uuid", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "6hkjwgb4", - "name": "start", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "szbefpjf", - "name": "end", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "nlnnxu7x", - "name": "Compulsory", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE INDEX ` + "`" + `idx_4vOTAiC` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `start` + "`" + `,\n ` + "`" + `end` + "`" + `,\n ` + "`" + `semester` + "`" + `,\n ` + "`" + `EventType` + "`" + `,\n ` + "`" + `Compulsory` + "`" + `\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "_pb_users_auth_", - "created": "2024-07-13 11:37:48.913Z", - "updated": "2024-07-13 11:37:49.145Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "maxSelect": 1, - "maxSize": 5242880, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "onlyVerified": false, - "requireEmail": false - } - } - ]` - - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, true, nil) - }, func(db dbx.Builder) error { - return nil - }) -} diff --git a/services/data-manager/migrations/1720871405_updated_feeds.go b/services/data-manager/migrations/1720871405_updated_feeds.go deleted file mode 100644 index 1a9e561..0000000 --- a/services/data-manager/migrations/1720871405_updated_feeds.go +++ /dev/null @@ -1,51 +0,0 @@ -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" - m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models/schema" -) - -func init() { - m.Register(func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("d65h4wh7zk13gxp") - if err != nil { - return err - } - - // add - new_deleted := &schema.SchemaField{} - if err := json.Unmarshal([]byte(`{ - "system": false, - "id": "5d7vjjgo", - "name": "deleted", - "type": "bool", - "required": false, - "presentable": false, - "unique": false, - "options": {} - }`), new_deleted); err != nil { - return err - } - collection.Schema.AddField(new_deleted) - - return dao.SaveCollection(collection) - }, func(db dbx.Builder) error { - dao := daos.New(db) - - collection, err := dao.FindCollectionByNameOrId("d65h4wh7zk13gxp") - if err != nil { - return err - } - - // remove - collection.Schema.RemoveField("5d7vjjgo") - - return dao.SaveCollection(collection) - }) -} diff --git a/services/data-manager/migrations/1741706407_updated_users.go b/services/data-manager/migrations/1741706407_updated_users.go deleted file mode 100644 index 8d10998..0000000 --- a/services/data-manager/migrations/1741706407_updated_users.go +++ /dev/null @@ -1,44 +0,0 @@ -package migrations - -import ( - "encoding/json" - - "github.com/pocketbase/pocketbase/core" - m "github.com/pocketbase/pocketbase/migrations" -) - -func init() { - m.Register(func(app core.App) error { - collection, err := app.FindCollectionByNameOrId("_pb_users_auth_") - if err != nil { - return err - } - - // update collection data - if err := json.Unmarshal([]byte(`{ - "oauth2": { - "enabled": true - } - }`), &collection); err != nil { - return err - } - - return app.Save(collection) - }, func(app core.App) error { - collection, err := app.FindCollectionByNameOrId("_pb_users_auth_") - if err != nil { - return err - } - - // update collection data - if err := json.Unmarshal([]byte(`{ - "oauth2": { - "enabled": false - } - }`), &collection); err != nil { - return err - } - - return app.Save(collection) - }) -} diff --git a/services/data-manager/migrations/1745155564_collections_snapshot.go b/services/data-manager/migrations/1745155564_collections_snapshot.go new file mode 100644 index 0000000..4acc379 --- /dev/null +++ b/services/data-manager/migrations/1745155564_collections_snapshot.go @@ -0,0 +1,1273 @@ +package migrations + +import ( + "github.com/pocketbase/pocketbase/core" + m "github.com/pocketbase/pocketbase/migrations" +) + +func init() { + m.Register(func(app core.App) error { + jsonData := `[ + { + "createRule": null, + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "85msl21p", + "max": 0, + "min": 0, + "name": "university", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "2sii4dtp", + "max": 0, + "min": 0, + "name": "shortcut", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "uiwgo28f", + "max": 0, + "min": 0, + "name": "groupId", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "y0l1lrzs", + "max": 0, + "min": 2, + "name": "course", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "kr62mhbz", + "max": 0, + "min": 0, + "name": "faculty", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "ya6znpez", + "max": 0, + "min": 0, + "name": "facultyId", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "bdhcrksy", + "max": 2, + "min": 2, + "name": "semester", + "pattern": "ws|ss", + "presentable": false, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "id": "cfq9mqlmd97v8z5", + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (\n ` + "`" + `course` + "`" + `,\n ` + "`" + `semester` + "`" + `\n)" + ], + "listRule": null, + "name": "groups", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null + }, + { + "createRule": null, + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "hidden": false, + "id": "cowxjfmc", + "maxSize": 2000000, + "name": "modules", + "presentable": false, + "required": true, + "system": false, + "type": "json" + }, + { + "hidden": false, + "id": "wmmney8x", + "max": "", + "min": "", + "name": "retrieved", + "presentable": false, + "required": false, + "system": false, + "type": "date" + }, + { + "hidden": false, + "id": "5d7vjjgo", + "name": "deleted", + "presentable": false, + "required": false, + "system": false, + "type": "bool" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "id": "d65h4wh7zk13gxp", + "indexes": [], + "listRule": null, + "name": "feeds", + "system": false, + "type": "base", + "updateRule": "", + "viewRule": "" + }, + { + "createRule": null, + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "m8ne8e3m", + "max": 0, + "min": 0, + "name": "Day", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "xnsxqp7j", + "max": 0, + "min": 0, + "name": "Week", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "aeuskrjo", + "max": 0, + "min": 0, + "name": "Name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "klrzqyw0", + "max": 0, + "min": 0, + "name": "EventType", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "5zltexoy", + "max": 0, + "min": 0, + "name": "Prof", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "gy3nvfmx", + "max": 0, + "min": 0, + "name": "Rooms", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "hn7b8dfy", + "max": 0, + "min": 0, + "name": "Notes", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "axskpwm8", + "max": 0, + "min": 0, + "name": "BookedAt", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "vyyefxp7", + "max": 0, + "min": 0, + "name": "course", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "vlbpm9fz", + "max": 0, + "min": 0, + "name": "semester", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "0kahthzr", + "max": 0, + "min": 0, + "name": "uuid", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "6hkjwgb4", + "max": "", + "min": "", + "name": "start", + "presentable": false, + "required": false, + "system": false, + "type": "date" + }, + { + "hidden": false, + "id": "szbefpjf", + "max": "", + "min": "", + "name": "end", + "presentable": false, + "required": false, + "system": false, + "type": "date" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "nlnnxu7x", + "max": 0, + "min": 0, + "name": "Compulsory", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "id": "7her4515qsmrxe8", + "indexes": [ + "CREATE INDEX ` + "`" + `idx_4vOTAiC` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `start` + "`" + `,\n ` + "`" + `end` + "`" + `,\n ` + "`" + `semester` + "`" + `,\n ` + "`" + `EventType` + "`" + `,\n ` + "`" + `Compulsory` + "`" + `\n)" + ], + "listRule": null, + "name": "events", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null + }, + { + "authAlert": { + "emailTemplate": { + "body": "

Hello,

\n

We noticed a login to your {APP_NAME} account from a new location.

\n

If this was you, you may disregard this email.

\n

If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Login from a new location" + }, + "enabled": true + }, + "authRule": "", + "authToken": { + "duration": 1209600 + }, + "confirmEmailChangeTemplate": { + "body": "

Hello,

\n

Click on the button below to confirm your new email address.

\n

\n Confirm new email\n

\n

If you didn't ask to change your email address, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Confirm your {APP_NAME} new email address" + }, + "createRule": "", + "deleteRule": "id = @request.auth.id", + "emailChangeToken": { + "duration": 1800 + }, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "cost": 10, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 8, + "name": "password", + "pattern": "", + "presentable": false, + "required": true, + "system": true, + "type": "password" + }, + { + "autogeneratePattern": "[a-zA-Z0-9_]{50}", + "hidden": true, + "id": "text2504183744", + "max": 60, + "min": 30, + "name": "tokenKey", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "exceptDomains": null, + "hidden": false, + "id": "email3885137012", + "name": "email", + "onlyDomains": null, + "presentable": false, + "required": false, + "system": true, + "type": "email" + }, + { + "hidden": false, + "id": "bool1547992806", + "name": "emailVisibility", + "presentable": false, + "required": false, + "system": true, + "type": "bool" + }, + { + "hidden": false, + "id": "bool256245529", + "name": "verified", + "presentable": false, + "required": false, + "system": true, + "type": "bool" + }, + { + "autogeneratePattern": "users[0-9]{6}", + "hidden": false, + "id": "text4166911607", + "max": 150, + "min": 3, + "name": "username", + "pattern": "^[\\w][\\w\\.\\-]*$", + "presentable": false, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "users_name", + "max": 0, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "users_avatar", + "maxSelect": 1, + "maxSize": 5242880, + "mimeTypes": [ + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", + "image/webp" + ], + "name": "avatar", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": null, + "type": "file" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "fileToken": { + "duration": 120 + }, + "id": "_pb_users_auth_", + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `__pb_users_auth__username_idx` + "`" + ` ON ` + "`" + `users` + "`" + ` (username COLLATE NOCASE)", + "CREATE UNIQUE INDEX ` + "`" + `__pb_users_auth__email_idx` + "`" + ` ON ` + "`" + `users` + "`" + ` (` + "`" + `email` + "`" + `) WHERE ` + "`" + `email` + "`" + ` != ''", + "CREATE UNIQUE INDEX ` + "`" + `__pb_users_auth__tokenKey_idx` + "`" + ` ON ` + "`" + `users` + "`" + ` (` + "`" + `tokenKey` + "`" + `)" + ], + "listRule": "id = @request.auth.id", + "manageRule": null, + "mfa": { + "duration": 1800, + "enabled": false, + "rule": "" + }, + "name": "users", + "oauth2": { + "enabled": true, + "mappedFields": { + "avatarURL": "", + "id": "", + "name": "", + "username": "username" + } + }, + "otp": { + "duration": 180, + "emailTemplate": { + "body": "

Hello,

\n

Your one-time password is: {OTP}

\n

If you didn't ask for the one-time password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "OTP for {APP_NAME}" + }, + "enabled": false, + "length": 8 + }, + "passwordAuth": { + "enabled": true, + "identityFields": [ + "email", + "username" + ] + }, + "passwordResetToken": { + "duration": 1800 + }, + "resetPasswordTemplate": { + "body": "

Hello,

\n

Click on the button below to reset your password.

\n

\n Reset password\n

\n

If you didn't ask to reset your password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Reset your {APP_NAME} password" + }, + "system": false, + "type": "auth", + "updateRule": "id = @request.auth.id", + "verificationTemplate": { + "body": "

Hello,

\n

Thank you for joining us at {APP_NAME}.

\n

Click on the button below to verify your email address.

\n

\n Verify\n

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Verify your {APP_NAME} email" + }, + "verificationToken": { + "duration": 604800 + }, + "viewRule": "id = @request.auth.id" + }, + { + "authAlert": { + "emailTemplate": { + "body": "

Hello,

\n

We noticed a login to your {APP_NAME} account from a new location.

\n

If this was you, you may disregard this email.

\n

If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Login from a new location" + }, + "enabled": true + }, + "authRule": "", + "authToken": { + "duration": 1209600 + }, + "confirmEmailChangeTemplate": { + "body": "

Hello,

\n

Click on the button below to confirm your new email address.

\n

\n Confirm new email\n

\n

If you didn't ask to change your email address, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Confirm your {APP_NAME} new email address" + }, + "createRule": null, + "deleteRule": null, + "emailChangeToken": { + "duration": 1800 + }, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "cost": 0, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 8, + "name": "password", + "pattern": "", + "presentable": false, + "required": true, + "system": true, + "type": "password" + }, + { + "autogeneratePattern": "[a-zA-Z0-9]{50}", + "hidden": true, + "id": "text2504183744", + "max": 60, + "min": 30, + "name": "tokenKey", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "exceptDomains": null, + "hidden": false, + "id": "email3885137012", + "name": "email", + "onlyDomains": null, + "presentable": false, + "required": true, + "system": true, + "type": "email" + }, + { + "hidden": false, + "id": "bool1547992806", + "name": "emailVisibility", + "presentable": false, + "required": false, + "system": true, + "type": "bool" + }, + { + "hidden": false, + "id": "bool256245529", + "name": "verified", + "presentable": false, + "required": false, + "system": true, + "type": "bool" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": true, + "type": "autodate" + } + ], + "fileToken": { + "duration": 120 + }, + "id": "pbc_3142635823", + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_tokenKey_pbc_3142635823` + "`" + ` ON ` + "`" + `_superusers` + "`" + ` (` + "`" + `tokenKey` + "`" + `)", + "CREATE UNIQUE INDEX ` + "`" + `idx_email_pbc_3142635823` + "`" + ` ON ` + "`" + `_superusers` + "`" + ` (` + "`" + `email` + "`" + `) WHERE ` + "`" + `email` + "`" + ` != ''" + ], + "listRule": null, + "manageRule": null, + "mfa": { + "duration": 1800, + "enabled": false, + "rule": "" + }, + "name": "_superusers", + "oauth2": { + "enabled": false, + "mappedFields": { + "avatarURL": "", + "id": "", + "name": "", + "username": "" + } + }, + "otp": { + "duration": 180, + "emailTemplate": { + "body": "

Hello,

\n

Your one-time password is: {OTP}

\n

If you didn't ask for the one-time password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "OTP for {APP_NAME}" + }, + "enabled": false, + "length": 8 + }, + "passwordAuth": { + "enabled": true, + "identityFields": [ + "email" + ] + }, + "passwordResetToken": { + "duration": 1800 + }, + "resetPasswordTemplate": { + "body": "

Hello,

\n

Click on the button below to reset your password.

\n

\n Reset password\n

\n

If you didn't ask to reset your password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Reset your {APP_NAME} password" + }, + "system": true, + "type": "auth", + "updateRule": null, + "verificationTemplate": { + "body": "

Hello,

\n

Thank you for joining us at {APP_NAME}.

\n

Click on the button below to verify your email address.

\n

\n Verify\n

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Verify your {APP_NAME} email" + }, + "verificationToken": { + "duration": 259200 + }, + "viewRule": null + }, + { + "createRule": null, + "deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text2462348188", + "max": 0, + "min": 0, + "name": "provider", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1044722854", + "max": 0, + "min": 0, + "name": "providerId", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": true, + "type": "autodate" + } + ], + "id": "pbc_2281828961", + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_externalAuths_record_provider` + "`" + ` ON ` + "`" + `_externalAuths` + "`" + ` (collectionRef, recordRef, provider)", + "CREATE UNIQUE INDEX ` + "`" + `idx_externalAuths_collection_provider` + "`" + ` ON ` + "`" + `_externalAuths` + "`" + ` (collectionRef, provider, providerId)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_externalAuths", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" + }, + { + "createRule": null, + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1582905952", + "max": 0, + "min": 0, + "name": "method", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": true, + "type": "autodate" + } + ], + "id": "pbc_2279338944", + "indexes": [ + "CREATE INDEX ` + "`" + `idx_mfas_collectionRef_recordRef` + "`" + ` ON ` + "`" + `_mfas` + "`" + ` (collectionRef,recordRef)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_mfas", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" + }, + { + "createRule": null, + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "cost": 8, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 0, + "name": "password", + "pattern": "", + "presentable": false, + "required": true, + "system": true, + "type": "password" + }, + { + "autogeneratePattern": "", + "hidden": true, + "id": "text3866985172", + "max": 0, + "min": 0, + "name": "sentTo", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": true, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": true, + "type": "autodate" + } + ], + "id": "pbc_1638494021", + "indexes": [ + "CREATE INDEX ` + "`" + `idx_otps_collectionRef_recordRef` + "`" + ` ON ` + "`" + `_otps` + "`" + ` (collectionRef, recordRef)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_otps", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" + }, + { + "createRule": null, + "deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text4228609354", + "max": 0, + "min": 0, + "name": "fingerprint", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": true, + "type": "autodate" + } + ], + "id": "pbc_4275539003", + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_authOrigins_unique_pairs` + "`" + ` ON ` + "`" + `_authOrigins` + "`" + ` (collectionRef, recordRef, fingerprint)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_authOrigins", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" + } + ]` + + return app.ImportCollectionsByMarshaledJSON([]byte(jsonData), false) + }, func(app core.App) error { + return nil + }) +} diff --git a/services/data-manager/model/eventModel_test.go b/services/data-manager/model/eventModel_test.go index f1ca8d0..a5b4577 100644 --- a/services/data-manager/model/eventModel_test.go +++ b/services/data-manager/model/eventModel_test.go @@ -20,7 +20,7 @@ import ( "reflect" "testing" - "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/tools/types" ) @@ -87,7 +87,7 @@ func TestEventEquals(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { event Event @@ -164,7 +164,7 @@ func TestEventAnonymizeEvent(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } tests := []struct { name string @@ -234,7 +234,7 @@ func TestEventGetName(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } tests := []struct { name string @@ -294,7 +294,7 @@ func TestEventSetCourse(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { course string @@ -354,7 +354,7 @@ func TestEventSetName(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { name string @@ -414,7 +414,7 @@ func TestEventTableName(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } tests := []struct { name string diff --git a/services/data-manager/model/feedModel_test.go b/services/data-manager/model/feedModel_test.go index f2de61b..ed15be7 100644 --- a/services/data-manager/model/feedModel_test.go +++ b/services/data-manager/model/feedModel_test.go @@ -1,7 +1,7 @@ package model import ( - "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/tools/types" "testing" ) @@ -10,7 +10,7 @@ func TestFeedSetModules(t *testing.T) { type fields struct { Modules string Retrieved types.DateTime - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { modules string @@ -25,7 +25,7 @@ func TestFeedSetModules(t *testing.T) { fields: fields{ Modules: "", Retrieved: types.DateTime{}, - BaseModel: models.BaseModel{}, + BaseModel: core.BaseModel{}, }, args: args{ modules: "modules", diff --git a/services/data-manager/service/db/dbFeeds_test.go b/services/data-manager/service/db/test/dbFeeds_test.go similarity index 56% rename from services/data-manager/service/db/dbFeeds_test.go rename to services/data-manager/service/db/test/dbFeeds_test.go index c7e29fc..bbd6d3f 100644 --- a/services/data-manager/service/db/dbFeeds_test.go +++ b/services/data-manager/service/db/test/dbFeeds_test.go @@ -14,58 +14,48 @@ //You should have received a copy of the GNU Affero General Public License //along with this program. If not, see . -package db +package test import ( - "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase/tests" + "htwkalender/data-manager/model/serviceModel" + "htwkalender/data-manager/service" + "net/http" "testing" ) -const testDataDir = "./mockData" +const testDataDir = "../mockData" func TestDeleteFeed(t *testing.T) { - setupTestApp := func(t *testing.T) *daos.Dao { + setupTestApp := func(t testing.TB) *tests.TestApp { testApp, err := tests.NewTestApp(testDataDir) if err != nil { t.Fatal(err) } - dao := daos.New(testApp.Dao().DB()) - return dao + + base := &pocketbase.PocketBase{App: testApp} + + services := serviceModel.Service{App: base} + + service.AddRoutes(services) + + return testApp } - type args struct { - db *daos.Dao - feedId string - } - testsCases := []struct { - name string - args args - wantErr bool - }{ + scenarios := []tests.ApiScenario{ { - name: "TestDeleteFeed", - args: args{ - db: setupTestApp(t), - feedId: "fkoqti06ohlnsb8", - }, - wantErr: false, - }, - { - name: "TestDeleteFeedNotExisting", - args: args{ - db: setupTestApp(t), - feedId: "test324", - }, - wantErr: true, + Name: "TestDeleteFeed", + Method: "DELETE", + URL: "/api/v1/feeds/fkoqti06ohlnsb8", + ExpectedStatus: http.StatusNotFound, + ExpectedContent: []string{"\"data\":{},\"message\":\"The requested resource wasn't found.\",\"status\":404"}, + TestAppFactory: setupTestApp, }, } - for _, tt := range testsCases { - t.Run(tt.name, func(t *testing.T) { - if err := DeleteFeed(tt.args.db, tt.args.feedId); (err != nil) != tt.wantErr { - t.Errorf("DeleteFeed() error = %v, wantErr %v", err, tt.wantErr) - } - }) + + for _, scenario := range scenarios { + scenario.Test(t) } } diff --git a/services/data-manager/service/feed/feedFunctions_test.go b/services/data-manager/service/feed/test/feedFunctions_test.go similarity index 84% rename from services/data-manager/service/feed/feedFunctions_test.go rename to services/data-manager/service/feed/test/feedFunctions_test.go index 53286ba..240d264 100644 --- a/services/data-manager/service/feed/feedFunctions_test.go +++ b/services/data-manager/service/feed/test/feedFunctions_test.go @@ -14,45 +14,43 @@ //You should have received a copy of the GNU Affero General Public License //along with this program. If not, see . -package feed +package test import ( - "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase/tests" "htwkalender/data-manager/model" + "htwkalender/data-manager/service/feed" mockTime "htwkalender/data-manager/service/functions/time" "reflect" "testing" "time" ) -const testDataDir = "./mockData" +const testDataDir = "../mockData" + +func setupTestApp(t testing.TB) *tests.TestApp { + testApp, err := tests.NewTestApp(testDataDir) + if err != nil { + t.Fatal(err) + } + return testApp +} func TestClearFeeds(t *testing.T) { - - setupTestApp := func(t *testing.T) *daos.Dao { - testApp, err := tests.NewTestApp(testDataDir) - if err != nil { - t.Fatal(err) - } - dao := daos.New(testApp.Dao().DB()) - return dao - } - type args struct { - db *daos.Dao months int mockClock mockTime.MockClock } + testCases := []struct { name string args args want int }{ { - name: "TestClearFeeds", + name: "Clear feeds older than 6 months", args: args{ - db: setupTestApp(t), months: 6, mockClock: mockTime.MockClock{ NowTime: time.Date(2023, 12, 1, 0, 0, 0, 0, time.UTC), @@ -61,9 +59,8 @@ func TestClearFeeds(t *testing.T) { want: 1, }, { - name: "TestClearAllFeeds", + name: "Clear all feeds - recent clock", args: args{ - db: setupTestApp(t), months: 1, mockClock: mockTime.MockClock{ NowTime: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC), @@ -72,9 +69,8 @@ func TestClearFeeds(t *testing.T) { want: 0, }, { - name: "TestClearFeedsClearBeforeRetrievedTime", + name: "No clearing - very old clock", args: args{ - db: setupTestApp(t), months: 1, mockClock: mockTime.MockClock{ NowTime: time.Date(2010, 1, 1, 0, 0, 0, 0, time.UTC), @@ -83,15 +79,20 @@ func TestClearFeeds(t *testing.T) { want: 3, }, } + for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - ClearFeeds(tt.args.db, tt.args.months, tt.args.mockClock) - // count all feeds in db + app := setupTestApp(t) + base := &pocketbase.PocketBase{App: app} + + feed.ClearFeeds(base, tt.args.months, tt.args.mockClock) + var feeds []*model.Feed - err := tt.args.db.DB().Select("id").From("feeds").All(&feeds) + err := app.DB().Select("id").From("feeds").All(&feeds) if err != nil { t.Fatal(err) } + if got := len(feeds); got != tt.want { t.Errorf("ClearFeeds() = %v, want %v", got, tt.want) } @@ -109,7 +110,7 @@ func TestCombineEventsInFeed(t *testing.T) { want model.Events }{ { - name: "TestCombineEventsInFeed", + name: "Combine duplicate events with different rooms and notes", args: args{ events: model.Events{ { @@ -142,7 +143,7 @@ func TestCombineEventsInFeed(t *testing.T) { }, }, { - name: "CannotCombineEventsInFeed", + name: "Do not combine different events", args: args{ events: model.Events{ { @@ -183,16 +184,17 @@ func TestCombineEventsInFeed(t *testing.T) { }, }, { - name: "NoEventsInFeed", + name: "Empty events input", args: args{ events: model.Events{}, }, want: model.Events{}, }, } + for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - if got := CombineEventsInFeed(tt.args.events); !reflect.DeepEqual(got, tt.want) { + if got := feed.CombineEventsInFeed(tt.args.events); !reflect.DeepEqual(got, tt.want) { t.Errorf("CombineEventsInFeed() = %v, want %v", got, tt.want) } }) diff --git a/services/data-manager/service/fetch/v2/fetcher.go b/services/data-manager/service/fetch/v2/fetcher.go index 61fe0e9..b0e19fb 100644 --- a/services/data-manager/service/fetch/v2/fetcher.go +++ b/services/data-manager/service/fetch/v2/fetcher.go @@ -106,7 +106,7 @@ func updateDatabase(base *pocketbase.PocketBase, eventsToBeAdded []model.Event, var err error // to in transaction the events will be added and deleted - err = base.App.RunInTransaction(func(app core.App) error { + err = base.RunInTransaction(func(app core.App) error { err = db.DeleteAllEventsRatherThenCourse(app, course, semester) if err != nil { return err diff --git a/services/ical/model/eventModel_test.go b/services/ical/model/eventModel_test.go index bee7eb5..1122d1a 100644 --- a/services/ical/model/eventModel_test.go +++ b/services/ical/model/eventModel_test.go @@ -17,7 +17,7 @@ package model import ( - "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/core" "reflect" "testing" "time" @@ -90,7 +90,7 @@ func TestEvent_Equals(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { event Event @@ -167,7 +167,7 @@ func TestEvent_AnonymizeEvent(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } tests := []struct { name string @@ -237,7 +237,7 @@ func TestEvent_GetName(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } tests := []struct { name string @@ -297,7 +297,7 @@ func TestEvent_SetCourse(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { course string @@ -357,7 +357,7 @@ func TestEvent_SetName(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } type args struct { name string @@ -417,7 +417,7 @@ func TestEvent_TableName(t *testing.T) { BookedAt string Course string Semester string - BaseModel models.BaseModel + BaseModel core.BaseModel } tests := []struct { name string diff --git a/services/ical/service/ical/ical.go b/services/ical/service/ical/ical.go index dd8b8b2..17045b2 100644 --- a/services/ical/service/ical/ical.go +++ b/services/ical/service/ical/ical.go @@ -28,7 +28,7 @@ import ( const expirationTime = 5 * time.Minute -var FeedDeletedError = fmt.Errorf("feed deleted") +var ErrFeedDeleted = fmt.Errorf("feed deleted") func Feed(app model.AppType, token string, userAgent string) (string, string, error) { @@ -50,7 +50,7 @@ func Feed(app model.AppType, token string, userAgent string) (string, string, er } if feed.Deleted { - return "", "", FeedDeletedError + return "", "", ErrFeedDeleted } // Get all events for modules diff --git a/services/ical/service/routes.go b/services/ical/service/routes.go index 18c35bf..0b14b2d 100644 --- a/services/ical/service/routes.go +++ b/services/ical/service/routes.go @@ -41,7 +41,7 @@ func AddFeedRoutes(app model.AppType) { results, eTag, err := ical.Feed(app, token, userAgent) - if errors.Is(err, ical.FeedDeletedError) { + if errors.Is(err, ical.ErrFeedDeleted) { return c.SendStatus(fiber.StatusGone) }