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