From bee1eadbda370ab328e3353efd783d82b277073d Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 28 Nov 2025 10:51:48 +0100 Subject: [PATCH] commit migrations --- web/.gitignore | 3 +- .../pb_migrations/1759312120_updated_users.js | 99 ++++++++ .../pb_migrations/1759312125_updated_users.js | 36 +++ .../pb_migrations/1759312218_updated_users.js | 34 +++ .../1759312839_created_submission.js | 146 +++++++++++ .../pb_migrations/1759313082_updated_users.js | 34 +++ .../pb_migrations/1759313096_updated_users.js | 32 +++ .../pb_migrations/1759313140_updated_users.js | 32 +++ .../1759313306_updated_submission.js | 28 +++ .../pb_migrations/1759313389_updated_users.js | 32 +++ .../pb_migrations/1759313613_updated_users.js | 28 +++ .../1759318802_updated_submission.js | 26 ++ .../1759319073_updated_submissions.js | 78 ++++++ .../1759319167_updated_submissions.js | 49 ++++ .../pb_migrations/1759320673_updated_users.js | 22 ++ .../1759322469_updated_submissions.js | 44 ++++ .../pb_migrations/1759323526_updated_users.js | 29 +++ .../pb_migrations/1759324813_updated_users.js | 20 ++ .../pb_migrations/1759324829_updated_users.js | 20 ++ .../pb_migrations/1759324878_updated_users.js | 22 ++ .../pb_migrations/1759324890_updated_users.js | 20 ++ .../1759326542_updated_submissions.js | 44 ++++ .../1759329927_created_community_gallery.js | 67 ++++++ .../1759329946_updated_community_gallery.js | 120 +++++++++ .../1759330033_updated_community_gallery.js | 144 +++++++++++ .../1759330172_updated_community_gallery.js | 179 ++++++++++++++ .../1759330278_updated_community_gallery.js | 198 +++++++++++++++ .../1759330318_updated_submissions.js | 45 ++++ .../1759332236_updated_community_gallery.js | 227 ++++++++++++++++++ .../pb_migrations/1759335166_updated_users.js | 22 ++ .../pb_migrations/1759335187_updated_users.js | 20 ++ 31 files changed, 1898 insertions(+), 2 deletions(-) create mode 100644 web/backend/pb_migrations/1759312120_updated_users.js create mode 100644 web/backend/pb_migrations/1759312125_updated_users.js create mode 100644 web/backend/pb_migrations/1759312218_updated_users.js create mode 100644 web/backend/pb_migrations/1759312839_created_submission.js create mode 100644 web/backend/pb_migrations/1759313082_updated_users.js create mode 100644 web/backend/pb_migrations/1759313096_updated_users.js create mode 100644 web/backend/pb_migrations/1759313140_updated_users.js create mode 100644 web/backend/pb_migrations/1759313306_updated_submission.js create mode 100644 web/backend/pb_migrations/1759313389_updated_users.js create mode 100644 web/backend/pb_migrations/1759313613_updated_users.js create mode 100644 web/backend/pb_migrations/1759318802_updated_submission.js create mode 100644 web/backend/pb_migrations/1759319073_updated_submissions.js create mode 100644 web/backend/pb_migrations/1759319167_updated_submissions.js create mode 100644 web/backend/pb_migrations/1759320673_updated_users.js create mode 100644 web/backend/pb_migrations/1759322469_updated_submissions.js create mode 100644 web/backend/pb_migrations/1759323526_updated_users.js create mode 100644 web/backend/pb_migrations/1759324813_updated_users.js create mode 100644 web/backend/pb_migrations/1759324829_updated_users.js create mode 100644 web/backend/pb_migrations/1759324878_updated_users.js create mode 100644 web/backend/pb_migrations/1759324890_updated_users.js create mode 100644 web/backend/pb_migrations/1759326542_updated_submissions.js create mode 100644 web/backend/pb_migrations/1759329927_created_community_gallery.js create mode 100644 web/backend/pb_migrations/1759329946_updated_community_gallery.js create mode 100644 web/backend/pb_migrations/1759330033_updated_community_gallery.js create mode 100644 web/backend/pb_migrations/1759330172_updated_community_gallery.js create mode 100644 web/backend/pb_migrations/1759330278_updated_community_gallery.js create mode 100644 web/backend/pb_migrations/1759330318_updated_submissions.js create mode 100644 web/backend/pb_migrations/1759332236_updated_community_gallery.js create mode 100644 web/backend/pb_migrations/1759335166_updated_users.js create mode 100644 web/backend/pb_migrations/1759335187_updated_users.js diff --git a/web/.gitignore b/web/.gitignore index c79d06b5..e06c7e37 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -48,5 +48,4 @@ next-env.d.ts # Pocketbase backend/pocketbase -backend/pb_data -backend/pb_migrations \ No newline at end of file +backend/pb_data \ No newline at end of file diff --git a/web/backend/pb_migrations/1759312120_updated_users.js b/web/backend/pb_migrations/1759312120_updated_users.js new file mode 100644 index 00000000..7892f481 --- /dev/null +++ b/web/backend/pb_migrations/1759312120_updated_users.js @@ -0,0 +1,99 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "indexes": [ + "CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)", + "CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`username`) WHERE `email` != ''", + "CREATE UNIQUE INDEX `idx_xcjpYhojHH` ON `users` (`email`)" + ], + "oauth2": { + "mappedFields": { + "name": "" + } + } + }, collection) + + // update field + collection.fields.addAt(1, new Field({ + "cost": 0, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 5, + "name": "password", + "pattern": "", + "presentable": false, + "required": true, + "system": true, + "type": "password" + })) + + // update field + collection.fields.addAt(3, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1579384326", + "max": 255, + "min": 5, + "name": "username", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "indexes": [ + "CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)", + "CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`email`) WHERE `email` != ''" + ], + "oauth2": { + "mappedFields": { + "name": "name" + } + } + }, collection) + + // update field + collection.fields.addAt(1, new Field({ + "cost": 0, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 8, + "name": "password", + "pattern": "", + "presentable": false, + "required": true, + "system": true, + "type": "password" + })) + + // update field + collection.fields.addAt(6, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1579384326", + "max": 255, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759312125_updated_users.js b/web/backend/pb_migrations/1759312125_updated_users.js new file mode 100644 index 00000000..5452bb0f --- /dev/null +++ b/web/backend/pb_migrations/1759312125_updated_users.js @@ -0,0 +1,36 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(4, new Field({ + "exceptDomains": null, + "hidden": false, + "id": "email3885137012", + "name": "email", + "onlyDomains": null, + "presentable": false, + "required": false, + "system": true, + "type": "email" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(4, new Field({ + "exceptDomains": null, + "hidden": false, + "id": "email3885137012", + "name": "email", + "onlyDomains": null, + "presentable": false, + "required": true, + "system": true, + "type": "email" + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759312218_updated_users.js b/web/backend/pb_migrations/1759312218_updated_users.js new file mode 100644 index 00000000..e1463c77 --- /dev/null +++ b/web/backend/pb_migrations/1759312218_updated_users.js @@ -0,0 +1,34 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "authAlert": { + "enabled": false + }, + "passwordAuth": { + "identityFields": [ + "username" + ] + } + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "authAlert": { + "enabled": true + }, + "passwordAuth": { + "identityFields": [ + "email" + ] + } + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759312839_created_submission.js b/web/backend/pb_migrations/1759312839_created_submission.js new file mode 100644 index 00000000..66c73cb3 --- /dev/null +++ b/web/backend/pb_migrations/1759312839_created_submission.js @@ -0,0 +1,146 @@ +/// +migrate((app) => { + const collection = new Collection({ + "createRule": "@request.auth.id = created_by.id || @request.auth.admin = true", + "deleteRule": "@request.auth.id = created_by.id || @request.auth.admin = true", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1579384326", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "file2043772302", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "relation3725765462", + "maxSelect": 1, + "minSelect": 0, + "name": "created_by", + "presentable": true, + "required": true, + "system": false, + "type": "relation" + }, + { + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "waiting_approval", + "approved", + "refused" + ] + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1595063097", + "max": 0, + "min": 0, + "name": "aliases", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text989021800", + "max": 0, + "min": 0, + "name": "categories", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "id": "pbc_632646243", + "indexes": [ + "CREATE UNIQUE INDEX `idx_vB4iK1BfdV` ON `submission` (`name`)" + ], + "listRule": "@request.auth.id = created_by.id || @request.auth.admin = true", + "name": "submission", + "system": false, + "type": "base", + "updateRule": "@request.auth.id = created_by.id || @request.auth.admin = true", + "viewRule": "@request.auth.id = created_by.id || @request.auth.admin = true" + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243"); + + return app.delete(collection); +}) diff --git a/web/backend/pb_migrations/1759313082_updated_users.js b/web/backend/pb_migrations/1759313082_updated_users.js new file mode 100644 index 00000000..df9fde6f --- /dev/null +++ b/web/backend/pb_migrations/1759313082_updated_users.js @@ -0,0 +1,34 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "updateRule": "id = @request.auth.id && (@request.body.admin = null || @request.body.admin = admin)" + }, collection) + + // add field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": true, + "required": false, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "updateRule": "id = @request.auth.id" + }, collection) + + // remove field + collection.fields.removeById("bool2282622326") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759313096_updated_users.js b/web/backend/pb_migrations/1759313096_updated_users.js new file mode 100644 index 00000000..765a0f62 --- /dev/null +++ b/web/backend/pb_migrations/1759313096_updated_users.js @@ -0,0 +1,32 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": true, + "required": true, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": true, + "required": false, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759313140_updated_users.js b/web/backend/pb_migrations/1759313140_updated_users.js new file mode 100644 index 00000000..3e094e42 --- /dev/null +++ b/web/backend/pb_migrations/1759313140_updated_users.js @@ -0,0 +1,32 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": true, + "required": false, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": true, + "required": true, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759313306_updated_submission.js b/web/backend/pb_migrations/1759313306_updated_submission.js new file mode 100644 index 00000000..f681da61 --- /dev/null +++ b/web/backend/pb_migrations/1759313306_updated_submission.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // add field + collection.fields.addAt(5, new Field({ + "cascadeDelete": true, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "relation1319357245", + "maxSelect": 1, + "minSelect": 0, + "name": "approved_by", + "presentable": true, + "required": false, + "system": false, + "type": "relation" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // remove field + collection.fields.removeById("relation1319357245") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759313389_updated_users.js b/web/backend/pb_migrations/1759313389_updated_users.js new file mode 100644 index 00000000..65d3665b --- /dev/null +++ b/web/backend/pb_migrations/1759313389_updated_users.js @@ -0,0 +1,32 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": false, + "required": false, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "bool2282622326", + "name": "admin", + "presentable": true, + "required": false, + "system": false, + "type": "bool" + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759313613_updated_users.js b/web/backend/pb_migrations/1759313613_updated_users.js new file mode 100644 index 00000000..48ab627a --- /dev/null +++ b/web/backend/pb_migrations/1759313613_updated_users.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "indexes": [ + "CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)", + "CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`username`) WHERE `email` != ''", + "CREATE UNIQUE INDEX `idx_email_3ug5rzmspg` ON `test` (`email`) WHERE `email` != ''" + ] + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "indexes": [ + "CREATE UNIQUE INDEX `idx_tokenKey__pb_users_auth_` ON `users` (`tokenKey`)", + "CREATE UNIQUE INDEX `idx_email__pb_users_auth_` ON `users` (`username`) WHERE `email` != ''", + "CREATE UNIQUE INDEX `idx_xcjpYhojHH` ON `users` (`email`)" + ] + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759318802_updated_submission.js b/web/backend/pb_migrations/1759318802_updated_submission.js new file mode 100644 index 00000000..be524ebf --- /dev/null +++ b/web/backend/pb_migrations/1759318802_updated_submission.js @@ -0,0 +1,26 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update collection data + unmarshal({ + "indexes": [ + "CREATE UNIQUE INDEX `idx_vB4iK1BfdV` ON `submissions` (`name`)" + ], + "name": "submissions" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update collection data + unmarshal({ + "indexes": [ + "CREATE UNIQUE INDEX `idx_vB4iK1BfdV` ON `submission` (`name`)" + ], + "name": "submission" + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759319073_updated_submissions.js b/web/backend/pb_migrations/1759319073_updated_submissions.js new file mode 100644 index 00000000..cd6b8242 --- /dev/null +++ b/web/backend/pb_migrations/1759319073_updated_submissions.js @@ -0,0 +1,78 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // remove field + collection.fields.removeById("text1595063097") + + // remove field + collection.fields.removeById("text989021800") + + // add field + collection.fields.addAt(6, new Field({ + "hidden": false, + "id": "json1595063097", + "maxSize": 0, + "name": "aliases", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + // add field + collection.fields.addAt(7, new Field({ + "hidden": false, + "id": "json989021800", + "maxSize": 0, + "name": "categories", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // add field + collection.fields.addAt(6, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1595063097", + "max": 0, + "min": 0, + "name": "aliases", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(7, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text989021800", + "max": 0, + "min": 0, + "name": "categories", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // remove field + collection.fields.removeById("json1595063097") + + // remove field + collection.fields.removeById("json989021800") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759319167_updated_submissions.js b/web/backend/pb_migrations/1759319167_updated_submissions.js new file mode 100644 index 00000000..d2f541c5 --- /dev/null +++ b/web/backend/pb_migrations/1759319167_updated_submissions.js @@ -0,0 +1,49 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // remove field + collection.fields.removeById("json989021800") + + // update field + collection.fields.addAt(6, new Field({ + "hidden": false, + "id": "json1595063097", + "maxSize": 0, + "name": "extras", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // add field + collection.fields.addAt(7, new Field({ + "hidden": false, + "id": "json989021800", + "maxSize": 0, + "name": "categories", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + // update field + collection.fields.addAt(6, new Field({ + "hidden": false, + "id": "json1595063097", + "maxSize": 0, + "name": "aliases", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759320673_updated_users.js b/web/backend/pb_migrations/1759320673_updated_users.js new file mode 100644 index 00000000..2ead8887 --- /dev/null +++ b/web/backend/pb_migrations/1759320673_updated_users.js @@ -0,0 +1,22 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "createRule": "@request.body.admin = false || @request.body.admin = null", + "updateRule": "id = @request.auth.id && (@request.body.admin = false || @request.body.admin = admin)" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "createRule": "", + "updateRule": "id = @request.auth.id && (@request.body.admin = null || @request.body.admin = admin)" + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759322469_updated_submissions.js b/web/backend/pb_migrations/1759322469_updated_submissions.js new file mode 100644 index 00000000..a7d6f2b8 --- /dev/null +++ b/web/backend/pb_migrations/1759322469_updated_submissions.js @@ -0,0 +1,44 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "refused", + "pending" + ] + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "waiting_approval", + "approved", + "refused" + ] + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759323526_updated_users.js b/web/backend/pb_migrations/1759323526_updated_users.js new file mode 100644 index 00000000..d474d04b --- /dev/null +++ b/web/backend/pb_migrations/1759323526_updated_users.js @@ -0,0 +1,29 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "passwordAuth": { + "identityFields": [ + "username", + "email" + ] + } + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "passwordAuth": { + "identityFields": [ + "username" + ] + } + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759324813_updated_users.js b/web/backend/pb_migrations/1759324813_updated_users.js new file mode 100644 index 00000000..4136376e --- /dev/null +++ b/web/backend/pb_migrations/1759324813_updated_users.js @@ -0,0 +1,20 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "viewRule": "id = @request.auth.id || @request.body.admin = true" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "viewRule": "id = @request.auth.id" + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759324829_updated_users.js b/web/backend/pb_migrations/1759324829_updated_users.js new file mode 100644 index 00000000..d4cf7627 --- /dev/null +++ b/web/backend/pb_migrations/1759324829_updated_users.js @@ -0,0 +1,20 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "listRule": "id = @request.auth.id || @request.body.admin = true" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "listRule": "id = @request.auth.id" + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759324878_updated_users.js b/web/backend/pb_migrations/1759324878_updated_users.js new file mode 100644 index 00000000..30fb30b4 --- /dev/null +++ b/web/backend/pb_migrations/1759324878_updated_users.js @@ -0,0 +1,22 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "listRule": "id = @request.auth.id || @request.auth.admin = true", + "manageRule": "@request.auth.admin = true" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "listRule": "id = @request.auth.id || @request.body.admin = true", + "manageRule": null + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759324890_updated_users.js b/web/backend/pb_migrations/1759324890_updated_users.js new file mode 100644 index 00000000..26027956 --- /dev/null +++ b/web/backend/pb_migrations/1759324890_updated_users.js @@ -0,0 +1,20 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "viewRule": "id = @request.auth.id || @request.auth.admin = true" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "viewRule": "id = @request.auth.id || @request.body.admin = true" + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759326542_updated_submissions.js b/web/backend/pb_migrations/1759326542_updated_submissions.js new file mode 100644 index 00000000..4aa4d2ad --- /dev/null +++ b/web/backend/pb_migrations/1759326542_updated_submissions.js @@ -0,0 +1,44 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "refused", + "pending" + ] + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759329927_created_community_gallery.js b/web/backend/pb_migrations/1759329927_created_community_gallery.js new file mode 100644 index 00000000..4951c3e7 --- /dev/null +++ b/web/backend/pb_migrations/1759329927_created_community_gallery.js @@ -0,0 +1,67 @@ +/// +migrate((app) => { + const collection = new Collection({ + "createRule": null, + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "", + "hidden": false, + "id": "text3208210256", + "max": 0, + "min": 0, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Vsov", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "_clone_KD7P", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + } + ], + "id": "pbc_2668482079", + "indexes": [], + "listRule": null, + "name": "community_gallery", + "system": false, + "type": "view", + "updateRule": null, + "viewQuery": "SELECT id, name, status FROM submissions", + "viewRule": null + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079"); + + return app.delete(collection); +}) diff --git a/web/backend/pb_migrations/1759329946_updated_community_gallery.js b/web/backend/pb_migrations/1759329946_updated_community_gallery.js new file mode 100644 index 00000000..70eb5c2e --- /dev/null +++ b/web/backend/pb_migrations/1759329946_updated_community_gallery.js @@ -0,0 +1,120 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT id, name, status, assets FROM submissions" + }, collection) + + // remove field + collection.fields.removeById("_clone_Vsov") + + // remove field + collection.fields.removeById("_clone_KD7P") + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Qk1t", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_ki4I", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_PpoB", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT id, name, status FROM submissions" + }, collection) + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Vsov", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_KD7P", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // remove field + collection.fields.removeById("_clone_Qk1t") + + // remove field + collection.fields.removeById("_clone_ki4I") + + // remove field + collection.fields.removeById("_clone_PpoB") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759330033_updated_community_gallery.js b/web/backend/pb_migrations/1759330033_updated_community_gallery.js new file mode 100644 index 00000000..b94d6100 --- /dev/null +++ b/web/backend/pb_migrations/1759330033_updated_community_gallery.js @@ -0,0 +1,144 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "listRule": "", + "viewRule": "" + }, collection) + + // remove field + collection.fields.removeById("_clone_Qk1t") + + // remove field + collection.fields.removeById("_clone_ki4I") + + // remove field + collection.fields.removeById("_clone_PpoB") + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_60Zn", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_NQSW", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_CEqL", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "listRule": null, + "viewRule": null + }, collection) + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Qk1t", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_ki4I", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_PpoB", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // remove field + collection.fields.removeById("_clone_60Zn") + + // remove field + collection.fields.removeById("_clone_NQSW") + + // remove field + collection.fields.removeById("_clone_CEqL") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759330172_updated_community_gallery.js b/web/backend/pb_migrations/1759330172_updated_community_gallery.js new file mode 100644 index 00000000..a5c2c60a --- /dev/null +++ b/web/backend/pb_migrations/1759330172_updated_community_gallery.js @@ -0,0 +1,179 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n s.created_by,\n u.username\nFROM submissions s\nJOIN users u ON s.created_by = u.id;" + }, collection) + + // remove field + collection.fields.removeById("_clone_60Zn") + + // remove field + collection.fields.removeById("_clone_NQSW") + + // remove field + collection.fields.removeById("_clone_CEqL") + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_PVgQ", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_Pydh", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_IDgw", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // add field + collection.fields.addAt(4, new Field({ + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "_clone_PcJq", + "maxSelect": 1, + "minSelect": 0, + "name": "created_by", + "presentable": true, + "required": true, + "system": false, + "type": "relation" + })) + + // add field + collection.fields.addAt(5, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Wpjd", + "max": 255, + "min": 5, + "name": "username", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT id, name, status, assets FROM submissions" + }, collection) + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_60Zn", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_NQSW", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_CEqL", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // remove field + collection.fields.removeById("_clone_PVgQ") + + // remove field + collection.fields.removeById("_clone_Pydh") + + // remove field + collection.fields.removeById("_clone_IDgw") + + // remove field + collection.fields.removeById("_clone_PcJq") + + // remove field + collection.fields.removeById("_clone_Wpjd") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759330278_updated_community_gallery.js b/web/backend/pb_migrations/1759330278_updated_community_gallery.js new file mode 100644 index 00000000..3302e024 --- /dev/null +++ b/web/backend/pb_migrations/1759330278_updated_community_gallery.js @@ -0,0 +1,198 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n u.username AS created_by\nFROM submissions s\nJOIN users u ON s.created_by = u.id;" + }, collection) + + // remove field + collection.fields.removeById("_clone_PVgQ") + + // remove field + collection.fields.removeById("_clone_Pydh") + + // remove field + collection.fields.removeById("_clone_IDgw") + + // remove field + collection.fields.removeById("_clone_PcJq") + + // remove field + collection.fields.removeById("_clone_Wpjd") + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_qxS8", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_soay", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_ViRy", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // add field + collection.fields.addAt(4, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Td44", + "max": 255, + "min": 5, + "name": "created_by", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n s.created_by,\n u.username\nFROM submissions s\nJOIN users u ON s.created_by = u.id;" + }, collection) + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_PVgQ", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_Pydh", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_IDgw", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // add field + collection.fields.addAt(4, new Field({ + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "_clone_PcJq", + "maxSelect": 1, + "minSelect": 0, + "name": "created_by", + "presentable": true, + "required": true, + "system": false, + "type": "relation" + })) + + // add field + collection.fields.addAt(5, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Wpjd", + "max": 255, + "min": 5, + "name": "username", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // remove field + collection.fields.removeById("_clone_qxS8") + + // remove field + collection.fields.removeById("_clone_soay") + + // remove field + collection.fields.removeById("_clone_ViRy") + + // remove field + collection.fields.removeById("_clone_Td44") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759330318_updated_submissions.js b/web/backend/pb_migrations/1759330318_updated_submissions.js new file mode 100644 index 00000000..feb17449 --- /dev/null +++ b/web/backend/pb_migrations/1759330318_updated_submissions.js @@ -0,0 +1,45 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected", + "added_to_collection" + ] + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_632646243") + + // update field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "select2063623452", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected" + ] + })) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759332236_updated_community_gallery.js b/web/backend/pb_migrations/1759332236_updated_community_gallery.js new file mode 100644 index 00000000..6c8154db --- /dev/null +++ b/web/backend/pb_migrations/1759332236_updated_community_gallery.js @@ -0,0 +1,227 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n s.updated,\n s.created,\n s.extras,\n u.username AS created_by\nFROM submissions s\nJOIN users u ON s.created_by = u.id;" + }, collection) + + // remove field + collection.fields.removeById("_clone_vRXF") + + // remove field + collection.fields.removeById("_clone_I7rz") + + // remove field + collection.fields.removeById("_clone_yLLt") + + // remove field + collection.fields.removeById("_clone_NzXr") + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_Jwk2", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_5hwn", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected", + "added_to_collection" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_EUTS", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // add field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "_clone_XtYJ", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + })) + + // add field + collection.fields.addAt(5, new Field({ + "hidden": false, + "id": "_clone_cSF4", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + })) + + // add field + collection.fields.addAt(6, new Field({ + "hidden": false, + "id": "_clone_SoU0", + "maxSize": 0, + "name": "extras", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + // add field + collection.fields.addAt(7, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_OlCN", + "max": 255, + "min": 5, + "name": "created_by", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_2668482079") + + // update collection data + unmarshal({ + "viewQuery": "SELECT s.id,\n s.name,\n s.status,\n s.assets,\n u.username AS created_by\nFROM submissions s\nJOIN users u ON s.created_by = u.id;" + }, collection) + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_vRXF", + "max": 128, + "min": 0, + "name": "name", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "hidden": false, + "id": "_clone_I7rz", + "maxSelect": 1, + "name": "status", + "presentable": true, + "required": true, + "system": false, + "type": "select", + "values": [ + "approved", + "pending", + "rejected", + "added_to_collection" + ] + })) + + // add field + collection.fields.addAt(3, new Field({ + "hidden": false, + "id": "_clone_yLLt", + "maxSelect": 99, + "maxSize": 0, + "mimeTypes": [ + "image/png", + "image/svg+xml" + ], + "name": "assets", + "presentable": false, + "protected": false, + "required": true, + "system": false, + "thumbs": [], + "type": "file" + })) + + // add field + collection.fields.addAt(4, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "_clone_NzXr", + "max": 255, + "min": 5, + "name": "created_by", + "pattern": "", + "presentable": true, + "primaryKey": false, + "required": true, + "system": false, + "type": "text" + })) + + // remove field + collection.fields.removeById("_clone_Jwk2") + + // remove field + collection.fields.removeById("_clone_5hwn") + + // remove field + collection.fields.removeById("_clone_EUTS") + + // remove field + collection.fields.removeById("_clone_XtYJ") + + // remove field + collection.fields.removeById("_clone_cSF4") + + // remove field + collection.fields.removeById("_clone_SoU0") + + // remove field + collection.fields.removeById("_clone_OlCN") + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759335166_updated_users.js b/web/backend/pb_migrations/1759335166_updated_users.js new file mode 100644 index 00000000..5b3cd4ed --- /dev/null +++ b/web/backend/pb_migrations/1759335166_updated_users.js @@ -0,0 +1,22 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "createRule": "", + "manageRule": null + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "createRule": "@request.body.admin = false || @request.body.admin = null", + "manageRule": "@request.auth.admin = true" + }, collection) + + return app.save(collection) +}) diff --git a/web/backend/pb_migrations/1759335187_updated_users.js b/web/backend/pb_migrations/1759335187_updated_users.js new file mode 100644 index 00000000..f6b9d109 --- /dev/null +++ b/web/backend/pb_migrations/1759335187_updated_users.js @@ -0,0 +1,20 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "createRule": "@request.body.admin = false || @request.body.admin = null" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "createRule": "" + }, collection) + + return app.save(collection) +})