Skip to content

Commit

Permalink
Handle when query param exists in my lectures latest api for ev servi…
Browse files Browse the repository at this point in the history
…ce (#233)

* handle when query param exists in my lectures latest api for ev service

* fix uri -> path
  • Loading branch information
davin111 authored Oct 29, 2022
1 parent 20da646 commit 29ff93e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/api/routes/EvaluationRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ restGet(router, '/v1/users/me/lectures/latest')(async function (context, req) {
const evaluationServerHeader = {
'Snutt-User-Id': user._id
}
let snuttLectureInfo: string = JSON.stringify(await TimetableService.getLecturesTakenByUserInLastSemesters(user._id))
const snuttLectureInfo: string = JSON.stringify(await TimetableService.getLecturesTakenByUserInLastSemesters(user._id))

req.query.snutt_lecture_info = encodeURI(snuttLectureInfo)
let requestUri = snuttevDefaultRoutingUrl + req.path
requestUri += '?' + Object.keys(req.query).map(key => key + '=' + req.query[key]).join('&')

return request({
method: req.method,
uri: `${snuttevDefaultRoutingUrl}${req.path}?snutt_lecture_info=${encodeURI(snuttLectureInfo)}`,
uri: requestUri,
headers: evaluationServerHeader,
body: req.body,
json: true
Expand Down

0 comments on commit 29ff93e

Please sign in to comment.