Refactored rank change logic

This commit is contained in:
2025-10-13 14:34:12 -04:00
parent b268ee46e1
commit 8c2872cd54
3 changed files with 32 additions and 13 deletions

View File

@@ -0,0 +1,23 @@
const pool = require('../db');
async function getAllRanks() {
const rows = await pool.query(
'SELECT id, name, short_name, sort_id FROM ranks;'
);
return rows;
}
async function insertMemberRank(change) {
const sql = `
INSERT INTO members_ranks (member_id, rank_id, event_date)
VALUES (?, ?, ?);
`;
console.log(change)
const params = [change.member_id, change.rank_id, change.event_date];
await pool.query(sql, params);
}
module.exports = {
getAllRanks,
insertMemberRank
};