-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCourseTimeExtractController.kt
More file actions
32 lines (30 loc) · 1.25 KB
/
CourseTimeExtractController.kt
File metadata and controls
32 lines (30 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.wafflestudio.spring2025.course.extract.controller
import com.wafflestudio.spring2025.course.extract.dto.CourseTimeExtractDto
import com.wafflestudio.spring2025.course.extract.service.CourseTimeExtractService
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RequestPart
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.multipart.MultipartFile
@RestController
@RequestMapping("/course/extract")
class CourseTimeExtractController(
private val courseTimeExtractService: CourseTimeExtractService,
) {
@PostMapping("/times")
fun putXlsTimeInDB(
@RequestParam year: Int,
@RequestParam semester: String,
@RequestPart file: MultipartFile,
): ResponseEntity<CourseTimeExtractDto> {
val inserted =
courseTimeExtractService.importTimesFromXls(
year = year,
semester = semester,
inputStream = file.inputStream,
)
return ResponseEntity.ok(CourseTimeExtractDto(inserted))
}
}