minor changes
This commit is contained in:
parent
909b29dfb5
commit
af2e220116
30 changed files with 598 additions and 350 deletions
|
|
@ -117,6 +117,7 @@ intructorRouter.get("/details/:id", async (req, res) => {
|
|||
);
|
||||
|
||||
console.log("Response from DB_ASSIGNMENT_SERVICE_URL:", response.data);
|
||||
console.log("Response status:", response.status);
|
||||
res.status(response.status).json(response.data);
|
||||
} catch (error) {
|
||||
console.error("Error fetching assignment details:", error.message);
|
||||
|
|
@ -129,16 +130,20 @@ intructorRouter.get(
|
|||
"/list/:id",
|
||||
// passport.authenticate("jwt", { session: false }),
|
||||
async (req, res) => {
|
||||
console.log("/list/:id endpoint hit");
|
||||
// if (req.isAuthenticated()) {
|
||||
try {
|
||||
const instructorId = req.params.id;
|
||||
// console.log("Fetching assignments for instructorId:", instructorId);
|
||||
console.log("Fetching assignments for instructorId:", instructorId);
|
||||
const response = await axios.get(
|
||||
`${DB_ASSIGNMENT_SERVICE_URL}/assignments/instructor/${instructorId}`
|
||||
);
|
||||
// console.log("Response from DB_ASSIGNMENT_SERVICE_URL:", response.data);
|
||||
console.log("Response from DB_ASSIGNMENT_SERVICE_URL:", response.data);
|
||||
console.log("Response status:", response.status);
|
||||
res.status(response.status).json(response.data);
|
||||
} catch (error) {
|
||||
console.log("Error fetching assignments:", error.response);
|
||||
console.error("Error fetching assignments:", error.message);
|
||||
res.status(error.response?.status || 500).json({ error: error.message });
|
||||
}
|
||||
// } else {
|
||||
|
|
@ -191,10 +196,10 @@ intructorRouter.delete(
|
|||
|
||||
if (!assignmentData) {
|
||||
return res.status(404).json({ error: "Assignment not found" });
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the Battlesnake API
|
||||
if(assignmentData.appname){
|
||||
if (assignmentData.appname) {
|
||||
console.log(`Deleting Battlesnake API: ${assignmentData.appname}`);
|
||||
const deployResponse = await axios.post(`${DEPLOY_API_URL}/${assignmentData.appname}/delete`, {
|
||||
"appName": assignmentData.appname
|
||||
|
|
@ -206,7 +211,7 @@ intructorRouter.delete(
|
|||
}
|
||||
console.log('Response from DEPLOY_API_URL:', deployResponse.data);
|
||||
}
|
||||
|
||||
|
||||
console.log("Deleting assignment from database:", assignmentId);
|
||||
const response = await axios.delete(
|
||||
`${DB_ASSIGNMENT_SERVICE_URL}/assignments/${assignmentId}`
|
||||
|
|
@ -231,7 +236,7 @@ intructorRouter.get(
|
|||
`${DB_ASSIGNMENT_SERVICE_URL}/assignments/appname/${appName}`
|
||||
);
|
||||
console.log("Response data:", response.data);
|
||||
res.status(response.status).json({"exists": (response.data !== null && response.data !== undefined)});
|
||||
res.status(response.status).json({ "exists": (response.data !== null && response.data !== undefined) });
|
||||
} catch (error) {
|
||||
console.error("Error fetching assignment by app name:", error.message);
|
||||
res.status(error.response?.status || 500).json({ error: error.message });
|
||||
|
|
@ -251,7 +256,7 @@ intructorRouter.get(
|
|||
`${DB_ASSIGNMENT_SERVICE_URL}/assignments/${qrcode}`
|
||||
);
|
||||
console.log("Response data:", response.data);
|
||||
res.status(response.status).json({"exists": (response.data !== null && response.data !== undefined)});
|
||||
res.status(response.status).json({ "exists": (response.data !== null && response.data !== undefined) });
|
||||
} catch (error) {
|
||||
console.error("Error fetching assignment by QR code:", error.message);
|
||||
res.status(error.response?.status || 500).json({ error: error.message });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue