Training-Report #27

Merged
Ajdj100 merged 47 commits from Training-Report into main 2025-11-22 14:20:51 -06:00
3 changed files with 16 additions and 2 deletions
Showing only changes of commit 105b28d9a4 - Show all commits

View File

@@ -56,9 +56,11 @@ eventRouter.get('/attendees/:id', async (req: Request, res: Response) => {
})
eventRouter.post('/', async (req: Request, res: Response) => {
const posterID: number = req.user.id;
try {
console.log();
const data: CourseEventDetails = req.body;
let data: CourseEventDetails = req.body;
data.created_by = posterID;
const id = await insertCourseEvent(data);
res.status(201).json(id);
} catch (error) {

View File

@@ -21,3 +21,14 @@ export async function setUserState(userID: number, state: MemberState) {
WHERE id = ?;`;
return await pool.query(sql, [state, userID]);
}
declare global {
namespace Express {
interface Request {
user: {
id: number;
name: string;
};
}
}
}

View File

@@ -54,6 +54,7 @@ export async function postTrainingReport(report: CourseEventDetails) {
"Content-Type": "application/json",
},
body: JSON.stringify(report),
credentials: 'include',
});
if (!res.ok) {