Fixed application acceptance not setting state correctly
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user