-
Notifications
You must be signed in to change notification settings - Fork 6
Week 2/wjdtkdgns #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: week-2/wjdtkdgns
Are you sure you want to change the base?
Week 2/wjdtkdgns #6
Conversation
DongGeon0908
left a comment
There was a problem hiding this 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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null인 경우는 어떤 상황일까요??
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
만약 method가 delete인데, 반환값이 있는 경우에는 어떻게 할까요??
There was a problem hiding this comment.
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!!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!는 지양하는게 좋긴 해요.
| fun getCategoriesWithTodo(pageable: Pageable): PageResponse<CategoryWithTodosDto> { | ||
| val categorys = categoryRepository.findAll(pageable) |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| val id: Long? = null, | |
| val id: Long = -1, |
| val commentRepository: CommentRepository, | ||
| val jdbcTemplate: JdbcTemplate | ||
| ) { | ||
| fun bulkInsert() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 중도에 실패하는 경우, 기존에 insert처리된 로직은 어떻게 되는걸까요?
- 실패하는 경우, retry는 진행하지 않는 걸까요?
- 트랜잭션으로 묶이지 않은 이유가 궁금합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
트랜잭션 어노테이션을 빼먹었네요..
| 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") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기서 IO 부하를 줄이기 위해, 어떤 방식을 이용하면 좋을지 고민해 볼 필요가 있을 것 같아요.
| println("bulk insert start") | ||
| println("category insert") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log를 사용하는게 어떨까요?
현재는 console println이라서요.
No description provided.