add otp swagger1

This commit is contained in:
2026-05-11 14:53:55 +03:30
parent 22d8b15000
commit e60401a86c
3 changed files with 193 additions and 7 deletions

View File

@@ -1,7 +1,5 @@
import { PrismaClient } from "../lib/generated/prisma";
import bcrypt from "bcryptjs";
const prisma = new PrismaClient();
import { db } from "../lib/db";
async function main() {
console.log("🔧 ساخت کاربر ادمین...\n");
@@ -11,11 +9,11 @@ async function main() {
const hashedPassword = await bcrypt.hash(password, 10);
// حذف کاربر قبلی اگر وجود دارد
await prisma.user.deleteMany({
await db.user.deleteMany({
where: { email },
});
const user = await prisma.user.create({
const user = await db.user.create({
data: {
email,
password: hashedPassword,
@@ -40,5 +38,5 @@ main()
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
await db.$disconnect();
});