Training-Report #27
@@ -51,7 +51,7 @@ export async function getCourseEventAttendees(id: number): Promise<CourseAttende
|
||||
}
|
||||
|
||||
export async function getCourseEventDetails(id: number): Promise<CourseEventDetails> {
|
||||
const sql = `SELECT * FROM course_events WHERE id = ?;`;
|
||||
const sql = `SELECT E.*, C.name AS course_name FROM course_events AS E LEFT JOIN courses AS C ON E.course_id = C.id WHERE E.id = ?;`;
|
||||
let rows: CourseEventDetails[] = await pool.query(sql, [id]);
|
||||
let event = rows[0];
|
||||
event.attendees = await getCourseEventAttendees(id);
|
||||
@@ -74,7 +74,6 @@ export async function insertCourseEvent(event: CourseEventDetails): Promise<numb
|
||||
remarks
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?);`, [attendee.attendee_id, eventID, attendee.attendee_role_id, attendee.passed, attendee.remarks]);
|
||||
|
||||
}
|
||||
await con.commit();
|
||||
} catch (error) {
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface CourseEventDetails {
|
||||
attendees: CourseAttendee[] | null;
|
||||
|
||||
created_by: number | null;
|
||||
course_name: string | null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user