Skip to content

Commit

Permalink
Revert "curre-chat-api: Remove course type filtering from /courses"
Browse files Browse the repository at this point in the history
This reverts commit 56fbd45.
  • Loading branch information
AleksTeresh committed Sep 5, 2024
1 parent 56fbd45 commit e95ee24
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 15 additions & 0 deletions importer-db-api/src/routes/curre/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
const validRealisationTypes = [
'urn:code:course-unit-realisation-type:teaching-participation-lab',
'urn:code:course-unit-realisation-type:teaching-participation-online',
'urn:code:course-unit-realisation-type:teaching-participation-field-course',
'urn:code:course-unit-realisation-type:teaching-participation-project',
'urn:code:course-unit-realisation-type:teaching-participation-lectures',
'urn:code:course-unit-realisation-type:teaching-participation-small-group',
'urn:code:course-unit-realisation-type:teaching-participation-seminar',
'urn:code:course-unit-realisation-type:independent-work-project',
'urn:code:course-unit-realisation-type:teaching-participation-blended',
'urn:code:course-unit-realisation-type:teaching-participation-contact',
'urn:code:course-unit-realisation-type:teaching-participation-distance'
]

const relevantAttributes = {
courseUnit: ['id', 'code', 'responsibilityInfos', 'completionMethods', 'name', 'validityPeriod'],
courseUnitRealisation: [
Expand Down Expand Up @@ -33,6 +47,7 @@ const teacherUrns = [
const timeTillCourseStart = 6

module.exports = {
validRealisationTypes,
relevantAttributes,
teacherUrns,
timeTillCourseStart
Expand Down
7 changes: 5 additions & 2 deletions importer-db-api/src/routes/curre/curre.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const express = require('express')
const models = require('../../models')

const { addMonths } = require('date-fns')
const { timeTillCourseStart, relevantAttributes } = require('./config')
const { timeTillCourseStart, relevantAttributes, validRealisationTypes } = require('./config')

const router = express.Router()

Expand Down Expand Up @@ -92,7 +92,10 @@ router.get('/courses', async (req, res) => {
[Op.lte]: courseStartTreshold
}
}
]
],
courseUnitRealisationTypeUrn: {
[Op.in]: validRealisationTypes
}
}
})

Expand Down

0 comments on commit e95ee24

Please sign in to comment.