Skip to content

Conversation

@wjdtkdgns
Copy link
Member

No description provided.

Copy link
Member

@DongGeon0908 DongGeon0908 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bulk update의 경우에는 log를 남겨주는 것도 좋을 것 같아요.

testImplementation("io.kotest:kotest-runner-junit5:5.7.2")
testImplementation("io.kotest:kotest-assertions-core:5.7.2")
testImplementation("io.kotest.extensions:kotest-extensions-spring:1.1.2")
testImplementation("io.mockk:mockk:1.13.8")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOD!!!

package yapp.study.todolist.common.const

object TodoConst {
const val BULK_SIZE = 1000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bulk size가 1000인 이유가 궁금해요


object TodoConst {
const val BULK_SIZE = 1000
const val RESOURCES_PATH = "src/main/resources"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와우!

val status: Int,
val data: Any?
class SuccessResponse <T> (
val data: T?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null인 경우는 어떤 상황일까요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

데이터가 반환될 필요가 없는 api 일 때 null 반환하도록 했어요

else -> 200
}
if (method == "POST") return 201
return if (method == "DELETE") 204 else 200
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

만약 method가 delete인데, 반환값이 있는 경우에는 어떻게 할까요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status code 수정할 수 있도록 변경해볼게요

fun toDto(todo: Todo, comments: List<CommentDto>): TodoCommentDto {
return TodoCommentDto(
id = todo.id,
id = todo.id!!,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!는 지양하는게 좋긴 해요.

Comment on lines +55 to +56
fun getCategoriesWithTodo(pageable: Pageable): PageResponse<CategoryWithTodosDto> {
val categorys = categoryRepository.findAll(pageable)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카테고리를 페이징 처리하는게 뭔가,, 어색하게 느껴져요.

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "comment_id")
val id: Long? = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val id: Long? = null,
val id: Long = -1,

val commentRepository: CommentRepository,
val jdbcTemplate: JdbcTemplate
) {
fun bulkInsert() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 중도에 실패하는 경우, 기존에 insert처리된 로직은 어떻게 되는걸까요?
  2. 실패하는 경우, retry는 진행하지 않는 걸까요?
  3. 트랜잭션으로 묶이지 않은 이유가 궁금합니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

트랜잭션 어노테이션을 빼먹었네요..

Comment on lines +85 to +92
try {
val fileReader = FileReader(File(path))
val bufferReader = BufferedReader(fileReader)
return bufferReader.useLines { it.toList() }
} catch (e: IOException) {
println(e)
throw InternalServerException("i/o error")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기서 IO 부하를 줄이기 위해, 어떤 방식을 이용하면 좋을지 고민해 볼 필요가 있을 것 같아요.

Comment on lines +31 to +32
println("bulk insert start")
println("category insert")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log를 사용하는게 어떨까요?
현재는 console println이라서요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants