Browse Source

fix courseList

pull/18/head
Jannik 2 years ago
parent
commit
c30306c163
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 2
      build.gradle
  2. 10
      src/main/kotlin/org/mosad/thecitadelofricks/APIController.kt
  3. 1
      src/main/kotlin/org/mosad/thecitadelofricks/DataTypes.kt

2
build.gradle

@ -6,7 +6,7 @@ plugins {
}
group 'org.mosad'
version '1.2.4'
version '1.2.5'
repositories {
jcenter()

10
src/main/kotlin/org/mosad/thecitadelofricks/APIController.kt

@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime
import java.util.*
import kotlin.collections.ArrayList
@RestController
class APIController {
@ -48,7 +49,7 @@ class APIController {
companion object {
const val apiVersion = "1.2.0"
const val softwareVersion = "1.2.4"
const val softwareVersion = "1.2.5"
val startTime = System.currentTimeMillis() / 1000
}
@ -58,10 +59,11 @@ class APIController {
}
@RequestMapping("/courseList")
fun courseList(): CoursesList {
fun courseList(): CoursesListRet {
logger.info("courseList request at ${LocalDateTime.now()}!")
updateCourseListRequests()
return courseList
return CoursesListRet(courseList.meta, ArrayList(courseList.courses.values))
}
@RequestMapping("/mensamenu")
@ -121,7 +123,7 @@ class APIController {
// TODO remove this with API version 2.0.0
@Deprecated("courses is replaced by courseList", replaceWith = ReplaceWith("courseList()"))
@RequestMapping("/courses")
fun courses(): CoursesList {
fun courses(): CoursesListRet {
return courseList()
}

1
src/main/kotlin/org/mosad/thecitadelofricks/DataTypes.kt

@ -32,6 +32,7 @@ data class Course(val courseName: String, val courseLink: String)
data class CoursesMeta(val updateTime: Long = 0, val totalCourses: Int = 0)
data class CoursesList(val meta: CoursesMeta = CoursesMeta(), val courses: HashMap<String, Course> = HashMap())
data class CoursesListRet(val meta: CoursesMeta = CoursesMeta(), val courses: ArrayList<Course> = ArrayList())
// data classes for the Mensa part
data class Meal(val day: String, val heading: String, val parts: ArrayList<String>, val additives: String)

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close