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

@@ -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);
}