finalized application acceptance system and started making types shared across front and backend
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
import pool from "../db";
|
||||
|
||||
export enum MemberState {
|
||||
Guest = "guest",
|
||||
Applicant = "applicant",
|
||||
Member = "member",
|
||||
Retired = "retired",
|
||||
Banned = "banned",
|
||||
Denied = "denied"
|
||||
}
|
||||
|
||||
export async function getUserData(userID: number) {
|
||||
const sql = `SELECT * FROM members WHERE id = ?`;
|
||||
const res = await pool.query(sql, [userID]);
|
||||
return res[0] ?? null;
|
||||
}
|
||||
|
||||
export async function setUserState(userID: number, state: MemberState) {
|
||||
const sql = `UPDATE members
|
||||
SET state = ?
|
||||
WHERE id = ?;`;
|
||||
return await pool.query(sql, [state, userID]);
|
||||
}
|
||||
Reference in New Issue
Block a user