mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 09:38:49 +02:00
feat:#65 adjusted missing changes backend migration
This commit is contained in:
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
@ -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
|
|
||||||
})
|
|
||||||
}
|
|
@ -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)
|
|
||||||
})
|
|
||||||
}
|
|
@ -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)
|
|
||||||
})
|
|
||||||
}
|
|
1273
services/data-manager/migrations/1745155564_collections_snapshot.go
Normal file
1273
services/data-manager/migrations/1745155564_collections_snapshot.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pocketbase/pocketbase/models"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
"github.com/pocketbase/pocketbase/tools/types"
|
"github.com/pocketbase/pocketbase/tools/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ func TestEventEquals(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
event Event
|
event Event
|
||||||
@ -164,7 +164,7 @@ func TestEventAnonymizeEvent(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -234,7 +234,7 @@ func TestEventGetName(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -294,7 +294,7 @@ func TestEventSetCourse(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
course string
|
course string
|
||||||
@ -354,7 +354,7 @@ func TestEventSetName(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
name string
|
name string
|
||||||
@ -414,7 +414,7 @@ func TestEventTableName(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pocketbase/pocketbase/models"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
"github.com/pocketbase/pocketbase/tools/types"
|
"github.com/pocketbase/pocketbase/tools/types"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@ -10,7 +10,7 @@ func TestFeedSetModules(t *testing.T) {
|
|||||||
type fields struct {
|
type fields struct {
|
||||||
Modules string
|
Modules string
|
||||||
Retrieved types.DateTime
|
Retrieved types.DateTime
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
modules string
|
modules string
|
||||||
@ -25,7 +25,7 @@ func TestFeedSetModules(t *testing.T) {
|
|||||||
fields: fields{
|
fields: fields{
|
||||||
Modules: "",
|
Modules: "",
|
||||||
Retrieved: types.DateTime{},
|
Retrieved: types.DateTime{},
|
||||||
BaseModel: models.BaseModel{},
|
BaseModel: core.BaseModel{},
|
||||||
},
|
},
|
||||||
args: args{
|
args: args{
|
||||||
modules: "modules",
|
modules: "modules",
|
||||||
|
@ -14,58 +14,48 @@
|
|||||||
//You should have received a copy of the GNU Affero General Public License
|
//You should have received a copy of the GNU Affero General Public License
|
||||||
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package db
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pocketbase/pocketbase/daos"
|
"github.com/pocketbase/pocketbase"
|
||||||
"github.com/pocketbase/pocketbase/tests"
|
"github.com/pocketbase/pocketbase/tests"
|
||||||
|
"htwkalender/data-manager/model/serviceModel"
|
||||||
|
"htwkalender/data-manager/service"
|
||||||
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const testDataDir = "./mockData"
|
const testDataDir = "../mockData"
|
||||||
|
|
||||||
func TestDeleteFeed(t *testing.T) {
|
func TestDeleteFeed(t *testing.T) {
|
||||||
|
|
||||||
setupTestApp := func(t *testing.T) *daos.Dao {
|
setupTestApp := func(t testing.TB) *tests.TestApp {
|
||||||
testApp, err := tests.NewTestApp(testDataDir)
|
testApp, err := tests.NewTestApp(testDataDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
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 {
|
scenarios := []tests.ApiScenario{
|
||||||
db *daos.Dao
|
|
||||||
feedId string
|
|
||||||
}
|
|
||||||
testsCases := []struct {
|
|
||||||
name string
|
|
||||||
args args
|
|
||||||
wantErr bool
|
|
||||||
}{
|
|
||||||
{
|
{
|
||||||
name: "TestDeleteFeed",
|
Name: "TestDeleteFeed",
|
||||||
args: args{
|
Method: "DELETE",
|
||||||
db: setupTestApp(t),
|
URL: "/api/v1/feeds/fkoqti06ohlnsb8",
|
||||||
feedId: "fkoqti06ohlnsb8",
|
ExpectedStatus: http.StatusNotFound,
|
||||||
},
|
ExpectedContent: []string{"\"data\":{},\"message\":\"The requested resource wasn't found.\",\"status\":404"},
|
||||||
wantErr: false,
|
TestAppFactory: setupTestApp,
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "TestDeleteFeedNotExisting",
|
|
||||||
args: args{
|
|
||||||
db: setupTestApp(t),
|
|
||||||
feedId: "test324",
|
|
||||||
},
|
|
||||||
wantErr: true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range testsCases {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
for _, scenario := range scenarios {
|
||||||
if err := DeleteFeed(tt.args.db, tt.args.feedId); (err != nil) != tt.wantErr {
|
scenario.Test(t)
|
||||||
t.Errorf("DeleteFeed() error = %v, wantErr %v", err, tt.wantErr)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,45 +14,43 @@
|
|||||||
//You should have received a copy of the GNU Affero General Public License
|
//You should have received a copy of the GNU Affero General Public License
|
||||||
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package feed
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pocketbase/pocketbase/daos"
|
"github.com/pocketbase/pocketbase"
|
||||||
"github.com/pocketbase/pocketbase/tests"
|
"github.com/pocketbase/pocketbase/tests"
|
||||||
"htwkalender/data-manager/model"
|
"htwkalender/data-manager/model"
|
||||||
|
"htwkalender/data-manager/service/feed"
|
||||||
mockTime "htwkalender/data-manager/service/functions/time"
|
mockTime "htwkalender/data-manager/service/functions/time"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"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) {
|
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 {
|
type args struct {
|
||||||
db *daos.Dao
|
|
||||||
months int
|
months int
|
||||||
mockClock mockTime.MockClock
|
mockClock mockTime.MockClock
|
||||||
}
|
}
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
args args
|
||||||
want int
|
want int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "TestClearFeeds",
|
name: "Clear feeds older than 6 months",
|
||||||
args: args{
|
args: args{
|
||||||
db: setupTestApp(t),
|
|
||||||
months: 6,
|
months: 6,
|
||||||
mockClock: mockTime.MockClock{
|
mockClock: mockTime.MockClock{
|
||||||
NowTime: time.Date(2023, 12, 1, 0, 0, 0, 0, time.UTC),
|
NowTime: time.Date(2023, 12, 1, 0, 0, 0, 0, time.UTC),
|
||||||
@ -61,9 +59,8 @@ func TestClearFeeds(t *testing.T) {
|
|||||||
want: 1,
|
want: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "TestClearAllFeeds",
|
name: "Clear all feeds - recent clock",
|
||||||
args: args{
|
args: args{
|
||||||
db: setupTestApp(t),
|
|
||||||
months: 1,
|
months: 1,
|
||||||
mockClock: mockTime.MockClock{
|
mockClock: mockTime.MockClock{
|
||||||
NowTime: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC),
|
NowTime: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
@ -72,9 +69,8 @@ func TestClearFeeds(t *testing.T) {
|
|||||||
want: 0,
|
want: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "TestClearFeedsClearBeforeRetrievedTime",
|
name: "No clearing - very old clock",
|
||||||
args: args{
|
args: args{
|
||||||
db: setupTestApp(t),
|
|
||||||
months: 1,
|
months: 1,
|
||||||
mockClock: mockTime.MockClock{
|
mockClock: mockTime.MockClock{
|
||||||
NowTime: time.Date(2010, 1, 1, 0, 0, 0, 0, time.UTC),
|
NowTime: time.Date(2010, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
@ -83,15 +79,20 @@ func TestClearFeeds(t *testing.T) {
|
|||||||
want: 3,
|
want: 3,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range testCases {
|
for _, tt := range testCases {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
ClearFeeds(tt.args.db, tt.args.months, tt.args.mockClock)
|
app := setupTestApp(t)
|
||||||
// count all feeds in db
|
base := &pocketbase.PocketBase{App: app}
|
||||||
|
|
||||||
|
feed.ClearFeeds(base, tt.args.months, tt.args.mockClock)
|
||||||
|
|
||||||
var feeds []*model.Feed
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if got := len(feeds); got != tt.want {
|
if got := len(feeds); got != tt.want {
|
||||||
t.Errorf("ClearFeeds() = %v, want %v", got, tt.want)
|
t.Errorf("ClearFeeds() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
@ -109,7 +110,7 @@ func TestCombineEventsInFeed(t *testing.T) {
|
|||||||
want model.Events
|
want model.Events
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "TestCombineEventsInFeed",
|
name: "Combine duplicate events with different rooms and notes",
|
||||||
args: args{
|
args: args{
|
||||||
events: model.Events{
|
events: model.Events{
|
||||||
{
|
{
|
||||||
@ -142,7 +143,7 @@ func TestCombineEventsInFeed(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "CannotCombineEventsInFeed",
|
name: "Do not combine different events",
|
||||||
args: args{
|
args: args{
|
||||||
events: model.Events{
|
events: model.Events{
|
||||||
{
|
{
|
||||||
@ -183,16 +184,17 @@ func TestCombineEventsInFeed(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "NoEventsInFeed",
|
name: "Empty events input",
|
||||||
args: args{
|
args: args{
|
||||||
events: model.Events{},
|
events: model.Events{},
|
||||||
},
|
},
|
||||||
want: model.Events{},
|
want: model.Events{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range testCases {
|
for _, tt := range testCases {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
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)
|
t.Errorf("CombineEventsInFeed() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -106,7 +106,7 @@ func updateDatabase(base *pocketbase.PocketBase, eventsToBeAdded []model.Event,
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
// to in transaction the events will be added and deleted
|
// 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)
|
err = db.DeleteAllEventsRatherThenCourse(app, course, semester)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pocketbase/pocketbase/models"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -90,7 +90,7 @@ func TestEvent_Equals(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
event Event
|
event Event
|
||||||
@ -167,7 +167,7 @@ func TestEvent_AnonymizeEvent(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -237,7 +237,7 @@ func TestEvent_GetName(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -297,7 +297,7 @@ func TestEvent_SetCourse(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
course string
|
course string
|
||||||
@ -357,7 +357,7 @@ func TestEvent_SetName(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
type args struct {
|
type args struct {
|
||||||
name string
|
name string
|
||||||
@ -417,7 +417,7 @@ func TestEvent_TableName(t *testing.T) {
|
|||||||
BookedAt string
|
BookedAt string
|
||||||
Course string
|
Course string
|
||||||
Semester string
|
Semester string
|
||||||
BaseModel models.BaseModel
|
BaseModel core.BaseModel
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
|
|
||||||
const expirationTime = 5 * time.Minute
|
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) {
|
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 {
|
if feed.Deleted {
|
||||||
return "", "", FeedDeletedError
|
return "", "", ErrFeedDeleted
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all events for modules
|
// Get all events for modules
|
||||||
|
@ -41,7 +41,7 @@ func AddFeedRoutes(app model.AppType) {
|
|||||||
|
|
||||||
results, eTag, err := ical.Feed(app, token, userAgent)
|
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)
|
return c.SendStatus(fiber.StatusGone)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user