Sửa lỗi nhấn + để thêm thành viên của tour

This commit is contained in:
2026-06-14 17:16:19 +07:00
parent c6d0fdd5d1
commit 81e715ddb3
24 changed files with 515 additions and 239 deletions
+33
View File
@@ -0,0 +1,33 @@
import { PrismaClient } from './prisma/client.js';
import bcrypt from 'bcrypt';
const prisma = new PrismaClient();
async function main() {
const email = 'owner@travel.com';
const newPassword = 'admin123';
const hash = await bcrypt.hash(newPassword, 10);
const user = await prisma.user.findUnique({ where: { email } });
if (!user) {
console.log('Tạo tài khoản admin mới...');
await prisma.user.create({
data: {
email,
passwordHash: hash,
name: 'Admin',
isAdmin: true,
},
});
} else {
await prisma.user.update({
where: { email },
data: { passwordHash: hash, isAdmin: true },
});
}
console.log(`Đã cập nhật xong mật khẩu cho ${email}`);
await prisma.$disconnect();
}
main();