Skip to content

Commit

Permalink
Fix the timeZone param parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaskovdev committed Aug 25, 2024
1 parent ab3db50 commit ea2b346
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/org/motivepick/web/ScheduleController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import org.motivepick.service.TaskService
import org.springframework.http.ResponseEntity
import org.springframework.http.ResponseEntity.ok
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.ZoneId

@RestController
internal class ScheduleController(private val taskService: TaskService) {

@GetMapping("/schedule")
fun schedule(timeZone: ZoneId?): ResponseEntity<ScheduleView> = ok(taskService.findScheduleForCurrentUser(timeZone ?: ZoneId.of("UTC")))
fun schedule(@RequestParam(name = "timeZone", defaultValue = "UTC") timeZone: String): ResponseEntity<ScheduleView> =
ok(taskService.findScheduleForCurrentUser(ZoneId.of(timeZone)))
}

0 comments on commit ea2b346

Please sign in to comment.