mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-22 20:42:01 +00:00
- Updated AccountPopover to utilize session data for user information display. - Modified ApplicationLayout to fetch user details from the database using Prisma. - Replaced Checkbox components with native input elements in SignUpForm for better accessibility. - Enhanced seed script to include default islands and create related data in the database.
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import { faker } from "@faker-js/faker";
|
|
import { PrismaClient } from "@prisma/client";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
const DEFAULT_ISLANDS = ["Dharanboodhoo", "Feeali", "Nilandhoo", "Magoodhoo"];
|
|
|
|
async function main() {
|
|
const users = Array.from({ length: 25 }, () => ({
|
|
name: `${faker.person.fullName().split(" ")[1]} House-${crypto
|
|
.randomUUID()
|
|
.slice(0, 5)}`,
|
|
email: faker.internet.email(),
|
|
emailVerified: false,
|
|
firstPaymentDone: false,
|
|
verified: false,
|
|
address: faker.location.streetAddress(),
|
|
id_card: `A${Math.round(Math.random() * 999999)}`,
|
|
dob: faker.date.between({
|
|
from: "1900-01-01",
|
|
to: "2000-01-01",
|
|
}),
|
|
phoneNumber: String(faker.number.int({ min: 7000000, max: 9999999 })),
|
|
phoneNumberVerified: false,
|
|
role: "USER",
|
|
}));
|
|
|
|
await prisma.user.createMany({
|
|
data: users,
|
|
});
|
|
const FAAFU_ATOLL = await prisma.atoll.create({
|
|
data: {
|
|
name: "F",
|
|
},
|
|
});
|
|
|
|
const islands = DEFAULT_ISLANDS.map((name) => ({
|
|
name,
|
|
atollId: FAAFU_ATOLL.id,
|
|
}));
|
|
await prisma.island.createMany({
|
|
data: islands,
|
|
});
|
|
}
|
|
|
|
main()
|
|
.then(() => prisma.$disconnect())
|
|
.catch(async (e) => {
|
|
console.error(e);
|
|
await prisma.$disconnect();
|
|
process.exit(1);
|
|
});
|