forked from hangshuo652/aurak
feat: implement QuestionBank CRUD with pagination and template query
- Add pagination support to findAll (page, limit query params) - Add findByTemplateId method to service - Add GET /by-template/:templateId endpoint to controller - Service already includes CRUD for QuestionBank and QuestionBankItem
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Quick script to reset the admin user password for E2E testing.
|
||||
* Usage: node reset-admin.mjs <newpassword>
|
||||
*/
|
||||
import Database from 'better-sqlite3';
|
||||
import bcrypt from 'bcrypt';
|
||||
import { fileURLToPath } from 'url';
|
||||
import path from 'path';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const DB_PATH = path.resolve(__dirname, '../data/metadata.db');
|
||||
const newPassword = process.argv[2] || 'Admin@2026';
|
||||
|
||||
const db = new Database(DB_PATH);
|
||||
|
||||
const hashed = await bcrypt.hash(newPassword, 10);
|
||||
const result = db.prepare("UPDATE users SET password = ? WHERE username = 'admin'").run(hashed);
|
||||
|
||||
if (result.changes > 0) {
|
||||
console.log(`✅ Admin password reset to: ${newPassword}`);
|
||||
} else {
|
||||
console.log('❌ Admin user not found');
|
||||
}
|
||||
db.close();
|
||||
Reference in New Issue
Block a user