Updated rank change page systems

This commit is contained in:
2025-09-15 10:38:50 -04:00
parent 3da4d33167
commit 456c29a731
4 changed files with 69 additions and 33 deletions

View File

@@ -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;