feat: bootstrap backend API, schema and forgejo task issues
This commit is contained in:
parent
77e837cc25
commit
09ea388190
15 changed files with 1557 additions and 0 deletions
20
backend/src/db/seed.js
Normal file
20
backend/src/db/seed.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import bcrypt from 'bcryptjs';
|
||||
import { pool } from './connection.js';
|
||||
|
||||
const run = async () => {
|
||||
const hash = await bcrypt.hash('changeme123', 12);
|
||||
await pool.query(
|
||||
`INSERT INTO users (email, password_hash, display_name) VALUES (?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE display_name = VALUES(display_name)`,
|
||||
['demo@helpyourneighbour.ch', hash, 'Demo User']
|
||||
);
|
||||
|
||||
console.log('Seed complete.');
|
||||
await pool.end();
|
||||
};
|
||||
|
||||
run().catch(async (err) => {
|
||||
console.error('Seed failed:', err.message);
|
||||
await pool.end();
|
||||
process.exit(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue