``fix inconsistent quotes in code and update schema with additional fields and rules``

This commit is contained in:
louiscklaw
2025-05-13 13:26:22 +08:00
parent 3e1f2e1057
commit 1aa0502edc
3 changed files with 175 additions and 88 deletions

View File

@@ -1,11 +1,11 @@
import { faker } from "@faker-js/faker"; import { faker } from '@faker-js/faker';
const getId = (id) => id.padStart(15, "0"); const getId = (id) => id.padStart(15, '0');
const row_array = Array.from({ length: 10 }, (_, i) => [ const row_array = Array.from({ length: 10 }, (_, i) => [
getId(String(i + 1)), getId(String(i + 1)),
faker.person.firstName(), faker.person.firstName(),
"", '',
faker.internet.email(), faker.internet.email(),
faker.phone.number(), faker.phone.number(),
faker.company.name(), faker.company.name(),
@@ -19,13 +19,11 @@ const row_array = Array.from({ length: 10 }, (_, i) => [
}, },
Math.floor(Math.random() * (100 - 0 + 1)) + 0, Math.floor(Math.random() * (100 - 0 + 1)) + 0,
faker.location.timeZone(), faker.location.timeZone(),
["en", "de", "es", "fr", "ja", "ko", "zh-CN"].sort( ['en', 'de', 'es', 'fr', 'ja', 'ko', 'zh-CN'].sort(() => Math.random() - 0.5)[0],
() => Math.random() - 0.5
)[0],
faker.finance.currencyCode(), faker.finance.currencyCode(),
]); ]);
import fs from "fs"; import fs from 'fs';
const filePath = "output.json"; const filePath = 'output.json';
fs.writeFileSync(filePath, JSON.stringify(row_array, null, 2)); fs.writeFileSync(filePath, JSON.stringify(row_array, null, 2));
console.log(`Wrote ${row_array.length} records to ${filePath}`); console.log(`Wrote ${row_array.length} records to ${filePath}`);

View File

@@ -1,4 +1,4 @@
// Generated at: 2025-05-12T06:02:53.613Z // Generated at: 2025-05-13T05:24:33.962Z
// //
@@ -206,9 +206,9 @@ Table QuizLPCategories {
cat_image file cat_image file
pos integer pos integer
init_answer text init_answer text
visible text
created datetime created datetime
updated datetime updated datetime
visible text
slug text slug text
remarks text remarks text
description text description text
@@ -223,8 +223,6 @@ Table QuizLPQuestions {
word text word text
sound file sound file
cat_id integer [ref: > QuizLPCategories.id] // relation3870140739 cat_id integer [ref: > QuizLPCategories.id] // relation3870140739
created datetime
updated datetime
cat_name text cat_name text
cat_image file cat_image file
pos integer pos integer
@@ -233,6 +231,8 @@ Table QuizLPQuestions {
slug text slug text
remarks text remarks text
description text description text
created datetime
updated datetime
} }
// //
@@ -258,9 +258,9 @@ Table QuizMFCategories {
cat_image file cat_image file
pos integer pos integer
init_answer text init_answer text
visible text
created datetime created datetime
updated datetime updated datetime
visible text
} }
// //
@@ -341,17 +341,23 @@ Table Teachers {
// collection type: base // collection type: base
Table UserMetas { Table UserMetas {
id text [pk, not null] id text [pk, not null]
helloworld text address text
meta text meta text
user_id integer [ref: > users.id] // relation2809058197 user_id integer [ref: > users.id] // relation2809058197
state text
created datetime created datetime
updated datetime updated datetime
status text
avatar file avatar file
role text role text
name text name text
email text email text
phone text phone text
company text
taxId text
timezone text
language text
currency text
billingAddress integer [ref: > billingAddress.id] // relation2115670734
} }
// //

View File

@@ -1750,6 +1750,20 @@
"system": false, "system": false,
"type": "json" "type": "json"
}, },
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{ {
"hidden": false, "hidden": false,
"id": "autodate2990389176", "id": "autodate2990389176",
@@ -1770,20 +1784,6 @@
"system": false, "system": false,
"type": "autodate" "type": "autodate"
}, },
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{ {
"autogeneratePattern": "", "autogeneratePattern": "",
"hidden": false, "hidden": false,
@@ -1892,26 +1892,6 @@
"system": false, "system": false,
"type": "relation" "type": "relation"
}, },
{
"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"
},
{ {
"autogeneratePattern": "", "autogeneratePattern": "",
"hidden": false, "hidden": false,
@@ -2014,6 +1994,26 @@
"required": false, "required": false,
"system": false, "system": false,
"type": "editor" "type": "editor"
},
{
"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"
} }
], ],
"indexes": [], "indexes": [],
@@ -2182,6 +2182,20 @@
"system": false, "system": false,
"type": "json" "type": "json"
}, },
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{ {
"hidden": false, "hidden": false,
"id": "autodate2990389176", "id": "autodate2990389176",
@@ -2201,20 +2215,6 @@
"presentable": false, "presentable": false,
"system": false, "system": false,
"type": "autodate" "type": "autodate"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
} }
], ],
"indexes": [], "indexes": [],
@@ -2870,7 +2870,7 @@
"id": "text4192936109", "id": "text4192936109",
"max": 0, "max": 0,
"min": 0, "min": 0,
"name": "helloworld", "name": "address",
"pattern": "", "pattern": "",
"presentable": false, "presentable": false,
"primaryKey": false, "primaryKey": false,
@@ -2901,6 +2901,20 @@
"system": false, "system": false,
"type": "relation" "type": "relation"
}, },
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2744374011",
"max": 0,
"min": 0,
"name": "state",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{ {
"hidden": false, "hidden": false,
"id": "autodate2990389176", "id": "autodate2990389176",
@@ -2921,20 +2935,6 @@
"system": false, "system": false,
"type": "autodate" "type": "autodate"
}, },
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2744374011",
"max": 0,
"min": 0,
"name": "status",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{ {
"hidden": false, "hidden": false,
"id": "file376926767", "id": "file376926767",
@@ -3001,6 +3001,89 @@
"required": false, "required": false,
"system": false, "system": false,
"type": "text" "type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text1337919823",
"max": 0,
"min": 0,
"name": "company",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2020362641",
"max": 0,
"min": 0,
"name": "taxId",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"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"
},
{
"cascadeDelete": false,
"collectionId": "pbc_1509025625",
"hidden": false,
"id": "relation2115670734",
"maxSelect": 999,
"minSelect": 0,
"name": "billingAddress",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
} }
], ],
"indexes": [], "indexes": [],
@@ -3604,11 +3687,11 @@
}, },
{ {
"id": "pbc_1509025625", "id": "pbc_1509025625",
"listRule": null, "listRule": "",
"viewRule": null, "viewRule": "",
"createRule": null, "createRule": "",
"updateRule": null, "updateRule": "",
"deleteRule": null, "deleteRule": "",
"name": "billingAddress", "name": "billingAddress",
"type": "base", "type": "base",
"fields": [ "fields": [
@@ -3798,11 +3881,11 @@
}, },
{ {
"id": "pbc_2109205374", "id": "pbc_2109205374",
"listRule": null, "listRule": "",
"viewRule": null, "viewRule": "",
"createRule": null, "createRule": "",
"updateRule": null, "updateRule": "",
"deleteRule": null, "deleteRule": "",
"name": "t1", "name": "t1",
"type": "base", "type": "base",
"fields": [ "fields": [