update seed file,
This commit is contained in:
1
002_source/pocketbase/pb_hooks/seed/.gitignore
vendored
Normal file
1
002_source/pocketbase/pb_hooks/seed/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
_archive
|
@@ -15,32 +15,34 @@ module.exports = ($app) => {
|
||||
// const getId = (id) => id.padStart(15, 0);
|
||||
|
||||
// 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" }, "", 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],
|
||||
const SAMPLE_NOTI_ARRAY = [
|
||||
[getId("1"), "EV-004", "2025-05-01", false, "new_job", user_id_admin, { title: "Remote React / React Native Developer" }, "", {}, user_id_admin, "https://www.google.com"],
|
||||
[getId("2"), "EV-003", "2025-05-01", false, "new_job", user_id_admin, { title: "Senior Golang Backend Engineer" }, "", {}, user_id_admin, "https://www.google.com"],
|
||||
[getId("3"), "EV-002", "2025-05-01", false, "new_feature", user_id_admin, {}, "Logistics management is now available", {}, user_id_admin, "https://www.google.com"],
|
||||
[getId("4"), "EV-001", "2025-05-01", false, "new_company", user_id_admin, {}, "", { name: "Stripe" }, user_id_admin, "https://www.google.com"],
|
||||
[getId("5"), "EV-005", "2025-05-01", false, "new_company", user_id_admin, {}, "", { name: "Stripe (without link test)" }, user_id_admin, null],
|
||||
];
|
||||
|
||||
let row_array = SAMPLE_CUSTOMER_ARRAY;
|
||||
let row_array = SAMPLE_NOTI_ARRAY;
|
||||
dirtyTruncateTable("Notifications");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId("Notifications");
|
||||
|
||||
for (let i = 0; i < row_array.length; i++) {
|
||||
let customer = row_array[i];
|
||||
let noti = row_array[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set("id", customer[0]);
|
||||
record.set("NOTI_ID", customer[1]);
|
||||
record.set("read", customer[2]);
|
||||
record.set("type", customer[3]);
|
||||
// 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]);
|
||||
record.set("id", noti[0]);
|
||||
record.set("NOTI_ID", noti[1]);
|
||||
record.set("created_at", noti[2]);
|
||||
record.set("read", noti[3]);
|
||||
record.set("type", noti[4]);
|
||||
record.set("author", noti[5]);
|
||||
record.set("job", noti[6]);
|
||||
record.set("description", noti[7]);
|
||||
record.set("company", noti[8]);
|
||||
record.set("to_user_id", noti[9]);
|
||||
record.set("link", noti[10]);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
@@ -1153,6 +1153,27 @@
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
},
|
||||
{
|
||||
"convertURLs": false,
|
||||
"hidden": false,
|
||||
"id": "editor4274335913",
|
||||
"maxSize": 0,
|
||||
"name": "content",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "editor"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "json1337919823",
|
||||
"maxSize": 0,
|
||||
"name": "company",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "json"
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
|
Reference in New Issue
Block a user