add admin user ID to seed config and update notification relations
```
This commit is contained in:
louiscklaw
2025-05-11 17:29:19 +08:00
parent a4cdb4b1cc
commit 99ee2f9fc3
4 changed files with 53 additions and 18 deletions

View File

@@ -2,9 +2,9 @@ const config = require("/pb_hooks/seed/config.js");
const utils = require("/pb_hooks/seed/utils.js");
module.exports = ($app) => {
const { CR_cat_id_news, CR_cat_id_technology } = config;
const { CR_cat_id_news, CR_cat_id_technology, user_id_admin } = config;
const { getId, getAsset } = utils;
const ADMIN_USER_ID = getId("999");
const ADMIN_USER_ID = user_id_admin;
let row_array = [[ADMIN_USER_ID, "admin@123.com", "admin@123.com", "admin@123.com", true, true, "test_admin_1"]];

View File

@@ -5,7 +5,7 @@ const config = require("/pb_hooks/seed/config.js");
const utils = require("/pb_hooks/seed/utils.js");
//
module.exports = ($app) => {
const { CR_cat_id_news, CR_cat_id_technology } = config;
const { CR_cat_id_news, CR_cat_id_technology, user_id_admin, user_id_test_teacher_1 } = config;
const { getId, getAsset, dirtyTruncateTable } = utils;
// const ASSETS_DIR = "/pb_hooks/assets";
@@ -16,10 +16,10 @@ module.exports = ($app) => {
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
const SAMPLE_CUSTOMER_ARRAY = [
[getId("1"), "EV-004", false, "new_job", { id: getId("1"), name: "Jie Yan", avatar: "/assets/avatar-8.png" }, { title: "Remote React / React Native Developer" }, ""],
[getId("2"), "EV-003", true, "new_job", { id: getId("2"), name: "Fran Perez", avatar: "/assets/avatar-5.png" }, { title: "Senior Golang Backend Engineer" }, ""],
[getId("3"), "EV-002", true, "new_feature", "", "", "Logistics management is now available"],
[getId("4"), "EV-001", true, "new_company", { id: getId("3"), name: "Jie Yan", avatar: "/assets/avatar-8.png" }, { name: "Stripe" }, ""],
[getId("1"), "EV-004", false, "new_job", { id: getId("1"), name: "Jie Yan", avatar: "/assets/avatar-8.png" }, { title: "Remote React / React Native Developer" }, "", user_id_admin, user_id_test_teacher_1],
[getId("2"), "EV-003", true, "new_job", { id: getId("2"), name: "Fran Perez", avatar: "/assets/avatar-5.png" }, { title: "Senior Golang Backend Engineer" }, "", user_id_admin, user_id_test_teacher_1],
[getId("3"), "EV-002", true, "new_feature", "", "", "Logistics management is now available", user_id_admin, user_id_test_teacher_1],
[getId("4"), "EV-001", true, "new_company", { id: getId("3"), name: "Jie Yan", avatar: "/assets/avatar-8.png" }, { name: "Stripe" }, "", user_id_admin, user_id_test_teacher_1],
];
let row_array = SAMPLE_CUSTOMER_ARRAY;
@@ -35,9 +35,12 @@ module.exports = ($app) => {
record.set("NOTI_ID", customer[1]);
record.set("read", customer[2]);
record.set("type", customer[3]);
record.set("author", customer[4]);
// record.set("author1", customer[4]);
record.set("job", customer[5]);
record.set("description", customer[6]);
record.set("to_user_id", customer[7]);
record.set("from_user_id", customer[8]);
record.set("author", customer[8]);
$app.save(record);
}

View File

@@ -24,4 +24,7 @@ module.exports = {
CR_cat_id_news: "1".padStart(15, 0),
CR_cat_id_sports: "2".padStart(15, 0),
CR_cat_id_technology: "3".padStart(15, 0),
//
user_id_admin: "999".padStart(15, 0),
user_id_test_teacher_1: "11".padStart(15, 0),
};

View File

@@ -1057,16 +1057,6 @@
"system": false,
"type": "text"
},
{
"hidden": false,
"id": "json3182418120",
"maxSize": 0,
"name": "author",
"presentable": false,
"required": false,
"system": false,
"type": "json"
},
{
"hidden": false,
"id": "json4225294584",
@@ -1124,6 +1114,45 @@
"presentable": false,
"system": false,
"type": "autodate"
},
{
"cascadeDelete": false,
"collectionId": "pbc_1305841361",
"hidden": false,
"id": "relation704048736",
"maxSelect": 1,
"minSelect": 0,
"name": "to_user_id",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
},
{
"cascadeDelete": false,
"collectionId": "pbc_1305841361",
"hidden": false,
"id": "relation556806202",
"maxSelect": 1,
"minSelect": 0,
"name": "from_user_id",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
},
{
"cascadeDelete": false,
"collectionId": "pbc_1305841361",
"hidden": false,
"id": "relation3182418120",
"maxSelect": 1,
"minSelect": 0,
"name": "author",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
}
],
"indexes": [],