diff --git a/002_source/pocketbase/pb_hooks/assets/customer1.png b/002_source/pocketbase/pb_hooks/assets/customer1.png new file mode 100644 index 0000000..ac76f10 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/customer1.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/customer2.png b/002_source/pocketbase/pb_hooks/assets/customer2.png new file mode 100644 index 0000000..2fa26f4 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/customer2.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/customer3.png b/002_source/pocketbase/pb_hooks/assets/customer3.png new file mode 100644 index 0000000..e5312ae Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/customer3.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/customer4.png b/002_source/pocketbase/pb_hooks/assets/customer4.png new file mode 100644 index 0000000..9cae02c Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/customer4.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/customer5.png b/002_source/pocketbase/pb_hooks/assets/customer5.png new file mode 100644 index 0000000..327af31 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/customer5.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/student1.png b/002_source/pocketbase/pb_hooks/assets/student1.png new file mode 100644 index 0000000..ac76f10 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/student1.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/student2.png b/002_source/pocketbase/pb_hooks/assets/student2.png new file mode 100644 index 0000000..2fa26f4 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/student2.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/student3.png b/002_source/pocketbase/pb_hooks/assets/student3.png new file mode 100644 index 0000000..e5312ae Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/student3.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/student4.png b/002_source/pocketbase/pb_hooks/assets/student4.png new file mode 100644 index 0000000..9cae02c Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/student4.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/student5.png b/002_source/pocketbase/pb_hooks/assets/student5.png new file mode 100644 index 0000000..327af31 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/student5.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/teacher1.png b/002_source/pocketbase/pb_hooks/assets/teacher1.png new file mode 100644 index 0000000..ac76f10 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/teacher1.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/teacher2.png b/002_source/pocketbase/pb_hooks/assets/teacher2.png new file mode 100644 index 0000000..2fa26f4 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/teacher2.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/teacher3.png b/002_source/pocketbase/pb_hooks/assets/teacher3.png new file mode 100644 index 0000000..e5312ae Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/teacher3.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/teacher4.png b/002_source/pocketbase/pb_hooks/assets/teacher4.png new file mode 100644 index 0000000..9cae02c Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/teacher4.png differ diff --git a/002_source/pocketbase/pb_hooks/assets/teacher5.png b/002_source/pocketbase/pb_hooks/assets/teacher5.png new file mode 100644 index 0000000..327af31 Binary files /dev/null and b/002_source/pocketbase/pb_hooks/assets/teacher5.png differ diff --git a/002_source/pocketbase/pb_hooks/seed.pb.js b/002_source/pocketbase/pb_hooks/seed.pb.js index 4502bcf..e37fe5a 100644 --- a/002_source/pocketbase/pb_hooks/seed.pb.js +++ b/002_source/pocketbase/pb_hooks/seed.pb.js @@ -27,6 +27,14 @@ $app.rootCmd.addCommand( require(`${__hooks}/seed/031_QuizMFQuestions.js`)($app); // require(`${__hooks}/seed/040_QuizCRCategories.js`)($app); + require(`${__hooks}/seed/041_QuizCRQuestions.js`)($app); + // + require(`${__hooks}/seed/050_Customers.js`)($app); + require(`${__hooks}/seed/051_Teachers.js`)($app); + require(`${__hooks}/seed/052_Students.js`)($app); + // + require(`${__hooks}/seed/060_Notifications.js`)($app); + $app.reloadCachedCollections(); $app.reloadSettings(); diff --git a/002_source/pocketbase/pb_hooks/seed/040_QuizCRCategories.js b/002_source/pocketbase/pb_hooks/seed/040_QuizCRCategories.js index f2d4f6a..7db62e0 100644 --- a/002_source/pocketbase/pb_hooks/seed/040_QuizCRCategories.js +++ b/002_source/pocketbase/pb_hooks/seed/040_QuizCRCategories.js @@ -33,7 +33,7 @@ module.exports = ($app) => { $app.save(record); } - console.log(`030_QuizCRCategories done`); + console.log(`040_QuizCRCategories done`); }; const dirtyTruncateTable = (COLLECTION_NAME) => { diff --git a/002_source/pocketbase/pb_hooks/seed/041_QuizCRQuestions.js b/002_source/pocketbase/pb_hooks/seed/041_QuizCRQuestions.js new file mode 100644 index 0000000..863486a --- /dev/null +++ b/002_source/pocketbase/pb_hooks/seed/041_QuizCRQuestions.js @@ -0,0 +1,187 @@ +module.exports = ($app) => { + const ASSETS_DIR = "/pb_hooks/assets"; + const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name); + const id_v = "1".padStart(15, 0); //id_vocabulary + const id_c = "2".padStart(15, 0); //id_connectives + const cat_id_technology = "3".padStart(15, 0); + const getId = (id) => id.padStart(15, 0); + let row_array = [ + [ + getId("1"), + "news (CR)", + getAsset("ci_news.jpg"), + 1, + {}, + "visible", + "news", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_1", + "question_sh_1", + "modal_ans_1", + cat_id_technology, + {}, + ], + [ + getId("2"), + "sports (CR)", + getAsset("ci_sports.jpg"), + 2, + {}, + "visible", + "sports", + getAsset("mouse.mp3"), + cat_id_technology, + "question_fh_2", + "question_sh_2", + "modal_ans_2", + cat_id_technology, + {}, + ], + [ + getId("3"), + "technology (CR)", + getAsset("ci_technology.jpg"), + 3, + {}, + "visible", + "technology", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_3", + "question_sh_3", + "modal_ans_3", + cat_id_technology, + {}, + ], + [ + getId("4"), + "art (CR)", + getAsset("ci_art.jpg"), + 4, + {}, + "visible", + "art", + getAsset("mouse.mp3"), + cat_id_technology, + "question_fh_4", + "question_sh_4", + "modal_ans_4", + cat_id_technology, + {}, + ], + [ + getId("5"), + "basic (CR)", + getAsset("ci_basic.jpg"), + 5, + {}, + "visible", + "basic", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_5", + "question_sh_5", + "modal_ans_5", + cat_id_technology, + {}, + ], + [ + getId("6"), + "nature (CR)", + getAsset("ci_nature.jpg"), + 6, + {}, + "visible", + "nature", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_6", + "question_sh_6", + "modal_ans_6", + cat_id_technology, + {}, + ], + [ + getId("7"), + "workplace (CR)", + getAsset("ci_workplace.jpg"), + 7, + {}, + "visible", + "workplace", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_7", + "question_sh_7", + "modal_ans_7", + cat_id_technology, + {}, + ], + [ + getId("8"), + "workplace (CR)", + getAsset("ci_workplace.jpg"), + 8, + {}, + "visible", + "workplace", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_8", + "question_sh_8", + "modal_ans_8", + cat_id_technology, + {}, + ], + [ + getId("99"), + "test hidden (CR)", + getAsset("ci_workplace.jpg"), + 9, + {}, + "hidden", + "test", + getAsset("keyboard.mp3"), + cat_id_technology, + "question_fh_9", + "question_sh_9", + "modal_ans_9", + cat_id_technology, + {}, + ], + ]; + dirtyTruncateTable("QuizCRQuestions"); + + let lt_collection = $app.findCollectionByNameOrId("QuizCRQuestions"); + + for (let i = 0; i < row_array.length; i++) { + let lesson_type = row_array[i]; + + let record = new Record(lt_collection); + record.set("id", lesson_type[0]); + record.set("cat_name", lesson_type[1]); + record.set("cat_image", lesson_type[2]); + record.set("pos", lesson_type[3]); + record.set("init_answer", lesson_type[4]); + record.set("visible", lesson_type[5]); + record.set("word", lesson_type[6]); + record.set("sound", lesson_type[7]); + record.set("cat_id", lesson_type[7]); + record.set("question_fh", lesson_type[9]); + record.set("question_sh", lesson_type[10]); + record.set("modal_ans", lesson_type[11]); + record.set("caf_id", lesson_type[12]); + record.set("options", lesson_type[13]); + + $app.save(record); + } + + console.log(`041_QuizCRQuestions done`); +}; + +const dirtyTruncateTable = (COLLECTION_NAME) => { + console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`); + const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`); + cmd_to_exec.output(); +}; diff --git a/002_source/pocketbase/pb_hooks/seed/050_Customers.js b/002_source/pocketbase/pb_hooks/seed/050_Customers.js new file mode 100644 index 0000000..2a27e75 --- /dev/null +++ b/002_source/pocketbase/pb_hooks/seed/050_Customers.js @@ -0,0 +1,152 @@ +// +// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here +// +module.exports = ($app) => { + const ASSETS_DIR = "/pb_hooks/assets"; + const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name); + const id_v = "1".padStart(15, 0); //id_vocabulary + const id_c = "2".padStart(15, 0); //id_connectives + const getId = (id) => id.padStart(15, 0); + + // generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs` + const SAMPLE_CUSTOMER_ARRAY = [ + [ + "000000000000001", + "May", + getAsset("customer1.png"), + "June_Wintheiser33@hotmail.com", + "281-378-5900 x822", + "Green, Rempel and Hoeger", + { + country: "UK", + state: "Arizona", + city: "Winfieldburgh", + zipCode: "92017-8004", + line1: "1838 Willa Freeway", + line2: "Suite 307", + }, + 98, + "Asia/Urumqi", + "fr", + "USD", + "active", + ], + [ + "000000000000002", + "Marilyne", + getAsset("customer2.png"), + "Carol_Blick@yahoo.com", + "(893) 919-2445 x193", + "White - Hessel", + { + country: "US", + state: "Nevada", + city: "Casa Grande", + zipCode: "83831-3843", + line1: "6984 Alberto Radial", + line2: "Suite 154", + }, + 49, + "Africa/Tunis", + "es", + "EUR", + "pending", + ], + [ + "000000000000003", + "Jacklyn", + getAsset("customer3.png"), + "Tamara_Lynch11@yahoo.com", + "597-593-0144 x168", + "Rolfson LLC", + { + country: "CA", + state: "Georgia", + city: "New Brodyfort", + zipCode: "18887-7075", + line1: "493 Pfannerstill Meadow", + line2: "Apt. 358", + }, + 44, + "Asia/Manila", + "en", + "GBP", + "blocked", + ], + [ + "000000000000004", + "Alana", + getAsset("customer4.png"), + "Ahmed_Willms@hotmail.com", + "401.212.0386 x31125", + "Friesen, Langworth and Thompson", + { + country: "UK", + state: "North Carolina", + city: "Fort Jerrell", + zipCode: "14211", + line1: "1763 West Street", + line2: "Suite 699", + }, + 34, + "America/Boa_Vista", + "es", + "USD", + "active", + ], + [ + "000000000000005", + "Rocky", + getAsset("customer5.png"), + "Angela_Kuhic@gmail.com", + "653.964.0412", + "Hayes - Morar", + { + country: "US", + state: "New York", + city: "Kayton", + zipCode: "82048-0645", + line1: "636 Angel Junction", + line2: "Apt. 361", + }, + 70, + "America/Grand_Turk", + "fr", + "EUR", + "pending", + ], + ]; + + let row_array = SAMPLE_CUSTOMER_ARRAY; + dirtyTruncateTable("Customers"); + + let lt_collection = $app.findCollectionByNameOrId("Customers"); + + for (let i = 0; i < row_array.length; i++) { + let customer = row_array[i]; + + let record = new Record(lt_collection); + record.set("id", customer[0]); + record.set("name", customer[1]); + record.set("avatar_file", customer[2]); + record.set("email", customer[3]); + record.set("phone", customer[4]); + record.set("company", customer[5]); + record.set("billingAddress", customer[6]); + record.set("taxId", customer[7]); + record.set("timezone", customer[8]); + record.set("language", customer[9]); + record.set("currency", customer[10]); + record.set("status", customer[11]); + + $app.save(record); + } + + console.log(`050_Customers done`); +}; + +const dirtyTruncateTable = (COLLECTION_NAME) => { + console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`); + const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`); + cmd_to_exec.output(); +}; diff --git a/002_source/pocketbase/pb_hooks/seed/051_Teachers.js b/002_source/pocketbase/pb_hooks/seed/051_Teachers.js new file mode 100644 index 0000000..0a991cc --- /dev/null +++ b/002_source/pocketbase/pb_hooks/seed/051_Teachers.js @@ -0,0 +1,152 @@ +// +// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here +// +module.exports = ($app) => { + const ASSETS_DIR = "/pb_hooks/assets"; + const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name); + const id_v = "1".padStart(15, 0); //id_vocabulary + const id_c = "2".padStart(15, 0); //id_connectives + const getId = (id) => id.padStart(15, 0); + + // generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs` + const TEACHER_ARRAY = [ + [ + getId("1"), + "May", + getAsset("teacher1.png"), + "June_Wintheiser33@hotmail.com", + "281-378-5900 x822", + "Green, Rempel and Hoeger", + { + country: "UK", + state: "Arizona", + city: "Winfieldburgh", + zipCode: "92017-8004", + line1: "1838 Willa Freeway", + line2: "Suite 307", + }, + 98, + "Asia/Urumqi", + "fr", + "USD", + "active", + ], + [ + getId("2"), + "Marilyne", + getAsset("teacher2.png"), + "Carol_Blick@yahoo.com", + "(893) 919-2445 x193", + "White - Hessel", + { + country: "US", + state: "Nevada", + city: "Casa Grande", + zipCode: "83831-3843", + line1: "6984 Alberto Radial", + line2: "Suite 154", + }, + 49, + "Africa/Tunis", + "es", + "EUR", + "pending", + ], + [ + getId("3"), + "Jacklyn", + getAsset("teacher3.png"), + "Tamara_Lynch11@yahoo.com", + "597-593-0144 x168", + "Rolfson LLC", + { + country: "CA", + state: "Georgia", + city: "New Brodyfort", + zipCode: "18887-7075", + line1: "493 Pfannerstill Meadow", + line2: "Apt. 358", + }, + 44, + "Asia/Manila", + "en", + "GBP", + "blocked", + ], + [ + getId("4"), + "Alana", + getAsset("teacher4.png"), + "Ahmed_Willms@hotmail.com", + "401.212.0386 x31125", + "Friesen, Langworth and Thompson", + { + country: "UK", + state: "North Carolina", + city: "Fort Jerrell", + zipCode: "14211", + line1: "1763 West Street", + line2: "Suite 699", + }, + 34, + "America/Boa_Vista", + "es", + "USD", + "active", + ], + [ + getId("5"), + "Rocky", + getAsset("teacher5.png"), + "Angela_Kuhic@gmail.com", + "653.964.0412", + "Hayes - Morar", + { + country: "US", + state: "New York", + city: "Kayton", + zipCode: "82048-0645", + line1: "636 Angel Junction", + line2: "Apt. 361", + }, + 70, + "America/Grand_Turk", + "fr", + "EUR", + "pending", + ], + ]; + + let row_array = TEACHER_ARRAY; + dirtyTruncateTable("Teachers"); + + let lt_collection = $app.findCollectionByNameOrId("Teachers"); + + for (let i = 0; i < row_array.length; i++) { + let teacher = row_array[i]; + + let record = new Record(lt_collection); + record.set("id", teacher[0]); + record.set("name", teacher[1]); + record.set("avatar_file", teacher[2]); + record.set("email", teacher[3]); + record.set("phone", teacher[4]); + record.set("company", teacher[5]); + record.set("billingAddress", teacher[6]); + record.set("taxId", teacher[7]); + record.set("timezone", teacher[8]); + record.set("language", teacher[9]); + record.set("currency", teacher[10]); + record.set("status", teacher[11]); + + $app.save(record); + } + + console.log(`051_Teacher done`); +}; + +const dirtyTruncateTable = (COLLECTION_NAME) => { + console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`); + const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`); + cmd_to_exec.output(); +}; diff --git a/002_source/pocketbase/pb_hooks/seed/052_Students.js b/002_source/pocketbase/pb_hooks/seed/052_Students.js new file mode 100644 index 0000000..b66f021 --- /dev/null +++ b/002_source/pocketbase/pb_hooks/seed/052_Students.js @@ -0,0 +1,152 @@ +// +// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here +// +module.exports = ($app) => { + const ASSETS_DIR = "/pb_hooks/assets"; + const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name); + const id_v = "1".padStart(15, 0); //id_vocabulary + const id_c = "2".padStart(15, 0); //id_connectives + const getId = (id) => id.padStart(15, 0); + + // generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs` + const STUDENT_ARRAY = [ + [ + getId("1"), + "May", + getAsset("student1.png"), + "June_Wintheiser33@hotmail.com", + "281-378-5900 x822", + "Green, Rempel and Hoeger", + { + country: "UK", + state: "Arizona", + city: "Winfieldburgh", + zipCode: "92017-8004", + line1: "1838 Willa Freeway", + line2: "Suite 307", + }, + 98, + "Asia/Urumqi", + "fr", + "USD", + "active", + ], + [ + getId("2"), + "Marilyne", + getAsset("student2.png"), + "Carol_Blick@yahoo.com", + "(893) 919-2445 x193", + "White - Hessel", + { + country: "US", + state: "Nevada", + city: "Casa Grande", + zipCode: "83831-3843", + line1: "6984 Alberto Radial", + line2: "Suite 154", + }, + 49, + "Africa/Tunis", + "es", + "EUR", + "pending", + ], + [ + getId("3"), + "Jacklyn", + getAsset("student3.png"), + "Tamara_Lynch11@yahoo.com", + "597-593-0144 x168", + "Rolfson LLC", + { + country: "CA", + state: "Georgia", + city: "New Brodyfort", + zipCode: "18887-7075", + line1: "493 Pfannerstill Meadow", + line2: "Apt. 358", + }, + 44, + "Asia/Manila", + "en", + "GBP", + "blocked", + ], + [ + getId("4"), + "Alana", + getAsset("student4.png"), + "Ahmed_Willms@hotmail.com", + "401.212.0386 x31125", + "Friesen, Langworth and Thompson", + { + country: "UK", + state: "North Carolina", + city: "Fort Jerrell", + zipCode: "14211", + line1: "1763 West Street", + line2: "Suite 699", + }, + 34, + "America/Boa_Vista", + "es", + "USD", + "active", + ], + [ + getId("5"), + "Rocky", + getAsset("student5.png"), + "Angela_Kuhic@gmail.com", + "653.964.0412", + "Hayes - Morar", + { + country: "US", + state: "New York", + city: "Kayton", + zipCode: "82048-0645", + line1: "636 Angel Junction", + line2: "Apt. 361", + }, + 70, + "America/Grand_Turk", + "fr", + "EUR", + "pending", + ], + ]; + + let row_array = STUDENT_ARRAY; + dirtyTruncateTable("Students"); + + let lt_collection = $app.findCollectionByNameOrId("Students"); + + for (let i = 0; i < row_array.length; i++) { + let student = row_array[i]; + + let record = new Record(lt_collection); + record.set("id", student[0]); + record.set("name", student[1]); + record.set("avatar_file", student[2]); + record.set("email", student[3]); + record.set("phone", student[4]); + record.set("company", student[5]); + record.set("billingAddress", student[6]); + record.set("taxId", student[7]); + record.set("timezone", student[8]); + record.set("language", student[9]); + record.set("currency", student[10]); + record.set("status", student[11]); + + $app.save(record); + } + + console.log(`052_Students done`); +}; + +const dirtyTruncateTable = (COLLECTION_NAME) => { + console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`); + const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`); + cmd_to_exec.output(); +}; diff --git a/002_source/pocketbase/pb_hooks/seed/060_Notifications.js b/002_source/pocketbase/pb_hooks/seed/060_Notifications.js new file mode 100644 index 0000000..09d86f0 --- /dev/null +++ b/002_source/pocketbase/pb_hooks/seed/060_Notifications.js @@ -0,0 +1,80 @@ +// +// RULES: this is not a normal nodejs engine, it is a nodejs provided by golang, so fakerjs cannot be used here +// +module.exports = ($app) => { + const ASSETS_DIR = "/pb_hooks/assets"; + const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name); + const id_v = "1".padStart(15, 0); //id_vocabulary + const id_c = "2".padStart(15, 0); //id_connectives + 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' }, + "" + ], + [ + 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' }, + "" + + ], + ]; + + let row_array = SAMPLE_CUSTOMER_ARRAY; + dirtyTruncateTable("Notifications"); + + let lt_collection = $app.findCollectionByNameOrId("Notifications"); + + for (let i = 0; i < row_array.length; i++) { + let customer = 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("author", customer[4]); + record.set("job", customer[5]); + record.set("description", customer[6]); + + $app.save(record); + } + + console.log(`060_Notifications done`); +}; + +const dirtyTruncateTable = (COLLECTION_NAME) => { + console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`); + const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`); + cmd_to_exec.output(); +}; diff --git a/002_source/pocketbase/pb_hooks/seed/PARKING.md b/002_source/pocketbase/pb_hooks/seed/PARKING.md new file mode 100644 index 0000000..4c35890 --- /dev/null +++ b/002_source/pocketbase/pb_hooks/seed/PARKING.md @@ -0,0 +1,12 @@ +# task + +i want you to draft `041_QuizCRQuestions.js` + +## steps + +1. read file `021_QuizLPQuestions.js` +1. read file `031_QuizMFQuestions.js` +1. read file `041_QuizCRQuestions.js` +1. update the constants, variables and functions name in `041_QuizCRQuestions.js` + +thanks diff --git a/002_source/pocketbase/pb_migrations/1745293175_updated_UserMetas.js b/002_source/pocketbase/pb_migrations/1745293175_updated_UserMetas.js new file mode 100644 index 0000000..096dc36 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745293175_updated_UserMetas.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_1305841361") + + // update collection data + unmarshal({ + "createRule": "", + "deleteRule": "", + "listRule": "", + "updateRule": "", + "viewRule": "" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_1305841361") + + // update collection data + unmarshal({ + "createRule": null, + "deleteRule": null, + "listRule": null, + "updateRule": null, + "viewRule": null + }, collection) + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745294961_updated_QuizMFQuestions.js b/002_source/pocketbase/pb_migrations/1745294961_updated_QuizMFQuestions.js new file mode 100644 index 0000000..aa13253 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745294961_updated_QuizMFQuestions.js @@ -0,0 +1,29 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_3346420851") + + // add field + collection.fields.addAt(4, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text2058414169", + "max": 0, + "min": 0, + "name": "visible", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_3346420851") + + // remove field + collection.fields.removeById("text2058414169") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745295287_updated_QuizMFQuestions.js b/002_source/pocketbase/pb_migrations/1745295287_updated_QuizMFQuestions.js new file mode 100644 index 0000000..44eab74 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745295287_updated_QuizMFQuestions.js @@ -0,0 +1,48 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_3346420851") + + // add field + collection.fields.addAt(7, new Field({ + "hidden": false, + "id": "file4170105732", + "maxSelect": 1, + "maxSize": 0, + "mimeTypes": [], + "name": "sound", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": [], + "type": "file" + })) + + // add field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "file2034676914", + "maxSelect": 1, + "maxSize": 0, + "mimeTypes": [], + "name": "cat_image", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": [], + "type": "file" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_3346420851") + + // remove field + collection.fields.removeById("file4170105732") + + // remove field + collection.fields.removeById("file2034676914") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745319575_created_customers.js b/002_source/pocketbase/pb_migrations/1745319575_created_customers.js new file mode 100644 index 0000000..c00ff98 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745319575_created_customers.js @@ -0,0 +1,57 @@ +/// +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" + }, + { + "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_108570809", + "indexes": [], + "listRule": null, + "name": "customers", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809"); + + return app.delete(collection); +}) diff --git a/002_source/pocketbase/pb_migrations/1745319595_updated_customers.js b/002_source/pocketbase/pb_migrations/1745319595_updated_customers.js new file mode 100644 index 0000000..6f250e5 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745319595_updated_customers.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // update collection data + unmarshal({ + "createRule": "", + "deleteRule": "", + "listRule": "", + "updateRule": "", + "viewRule": "" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // update collection data + unmarshal({ + "createRule": null, + "deleteRule": null, + "listRule": null, + "updateRule": null, + "viewRule": null + }, collection) + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745319727_updated_customers.js b/002_source/pocketbase/pb_migrations/1745319727_updated_customers.js new file mode 100644 index 0000000..1583edc --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745319727_updated_customers.js @@ -0,0 +1,122 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // add field + collection.fields.addAt(1, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1579384326", + "max": 0, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(2, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text3885137012", + "max": 0, + "min": 0, + "name": "email", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(3, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1146066909", + "max": 0, + "min": 0, + "name": "phone", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(4, new Field({ + "hidden": false, + "id": "number1813778413", + "max": null, + "min": null, + "name": "quota", + "onlyInt": false, + "presentable": false, + "required": false, + "system": false, + "type": "number" + })) + + // add field + collection.fields.addAt(5, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text2063623452", + "max": 0, + "min": 0, + "name": "status", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(6, new Field({ + "hidden": false, + "id": "file507207115", + "maxSelect": 1, + "maxSize": 0, + "mimeTypes": [], + "name": "avatar_file", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": [], + "type": "file" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // remove field + collection.fields.removeById("text1579384326") + + // remove field + collection.fields.removeById("text3885137012") + + // remove field + collection.fields.removeById("text1146066909") + + // remove field + collection.fields.removeById("number1813778413") + + // remove field + collection.fields.removeById("text2063623452") + + // remove field + collection.fields.removeById("file507207115") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745319840_updated_customers.js b/002_source/pocketbase/pb_migrations/1745319840_updated_customers.js new file mode 100644 index 0000000..618d11a --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745319840_updated_customers.js @@ -0,0 +1,20 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // update collection data + unmarshal({ + "name": "Customers" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // update collection data + unmarshal({ + "name": "customers" + }, collection) + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745325500_updated_Customers.js b/002_source/pocketbase/pb_migrations/1745325500_updated_Customers.js new file mode 100644 index 0000000..ecd2ffd --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745325500_updated_Customers.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // add field + collection.fields.addAt(7, new Field({ + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "relation2809058197", + "maxSelect": 1, + "minSelect": 0, + "name": "user_id", + "presentable": false, + "required": false, + "system": false, + "type": "relation" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // remove field + collection.fields.removeById("relation2809058197") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745335861_created_billingAddress.js b/002_source/pocketbase/pb_migrations/1745335861_created_billingAddress.js new file mode 100644 index 0000000..6ef983c --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745335861_created_billingAddress.js @@ -0,0 +1,141 @@ +/// +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" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1400097126", + "max": 0, + "min": 0, + "name": "country", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text2744374011", + "max": 0, + "min": 0, + "name": "state", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text760939060", + "max": 0, + "min": 0, + "name": "city", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text4114525948", + "max": 0, + "min": 0, + "name": "zipCode", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text3620973610", + "max": 0, + "min": 0, + "name": "line1", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1322974608", + "max": 0, + "min": 0, + "name": "line2", + "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_1509025625", + "indexes": [], + "listRule": null, + "name": "billingAddress", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_1509025625"); + + return app.delete(collection); +}) diff --git a/002_source/pocketbase/pb_migrations/1745336779_updated_users.js b/002_source/pocketbase/pb_migrations/1745336779_updated_users.js new file mode 100644 index 0000000..31ad8b2 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745336779_updated_users.js @@ -0,0 +1,25 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // add field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "json2115670734", + "maxSize": 0, + "name": "billingAddress", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // remove field + collection.fields.removeById("json2115670734") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745336794_updated_users.js b/002_source/pocketbase/pb_migrations/1745336794_updated_users.js new file mode 100644 index 0000000..6a61283 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745336794_updated_users.js @@ -0,0 +1,25 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // remove field + collection.fields.removeById("json2115670734") + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // add field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "json2115670734", + "maxSize": 0, + "name": "billingAddress", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745336809_updated_Customers.js b/002_source/pocketbase/pb_migrations/1745336809_updated_Customers.js new file mode 100644 index 0000000..a6d48a4 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745336809_updated_Customers.js @@ -0,0 +1,25 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // add field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "json2115670734", + "maxSize": 0, + "name": "billingAddress", + "presentable": false, + "required": false, + "system": false, + "type": "json" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // remove field + collection.fields.removeById("json2115670734") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745340777_updated_Customers.js b/002_source/pocketbase/pb_migrations/1745340777_updated_Customers.js new file mode 100644 index 0000000..2c44780 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745340777_updated_Customers.js @@ -0,0 +1,29 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // add field + collection.fields.addAt(9, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text922858135", + "max": 0, + "min": 0, + "name": "timezone", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // remove field + collection.fields.removeById("text922858135") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745340821_updated_Customers.js b/002_source/pocketbase/pb_migrations/1745340821_updated_Customers.js new file mode 100644 index 0000000..5ea8959 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745340821_updated_Customers.js @@ -0,0 +1,48 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // add field + collection.fields.addAt(10, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text3571151285", + "max": 0, + "min": 0, + "name": "language", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + // add field + collection.fields.addAt(11, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1767278655", + "max": 0, + "min": 0, + "name": "currency", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_108570809") + + // remove field + collection.fields.removeById("text3571151285") + + // remove field + collection.fields.removeById("text1767278655") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745462325_created_Teachers.js b/002_source/pocketbase/pb_migrations/1745462325_created_Teachers.js new file mode 100644 index 0000000..df56719 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745462325_created_Teachers.js @@ -0,0 +1,204 @@ +/// +migrate((app) => { + const collection = new Collection({ + "createRule": "", + "deleteRule": "", + "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": 0, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text3885137012", + "max": 0, + "min": 0, + "name": "email", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1146066909", + "max": 0, + "min": 0, + "name": "phone", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "number1813778413", + "max": null, + "min": null, + "name": "quota", + "onlyInt": false, + "presentable": false, + "required": false, + "system": false, + "type": "number" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text2063623452", + "max": 0, + "min": 0, + "name": "status", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "file507207115", + "maxSelect": 1, + "maxSize": 0, + "mimeTypes": [], + "name": "avatar_file", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": [], + "type": "file" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "relation2809058197", + "maxSelect": 1, + "minSelect": 0, + "name": "user_id", + "presentable": false, + "required": false, + "system": false, + "type": "relation" + }, + { + "hidden": false, + "id": "json2115670734", + "maxSize": 0, + "name": "billingAddress", + "presentable": false, + "required": false, + "system": false, + "type": "json" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text922858135", + "max": 0, + "min": 0, + "name": "timezone", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text3571151285", + "max": 0, + "min": 0, + "name": "language", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1767278655", + "max": 0, + "min": 0, + "name": "currency", + "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_1413424569", + "indexes": [], + "listRule": "", + "name": "Teachers", + "system": false, + "type": "base", + "updateRule": "", + "viewRule": "" + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_1413424569"); + + return app.delete(collection); +}) diff --git a/002_source/pocketbase/pb_migrations/1745462333_created_Students.js b/002_source/pocketbase/pb_migrations/1745462333_created_Students.js new file mode 100644 index 0000000..e9ec83e --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745462333_created_Students.js @@ -0,0 +1,204 @@ +/// +migrate((app) => { + const collection = new Collection({ + "createRule": "", + "deleteRule": "", + "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": 0, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text3885137012", + "max": 0, + "min": 0, + "name": "email", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1146066909", + "max": 0, + "min": 0, + "name": "phone", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "number1813778413", + "max": null, + "min": null, + "name": "quota", + "onlyInt": false, + "presentable": false, + "required": false, + "system": false, + "type": "number" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text2063623452", + "max": 0, + "min": 0, + "name": "status", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "file507207115", + "maxSelect": 1, + "maxSize": 0, + "mimeTypes": [], + "name": "avatar_file", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": [], + "type": "file" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "relation2809058197", + "maxSelect": 1, + "minSelect": 0, + "name": "user_id", + "presentable": false, + "required": false, + "system": false, + "type": "relation" + }, + { + "hidden": false, + "id": "json2115670734", + "maxSize": 0, + "name": "billingAddress", + "presentable": false, + "required": false, + "system": false, + "type": "json" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text922858135", + "max": 0, + "min": 0, + "name": "timezone", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text3571151285", + "max": 0, + "min": 0, + "name": "language", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text1767278655", + "max": 0, + "min": 0, + "name": "currency", + "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_491894781", + "indexes": [], + "listRule": "", + "name": "Students", + "system": false, + "type": "base", + "updateRule": "", + "viewRule": "" + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_491894781"); + + return app.delete(collection); +}) diff --git a/002_source/pocketbase/pb_migrations/1745473349_created_Notifications.js b/002_source/pocketbase/pb_migrations/1745473349_created_Notifications.js new file mode 100644 index 0000000..cf84d4d --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745473349_created_Notifications.js @@ -0,0 +1,100 @@ +/// +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" + }, + { + "hidden": false, + "id": "bool2555855207", + "name": "read", + "presentable": false, + "required": false, + "system": false, + "type": "bool" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text2363381545", + "max": 0, + "min": 0, + "name": "type", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "json3182418120", + "maxSize": 0, + "name": "author", + "presentable": false, + "required": false, + "system": false, + "type": "json" + }, + { + "hidden": false, + "id": "json4225294584", + "maxSize": 0, + "name": "job", + "presentable": false, + "required": false, + "system": false, + "type": "json" + }, + { + "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_977978967", + "indexes": [], + "listRule": null, + "name": "Notifications", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null + }); + + return app.save(collection); +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967"); + + return app.delete(collection); +}) diff --git a/002_source/pocketbase/pb_migrations/1745473581_updated_Notifications.js b/002_source/pocketbase/pb_migrations/1745473581_updated_Notifications.js new file mode 100644 index 0000000..2655e53 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745473581_updated_Notifications.js @@ -0,0 +1,29 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967") + + // add field + collection.fields.addAt(5, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1843675174", + "max": 0, + "min": 0, + "name": "description", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967") + + // remove field + collection.fields.removeById("text1843675174") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745473942_updated_Notifications.js b/002_source/pocketbase/pb_migrations/1745473942_updated_Notifications.js new file mode 100644 index 0000000..742c807 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745473942_updated_Notifications.js @@ -0,0 +1,29 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967") + + // add field + collection.fields.addAt(6, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1798508311", + "max": 0, + "min": 0, + "name": "NOTI_ID", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967") + + // remove field + collection.fields.removeById("text1798508311") + + return app.save(collection) +}) diff --git a/002_source/pocketbase/pb_migrations/1745487597_updated_Notifications.js b/002_source/pocketbase/pb_migrations/1745487597_updated_Notifications.js new file mode 100644 index 0000000..1fd4f93 --- /dev/null +++ b/002_source/pocketbase/pb_migrations/1745487597_updated_Notifications.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967") + + // update collection data + unmarshal({ + "createRule": "", + "deleteRule": "", + "listRule": "", + "updateRule": "", + "viewRule": "" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("pbc_977978967") + + // update collection data + unmarshal({ + "createRule": null, + "deleteRule": null, + "listRule": null, + "updateRule": null, + "viewRule": null + }, collection) + + return app.save(collection) +})