Skip to content

Commit

Permalink
Chore/uni 271 sitemap xml (#293)
Browse files Browse the repository at this point in the history
* finished code to generate the sitemap (using temp data currently)

* fixed branch name

* added api to get a list of all courses and updated swagger.json to include this route

* changed name of all courses api

* fixed the inconsistent names when logging info on /courses/all

* generated sitemap in both root and frontend folder

* removed sitemap.ts from root (was moved to frontend so we could generate the xml)

* moved sitemap to public folder

---------

Co-authored-by: lightAndTangy <[email protected]>
  • Loading branch information
eaglethrost and lightAndTangy authored May 17, 2024
1 parent 4f9eaa2 commit ead0099
Show file tree
Hide file tree
Showing 4 changed files with 11,795 additions and 1 deletion.
26 changes: 25 additions & 1 deletion backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
}
}
},
"/courses": {
"/courses/all": {
"get": {
"tags": ["Courses"],
"summary": "Gets a list of all course objects",
Expand All @@ -156,6 +156,30 @@
}
}
},
"/courses": {
"get": {
"tags": ["Courses"],
"summary": "Gets a list of all course objects per 25 offset",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Course"
}
}
}
}
},
"500": {
"description": "An internal server error occurred"
}
}
}
},
"/courses/${courseCode}": {
"put": {
"tags": ["Courses"],
Expand Down
18 changes: 18 additions & 0 deletions backend/src/controllers/course.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ export class CourseController implements IController {

setupRoutes(): Router {
return Router()
.get(
"/courses/all",
async (req: Request, res: Response, next: NextFunction) => {
this.logger.debug(`Received request in GET /courses/all`);
try {
const allCourses = await this.courseService.getCourses();
this.logger.info(`Responding to client in GET /courses/all`);
return res.status(200).json(allCourses);
} catch (err: any) {
this.logger.warn(
`An error occurred when trying to GET /courses/all ${formatError(
err,
)}`,
);
return next(err);
}
},
)
.get(
"/courses",
async (req: Request, res: Response, next: NextFunction) => {
Expand Down
Loading

0 comments on commit ead0099

Please sign in to comment.