i701 c06c4fee3f Implement parental control features and enhance device management
- Added a new Parental Control page for managing device access and notifications.
- Introduced blockDevice function to handle blocking and unblocking devices based on payment status.
- Enhanced omada-actions.ts to include device blocking logic and improved error handling.
- Updated DevicesTable component to integrate BlockDeviceButton for managing device states.
- Implemented API route for checking device statuses and sending notifications for expiring devices.
- Refactored payment processing to update device statuses upon successful payment verification.
- Added new utility functions for API key validation and SMS notifications.

These changes improve user control over device management and enhance the overall functionality of the application.
2024-12-22 21:34:57 +05:00

49 lines
930 B
TypeScript

import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const DEFAULT_ISLANDS = ["Dharanboodhoo", "Feeali", "Nilandhoo", "Magoodhoo"];
async function main() {
await prisma.user.upsert({
where: {
phoneNumber: "+9607780588",
},
update: {},
create: {
name: "Admin Admin",
email: "admin@example.com",
emailVerified: true,
verified: true,
address: "Sky villa",
id_card: "A265117",
dob: new Date("1990-01-01"),
phoneNumber: "+9607780588",
phoneNumberVerified: true,
role: "ADMIN",
},
});
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);
});