Adds relationships and loads secrets into the session details

This commit is contained in:
2025-05-28 15:42:49 -07:00
parent 73c7dac802
commit 65ac4852df
7 changed files with 269 additions and 6 deletions

View File

@@ -0,0 +1,100 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = new Collection({
"createRule": null,
"deleteRule": null,
"fields": [
{
"autogeneratePattern": "[a-z0-9]{15}",
"hidden": false,
"id": "text3208210256",
"max": 15,
"min": 15,
"name": "id",
"pattern": "^[a-z0-9]+$",
"presentable": false,
"primaryKey": true,
"required": true,
"system": true,
"type": "text"
},
{
"cascadeDelete": false,
"collectionId": "pbc_3332084752",
"hidden": false,
"id": "relation390457990",
"maxSelect": 1,
"minSelect": 0,
"name": "primary",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
},
{
"cascadeDelete": false,
"collectionId": "pbc_3332084752",
"hidden": false,
"id": "relation458454037",
"maxSelect": 999,
"minSelect": 0,
"name": "secondary",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
},
{
"hidden": false,
"id": "select2363381545",
"maxSelect": 1,
"name": "type",
"presentable": false,
"required": false,
"system": false,
"type": "select",
"values": [
"plannedFor",
"discoveredIn"
]
},
{
"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_617371094",
"indexes": [
"CREATE INDEX `idx_relationships_documents` ON `relationships` (\n `primary`,\n `secondary`\n)",
"CREATE INDEX `idx_relationships_types` ON `relationships` (`type`)"
],
"listRule": null,
"name": "relationships",
"system": false,
"type": "base",
"updateRule": null,
"viewRule": null
});
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094");
return app.delete(collection);
})

View File

@@ -0,0 +1,42 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094")
// update field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "select2363381545",
"maxSelect": 1,
"name": "type",
"presentable": false,
"required": false,
"system": false,
"type": "select",
"values": [
"discoveredIn",
"plannedSecrets"
]
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094")
// update field
collection.fields.addAt(3, new Field({
"hidden": false,
"id": "select2363381545",
"maxSelect": 1,
"name": "type",
"presentable": false,
"required": false,
"system": false,
"type": "select",
"values": [
"plannedFor",
"discoveredIn"
]
}))
return app.save(collection)
})

View File

@@ -0,0 +1,27 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094")
// update collection data
unmarshal({
"indexes": [
"CREATE INDEX `idx_relationships_documents` ON `relationships` (\n `primary`,\n `secondary`\n)",
"CREATE INDEX `idx_relationships_types` ON `relationships` (`type`)",
"CREATE UNIQUE INDEX `idx_relationships_primary_type` ON `relationships` (\n `primary`,\n `type`\n)"
]
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094")
// update collection data
unmarshal({
"indexes": [
"CREATE INDEX `idx_relationships_documents` ON `relationships` (\n `primary`,\n `secondary`\n)",
"CREATE INDEX `idx_relationships_types` ON `relationships` (`type`)"
]
}, collection)
return app.save(collection)
})

View File

@@ -0,0 +1,34 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_3332084752")
// update field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "json2918445923",
"maxSize": 0,
"name": "data",
"presentable": true,
"required": false,
"system": false,
"type": "json"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_3332084752")
// update field
collection.fields.addAt(2, new Field({
"hidden": false,
"id": "json2918445923",
"maxSize": 0,
"name": "data",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
return app.save(collection)
})

View File

@@ -0,0 +1,28 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094")
// update collection data
unmarshal({
"createRule": "",
"deleteRule": "@request.auth.id = primary.campaign.owner.id",
"listRule": "@request.auth.id = primary.campaign.owner.id",
"updateRule": "@request.auth.id = primary.campaign.owner.id",
"viewRule": "@request.auth.id = primary.campaign.owner.id"
}, collection)
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_617371094")
// update collection data
unmarshal({
"createRule": null,
"deleteRule": null,
"listRule": null,
"updateRule": null,
"viewRule": null
}, collection)
return app.save(collection)
})