Fixed application acceptance not setting state correctly
This commit is contained in:
@@ -99,9 +99,13 @@ export async function getUserData(userID: number): Promise<Member> {
|
||||
return res[0] ?? null;
|
||||
}
|
||||
|
||||
export async function setUserState(userID: number, state: MemberState, reason: string, creatorID: number, externalCon?: mariadb.Connection | mariadb.PoolConnection) {
|
||||
export async function setUserState(userID: number, state: MemberState, reason: string, creatorID: number, externalCon?: mariadb.PoolConnection) {
|
||||
const isInternalConn = !externalCon;
|
||||
const con = (externalCon || await pool.getConnection()) as mariadb.PoolConnection;
|
||||
if(isInternalConn)
|
||||
var con = await pool.getConnection();
|
||||
else
|
||||
var con = externalCon;
|
||||
// const con = (externalCon || await pool.getConnection()) as mariadb.PoolConnection;
|
||||
|
||||
try {
|
||||
if (isInternalConn) await con.beginTransaction();
|
||||
@@ -246,12 +250,13 @@ export async function endLatestMemberState(memberID: number, con: mariadb.Pool |
|
||||
try {
|
||||
let res = await con.query(sql, [memberID]);
|
||||
console.log(res);
|
||||
return;
|
||||
} catch (error) {
|
||||
logger.error('app', 'Error ending latest member state', {
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
let res = await pool.query(sql, [memberID]);
|
||||
console.log(res);
|
||||
// let res = await pool.query(sql, [memberID]);
|
||||
// console.log(res);
|
||||
}
|
||||
Reference in New Issue
Block a user