Wrapped up discharge form close #159
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user