application-dp-upgrade #66

Merged
Ajdj100 merged 10 commits from application-dp-upgrade into main 2025-12-12 10:16:57 -06:00
2 changed files with 10 additions and 9 deletions
Showing only changes of commit 0a1704b60b - Show all commits

View File

@@ -141,8 +141,9 @@ router.get('/:id', async (req: Request, res: Response) => {
});
// POST /application/approve/:id
router.post('/approve/:id', async (req, res) => {
const appID = req.params.id;
router.post('/approve/:id', async (req: Request, res: Response) => {
const appID = Number(req.params.id);
const approved_by = req.user.id;
try {
const app = await getApplicationByID(appID);
@@ -153,14 +154,14 @@ router.post('/approve/:id', async (req, res) => {
throw new Error("Something went wrong approving the application");
}
console.log(app.member_id);
//update user profile
await setUserState(app.member_id, MemberState.Member);
let nextRank = await getRankByName('Recruit')
await insertMemberRank(app.member_id, nextRank.id);
//assign user to "pending basic"
await assignUserToStatus(app.member_id, 1);
await pool.query('CALL sp_accept_new_recruit(?, ?, ?, ?)', [Number(process.env.CONFIG_ID), app.member_id, approved_by, approved_by])
// let nextRank = await getRankByName('Recruit')
// await insertMemberRank(app.member_id, nextRank.id);
// //assign user to "pending basic"
// await assignUserToStatus(app.member_id, 1);
res.sendStatus(200);
} catch (err) {
console.error('Approve failed:', err);

View File

@@ -89,7 +89,7 @@ export async function getMyApplication(id: number): Promise<ApplicationFull> {
}
export async function approveApplication(id: Number) {
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST' })
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST', credentials: 'include' })
if (!res.ok) {
console.error("Something went wrong approving the application")
@@ -97,7 +97,7 @@ export async function approveApplication(id: Number) {
}
export async function denyApplication(id: Number) {
const res = await fetch(`${addr}/application/deny/${id}`, { method: 'POST' })
const res = await fetch(`${addr}/application/deny/${id}`, { method: 'POST', credentials: 'include' })
if (!res.ok) {
console.error("Something went wrong denying the application")