评论与评分系统

This commit is contained in:
2025-09-19 22:59:34 +08:00
parent c2d5948301
commit 65e483b626
10 changed files with 279 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bun
import 'dotenv/config';
import bcrypt from 'bcryptjs';
import { prisma } from '../src/lib/prisma';
async function main() {
const [username, newPassword] = process.argv.slice(2);
if (!username || !newPassword) {
console.error('Usage: bun scripts/resetPassword.ts <username> <newPassword>');
process.exit(1);
}
const user = await prisma.user.findUnique({ where: { username } });
if (!user) {
console.error(`User not found: ${username}`);
process.exit(2);
}
const hash = await bcrypt.hash(newPassword, 10);
await prisma.user.update({ where: { id: user.id }, data: { password: hash } });
console.log(`Password reset for user: ${username}`);
}
main().finally(() => prisma.$disconnect());