Skip to content

Commit

Permalink
Fix client and add log to 'EmployeeServiceImpl.getWorkingDays'
Browse files Browse the repository at this point in the history
  • Loading branch information
aryabokon committed Feb 1, 2024
1 parent 0bbf0dc commit 7fe2cf8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface EmployeeServiceClient {
@RequestLine("GET customers")
fun getCustomers(): Set<CustomerDTO>

@RequestLine("GET employees/working-days&fromDate={fromDate}&toDate={toDate}")
@RequestLine("GET employees/working-days?fromDate={fromDate}&toDate={toDate}")
fun getWorkingDays(
@Param("fromDate", expander = LocalDateExpander::class) fromDate: LocalDate,
@Param("toDate", expander = LocalDateExpander::class) toDate: LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.octopusden.employee.controller

import org.octopusden.employee.client.common.dto.Employee
import org.octopusden.employee.client.common.dto.WorkingDaysDTO
import org.octopusden.employee.service.EmployeeService
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -17,8 +18,9 @@ class EmployeesController(private val employeeService: EmployeeService) {
fun getEmployeeAvailableEarlier(@RequestParam employees: Set<String>): Employee = employeeService.getEmployeeAvailableEarlier(employees)

@GetMapping("working-days")
fun getWorkingDaysCount(
@PreAuthorize("@employeeServicePermissionEvaluator.hasPermission('ACCESS_EMPLOYEE')")
fun getWorkingDays(
@RequestParam("fromDate", required = true) fromDate: LocalDate,
@RequestParam("toDate", required = true) toDate: LocalDate
) = employeeService.getWorkingDays(fromDate, toDate)
): WorkingDaysDTO = employeeService.getWorkingDays(fromDate, toDate)
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class EmployeeServiceImpl(

override fun getWorkingDays(fromDate: LocalDate, toDate: LocalDate): WorkingDaysDTO {
return oneCService.getWorkingDays(fromDate, toDate)
.also { workingDaysDTO -> log.debug("getWorkingDays($fromDate,$toDate)=$workingDaysDTO") }
}

data class UserAbsence(val employee: JiraUser, val start: LocalDate, val end: LocalDate)
Expand Down

0 comments on commit 7fe2cf8

Please sign in to comment.