mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-01 15:23:58 +00:00
Enhance user verification and data validation features
- Updated `next.config.ts` to include remote image patterns for user verification. - Introduced `VerifyUserDetails` function in `lib/person.ts` to validate user data against national records. - Added `usePerson` hook for fetching national data based on ID card. - Enhanced `signup` and `signin` functions in `auth-actions.ts` to handle user verification status and send notifications for pending verifications. - Refactored `VerifyUser` function in `user-actions.ts` to incorporate national data validation. - Improved UI components in the user verification page to display both database and national information. - Updated `InputReadOnly` component to support customizable label classes for better styling. These changes improve the user verification process, ensuring data integrity and enhancing the overall user experience.
This commit is contained in:
@ -7,36 +7,44 @@ const DEFAULT_ISLANDS = ["Dharanboodhoo", "Feeali", "Nilandhoo", "Magoodhoo"];
|
||||
async function main() {
|
||||
await prisma.user.upsert({
|
||||
where: {
|
||||
phoneNumber: "+9607780588",
|
||||
phoneNumber: process.env.ADMIN_PHONENUMBER,
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
name: "Admin Admin",
|
||||
email: "admin@example.com",
|
||||
email: process.env.ADMIN_EMAIL,
|
||||
emailVerified: true,
|
||||
verified: true,
|
||||
address: "Sky villa",
|
||||
id_card: "A265117",
|
||||
id_card: process.env.ADMIN_IDCARD,
|
||||
dob: new Date("1990-01-01"),
|
||||
phoneNumber: "+9607780588",
|
||||
phoneNumber: process.env.ADMIN_PHONENUMBER ?? "",
|
||||
phoneNumberVerified: true,
|
||||
role: "ADMIN",
|
||||
},
|
||||
});
|
||||
|
||||
const FAAFU_ATOLL = await prisma.atoll.create({
|
||||
data: {
|
||||
let FAAFU_ATOLL_ID = "";
|
||||
const atollExists = await prisma.atoll.findFirst({
|
||||
where: {
|
||||
name: "F",
|
||||
},
|
||||
});
|
||||
if (!atollExists) {
|
||||
const NEW_ATOLL = await prisma.atoll.create({
|
||||
data: {
|
||||
name: "F",
|
||||
},
|
||||
});
|
||||
FAAFU_ATOLL_ID = NEW_ATOLL.id;
|
||||
|
||||
const islands = DEFAULT_ISLANDS.map((name) => ({
|
||||
name,
|
||||
atollId: FAAFU_ATOLL.id,
|
||||
}));
|
||||
await prisma.island.createMany({
|
||||
data: islands,
|
||||
});
|
||||
const islands = DEFAULT_ISLANDS.map((name) => ({
|
||||
name,
|
||||
atollId: FAAFU_ATOLL_ID,
|
||||
}));
|
||||
await prisma.island.createMany({
|
||||
data: islands,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
|
Reference in New Issue
Block a user