Remove scheduler, add hwt sergeant :)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.dowstats.controllers.instruments
|
||||
|
||||
import com.dowstats.data.dto.controllers.instruments.RgdNodeDto
|
||||
import com.dowstats.data.dto.controllers.instruments.toRgdNodeDto
|
||||
import com.dowstats.service.w40k.RgdParserService
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.http.MediaType
|
||||
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.RestController
|
||||
import org.springframework.web.multipart.MultipartFile
|
||||
import java.io.DataInputStream
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/v1/instruments/rgd")
|
||||
class RgdTreeController @Autowired constructor(
|
||||
val rgdParserService: RgdParserService,
|
||||
) {
|
||||
|
||||
@PostMapping(
|
||||
value = ["/tree"],
|
||||
consumes = [MediaType.MULTIPART_FORM_DATA_VALUE],
|
||||
produces = [MediaType.APPLICATION_JSON_VALUE],
|
||||
)
|
||||
fun parseRgdToTree(@RequestParam("file") file: MultipartFile): List<RgdNodeDto> {
|
||||
return file.inputStream.use { input ->
|
||||
rgdParserService.parseRgdFileStream(DataInputStream(input))
|
||||
}.map { it.toRgdNodeDto() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user