This commit is contained in:
louiscklaw
2025-05-30 01:14:10 +08:00
parent 98bc3fe3ce
commit 834f58bde1
52 changed files with 624 additions and 604 deletions

View File

@@ -20,13 +20,13 @@ async function userItem() {
const username = `${firstName.toLowerCase()}-${lastName.toLowerCase()}`;
const alice = await prisma.userItem.upsert({
where: { id: 0 },
where: { id: 'admin_uuid' },
update: {},
create: {
name: `${firstName} ${lastName}`,
name: `admin test`,
city: '',
role: '',
email: `${username}@${SEED_EMAIL_DOMAIN}`,
email: `admin@123.com`,
state: '',
status: '',
address: '',
@@ -37,8 +37,8 @@ async function userItem() {
phoneNumber: '',
isVerified: true,
//
username,
password: await generateHash('Abc1234!'),
username: 'admin@123.com',
password: await generateHash('Aa1234567'),
},
});
@@ -57,16 +57,16 @@ async function userItem() {
}
const randomFaker = getRandomCJKFaker();
const alice = await prisma.userItem.upsert({
where: { id: i },
await prisma.userItem.upsert({
where: { id: i.toString() },
update: {},
create: {
name: randomFaker.person.fullName(),
city: randomFaker.location.city(),
role: 'user',
role: ROLE[Math.floor(Math.random() * ROLE.length)],
email: randomFaker.internet.email(),
state: randomFaker.location.state(),
status: '',
status: STATUS[Math.floor(Math.random() * STATUS.length)],
address: randomFaker.location.streetAddress(),
country: randomFaker.location.country(),
zipCode: randomFaker.location.zipCode(),
@@ -95,3 +95,32 @@ const userItemSeed = userItem()
});
export { userItemSeed };
const ROLE = [
`CEO`,
`CTO`,
`Project Coordinator`,
`Team Leader`,
`Software Developer`,
`Marketing Strategist`,
`Data Analyst`,
`Product Owner`,
`Graphic Designer`,
`Operations Manager`,
`Customer Support Specialist`,
`Sales Manager`,
`HR Recruiter`,
`Business Consultant`,
`Financial Planner`,
`Network Engineer`,
`Content Creator`,
`Quality Assurance Tester`,
`Public Relations Officer`,
`IT Administrator`,
`Compliance Officer`,
`Event Planner`,
`Legal Counsel`,
`Training Coordinator`,
];
const STATUS = ['active', 'pending', 'banned'];