feat: Implement file upload and management system with database integration

This commit is contained in:
2025-07-30 11:37:25 +02:00
parent 07b4af5f24
commit 639a7b7eab
9 changed files with 778 additions and 0 deletions

28
update-admin-username.js Normal file
View File

@@ -0,0 +1,28 @@
import Database from "better-sqlite3";
const db = new Database("./data/database.sqlite");
console.log("🔄 Updating admin username...");
try {
// Update admin username from email to simple "admin"
const result = db.prepare('UPDATE users SET username = ? WHERE username = ?').run('admin', 'admin@localhost.com');
if (result.changes > 0) {
console.log('✅ Admin username updated to "admin"');
} else {
console.log(' No admin user found with email "admin@localhost.com"');
}
// Show current users
const users = db.prepare("SELECT name, username, role FROM users").all();
console.log("\nCurrent users:");
users.forEach(user => {
console.log(` - ${user.name} (${user.role}): username="${user.username}"`);
});
} catch (error) {
console.error("❌ Error:", error.message);
} finally {
db.close();
}