Wrapped up discharge form close #159

This commit is contained in:
2026-01-28 15:39:45 -05:00
parent c646254616
commit 22eaba6f90
8 changed files with 111 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ import { PromotionDetails, PromotionSummary } from "@app/shared/types/rank"
import pool from "../../db";
import { PagedData } from "@app/shared/types/pagination";
import { toDate, toDateIgnoreZone, toDateTime } from "@app/shared/utils/time";
import * as mariadb from 'mariadb';
export async function getAllRanks() {
const rows = await pool.query(
@@ -105,4 +106,14 @@ export async function getPromotionsOnDay(day: Date): Promise<PromotionDetails[]>
let batchPromotion = await pool.query(sql, [dayString]) as PromotionDetails[];
return batchPromotion;
}
export async function cancelLatestRank(userID: number, con: mariadb.Pool | mariadb.Connection = pool): Promise<boolean> {
try {
let sql = `CALL sp_end_member_rank(?,NOW())`;
con.query(sql, [userID]);
return true;
} catch (error) {
throw error;
}
}