mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-10-28 14:09:05 +08:00
feat(web): add PocketBase backend with migrations and database
This commit is contained in:
99
web/backend/pb_migrations/1759312120_updated_users.js
Normal file
99
web/backend/pb_migrations/1759312120_updated_users.js
Normal file
@@ -0,0 +1,99 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
36
web/backend/pb_migrations/1759312125_updated_users.js
Normal file
36
web/backend/pb_migrations/1759312125_updated_users.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
34
web/backend/pb_migrations/1759312218_updated_users.js
Normal file
34
web/backend/pb_migrations/1759312218_updated_users.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
146
web/backend/pb_migrations/1759312839_created_submission.js
Normal file
146
web/backend/pb_migrations/1759312839_created_submission.js
Normal file
@@ -0,0 +1,146 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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);
|
||||
})
|
||||
34
web/backend/pb_migrations/1759313082_updated_users.js
Normal file
34
web/backend/pb_migrations/1759313082_updated_users.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
32
web/backend/pb_migrations/1759313096_updated_users.js
Normal file
32
web/backend/pb_migrations/1759313096_updated_users.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
32
web/backend/pb_migrations/1759313140_updated_users.js
Normal file
32
web/backend/pb_migrations/1759313140_updated_users.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
28
web/backend/pb_migrations/1759313306_updated_submission.js
Normal file
28
web/backend/pb_migrations/1759313306_updated_submission.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
32
web/backend/pb_migrations/1759313389_updated_users.js
Normal file
32
web/backend/pb_migrations/1759313389_updated_users.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
28
web/backend/pb_migrations/1759313613_updated_users.js
Normal file
28
web/backend/pb_migrations/1759313613_updated_users.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
26
web/backend/pb_migrations/1759318802_updated_submission.js
Normal file
26
web/backend/pb_migrations/1759318802_updated_submission.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
78
web/backend/pb_migrations/1759319073_updated_submissions.js
Normal file
78
web/backend/pb_migrations/1759319073_updated_submissions.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
49
web/backend/pb_migrations/1759319167_updated_submissions.js
Normal file
49
web/backend/pb_migrations/1759319167_updated_submissions.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
22
web/backend/pb_migrations/1759320673_updated_users.js
Normal file
22
web/backend/pb_migrations/1759320673_updated_users.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
44
web/backend/pb_migrations/1759322469_updated_submissions.js
Normal file
44
web/backend/pb_migrations/1759322469_updated_submissions.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
29
web/backend/pb_migrations/1759323526_updated_users.js
Normal file
29
web/backend/pb_migrations/1759323526_updated_users.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
20
web/backend/pb_migrations/1759324813_updated_users.js
Normal file
20
web/backend/pb_migrations/1759324813_updated_users.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
20
web/backend/pb_migrations/1759324829_updated_users.js
Normal file
20
web/backend/pb_migrations/1759324829_updated_users.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
22
web/backend/pb_migrations/1759324878_updated_users.js
Normal file
22
web/backend/pb_migrations/1759324878_updated_users.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
20
web/backend/pb_migrations/1759324890_updated_users.js
Normal file
20
web/backend/pb_migrations/1759324890_updated_users.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
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)
|
||||
})
|
||||
Reference in New Issue
Block a user