TIL ~ 24.04.05

20240104 TIL

wlsds00_ 2024. 1. 4. 21:02

1. 코드카타

 

직사각형 별찍기 / 최대공약수와 최소공배수 / 3진법 뒤집기

38. 직사각형 별찍기 fun main(args: Array) { val (a, b) = readLine()!!.split(' ').map(String::toInt) print(("*".repeat(a) + "\n" ).repeat(b)) } readLine으로 입력받은 a 와 b 의 값을 split(' ') 에서 공백을 기준으로 나눠 문자열

ds-36500.tistory.com

 

2. 주특기 숙련 개인과제

TodoController

    // 할일 완료처리 여부
    @PatchMapping("/{todoId}")
    fun updateStatus(@PathVariable todoId: Long,
                     @RequestBody status: TodoStatus): ResponseEntity<Boolean> {
        return ResponseEntity
            .status(HttpStatus.OK)
            .body(todoService.updateStatus(todoId, UpdateStatus(true)))
    }
}

 

TodoServiceImpl

    // 할일 완료처리 여부
    @Transactional
     override fun updateStatus(todoId: Long, request: UpdateStatus): Boolean {
        val todo = todoRepository.findByIdOrNull(todoId) 
        	?: throw ModelNotFoundException(todoId)
         val (status) = request

        todo.status = status
        return if (!status) true else false
    }
}

 

댓글 완료기능이 작동은 하는것 같은데 의도대로 표시되지가 않는다.

 

댓글을 투두리스트와 함께 출력시키는 부분을 작업중이다.