Fixed application acceptance not setting state correctly

This commit is contained in:
2026-02-08 00:49:23 -05:00
parent 2789b79b82
commit f77f5b5a7f
3 changed files with 36 additions and 10 deletions

View File

@@ -1,6 +1,8 @@
import { ApplicationListRow, ApplicationRow, CommentRow } from "@app/shared/types/application";
import pool from "../../db";
import { error } from "console";
import * as mariadb from 'mariadb';
/**
* Create an application in the db
@@ -72,7 +74,7 @@ export async function getAllMemberApplications(memberID: number): Promise<Applic
}
export async function approveApplication(id: number, approver: number) {
export async function approveApplication(id: number, approver: number, con: mariadb.Connection | mariadb.Pool = pool) {
const sql = `
UPDATE applications
SET approved_at = NOW(), approved_by = ?
@@ -81,7 +83,7 @@ export async function approveApplication(id: number, approver: number) {
AND denied_at IS NULL
`;
const result = await pool.execute(sql, [approver, id]);
const result = await con.query(sql, [approver, id]);
if (result.affectedRows == 1) {
return
} else {