Updated rank change page systems
This commit is contained in:
@@ -11,7 +11,26 @@ const pool = require('../db');
|
||||
|
||||
//insert a new latest role for a user
|
||||
ur.post('/', async (req, res) => {
|
||||
try {
|
||||
const App = req.body?.App || {};
|
||||
|
||||
// TODO: replace with current user ID
|
||||
const memberId = 1;
|
||||
|
||||
const sql = `INSERT INTO applications (member_id, app_version, app_data) VALUES (?, ?, ?);`;
|
||||
const appVersion = 1;
|
||||
|
||||
const params = [memberId, appVersion, JSON.stringify(App)]
|
||||
|
||||
console.log(params)
|
||||
|
||||
await pool.query(sql, params);
|
||||
|
||||
res.sendStatus(201);
|
||||
} catch (err) {
|
||||
console.error('Insert failed:', err);
|
||||
res.status(500).json({ error: 'Failed to save application' });
|
||||
}
|
||||
});
|
||||
|
||||
r.get('/', async (req, res) => {
|
||||
@@ -25,6 +44,6 @@ r.get('/', async (req, res) => {
|
||||
});
|
||||
|
||||
module.exports.ranks = r;
|
||||
module.exports.userRanks = ur;
|
||||
module.exports.memberRanks = ur;
|
||||
|
||||
// TODO, implement get all ranks route with SQL stirng SELECT id, name, short_name, category, sort_id FROM ranks;
|
||||
Reference in New Issue
Block a user