diff --git a/api/src/main/resources/application.yml b/api/src/main/resources/application.yml index 6f41228..f43b1df 100644 --- a/api/src/main/resources/application.yml +++ b/api/src/main/resources/application.yml @@ -18,6 +18,7 @@ server: buffered: false suffix: file-date-format: + max-http-request-header-size: 100KB --- diff --git a/batch/src/main/kotlin/com/wafflestudio/snuttev/sync/SnuttLectureSyncJobConfig.kt b/batch/src/main/kotlin/com/wafflestudio/snuttev/sync/SnuttLectureSyncJobConfig.kt index ca31f6c..a79b6b3 100644 --- a/batch/src/main/kotlin/com/wafflestudio/snuttev/sync/SnuttLectureSyncJobConfig.kt +++ b/batch/src/main/kotlin/com/wafflestudio/snuttev/sync/SnuttLectureSyncJobConfig.kt @@ -23,6 +23,7 @@ import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Profile import org.springframework.data.domain.Sort import org.springframework.data.mongodb.core.MongoTemplate +import org.springframework.data.mongodb.core.findOne import org.springframework.data.mongodb.core.query.Criteria import org.springframework.data.mongodb.core.query.Query import org.springframework.data.mongodb.core.query.isEqualTo @@ -50,20 +51,16 @@ class SnuttLectureSyncJobConfig( @Bean fun syncJobNextSemester(jobRepository: JobRepository): Job { - val (currentYear, currentSemester) = semesterUtils.getCurrentYearAndSemester() - val (yearOfNextSemester, nextSemester) = semesterUtils.getYearAndSemesterOfNextSemester() - val (targetYear, targetSemester) = when ( - snuttSemesterLectureRepository.existsByYearAndSemester( - yearOfNextSemester, - nextSemester.value, - ) - ) { - true -> yearOfNextSemester to nextSemester - false -> currentYear to currentSemester + val coursebook = mongoTemplate.findOne>( + Query().with(Sort.by(Sort.Direction.DESC, "year").and(Sort.by(Sort.Direction.DESC, "semester"))), + "coursebooks", + ) + val (targetYear, targetSemester) = coursebook!!.let { + it["year"]!!.toInt() to it["semester"]!!.toInt() } lecturesMap = lectureRepository.findAll().associateBy { "${it.courseNumber},${it.instructor}" }.toMutableMap() semesterLecturesMap = - semesterLectureRepository.findAllByYearAndSemesterWithLecture(targetYear, targetSemester.value) + semesterLectureRepository.findAllByYearAndSemesterWithLecture(targetYear, targetSemester) .associateBy { "${it.lecture.courseNumber},${it.lecture.instructor},${it.year},${it.semester}" } .toMutableMap() @@ -74,7 +71,7 @@ class SnuttLectureSyncJobConfig( Query.query( Criteria .where("year").isEqualTo(targetYear) - .and("semester").isEqualTo(targetSemester.value), + .and("semester").isEqualTo(targetSemester), ), ), ) diff --git a/build.gradle.kts b/build.gradle.kts index 2a60147..bc038a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,9 +4,9 @@ import org.springframework.boot.gradle.tasks.bundling.BootJar import java.io.ByteArrayOutputStream plugins { - id("org.springframework.boot") version "3.0.6" - id("io.spring.dependency-management") version "1.1.0" - kotlin("jvm") version "1.8.21" + id("org.springframework.boot") version "3.1.4" apply false + id("io.spring.dependency-management") version "1.1.3" + kotlin("jvm") version "1.9.10" kotlin("plugin.spring") version "1.8.21" kotlin("plugin.allopen") version "1.8.21" kotlin("plugin.noarg") version "1.8.21" @@ -75,15 +75,15 @@ subprojects { } project(":api") { - tasks.bootJar { - archiveFileName.set("snuttev-api.jar") - } + val bootJar: BootJar by tasks + + bootJar.archiveFileName.set("snuttev-api.jar") } project(":batch") { - tasks.bootJar { - archiveFileName.set("snuttev-batch.jar") - } + val bootJar: BootJar by tasks + + bootJar.archiveFileName.set("snuttev-batch.jar") } project(":core") { @@ -94,12 +94,6 @@ project(":core") { bootJar.enabled = false } -val jar: Jar by tasks -val bootJar: BootJar by tasks - -jar.enabled = true -bootJar.enabled = false - fun RepositoryHandler.mavenCodeArtifact() { maven { val authToken = properties["codeArtifactAuthToken"] as String? ?: ByteArrayOutputStream().use {