-
Notifications
You must be signed in to change notification settings - Fork 1
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
학생회 활동보고 crud #335
base: develop
Are you sure you want to change the base?
학생회 활동보고 crud #335
Conversation
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.
자세히는 내일봄 (문제는 없는거 같긴 하지만)
|
||
@Service | ||
@Transactional |
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에 붙이는 걸로 변경하면 더 좋을 듯!
(어차피 readonly 따로 명시하고 있어서 class에 붙이는 이점도 적은 듯 해서)
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.
readonly만 붙이는게 덜 번거롭지 않나?.?
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.
번거로운 것도 있는데 transaction과 연관 없는 method까지 proxy 타는게 싫어서 그러긴 했는데
큰 상관은 없어서 이대로 가도 괜찮긴 할듯!
src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/wafflestudio/csereal/core/council/dto/ReportDto.kt
Outdated
Show resolved
Hide resolved
id는 혹시나 마이그레이션이나 db 수정 있을 때 꼬일수도 있을거 같아서 조금 걱정되기는 하고, |
그냥 type 추가했습니다 |
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.
리뷰 남기긴 했는데 옵셔널이긴 하고 flyway script만 적용하면 될듯!
|
||
@Service | ||
@Transactional |
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.
번거로운 것도 있는데 transaction과 연관 없는 method까지 proxy 타는게 싫어서 그러긴 했는데
큰 상관은 없어서 이대로 가도 괜찮긴 할듯!
@Query( | ||
""" | ||
SELECT c | ||
FROM council c | ||
WHERE c.createdAt < :timestamp | ||
AND c.type = 'REPORT' | ||
ORDER BY c.createdAt DESC | ||
""" | ||
) | ||
fun findPreviousReport(@Param("timestamp") timestamp: LocalDateTime): CouncilEntity? | ||
|
||
@Query( | ||
""" | ||
SELECT c | ||
FROM council c | ||
WHERE c.createdAt > :timestamp | ||
AND c.type = 'REPORT' | ||
ORDER BY c.createdAt ASC | ||
""" | ||
) | ||
fun findNextReport(@Param("timestamp") timestamp: LocalDateTime): CouncilEntity? |
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.
findNextByType
이런식으로 type 관계없이 동작하도록 하면 좀 더 좋을듯!
fun of(entity: CouncilEntity, prev: CouncilEntity?, next: CouncilEntity?): ReportDto = ReportDto( | ||
id = entity.id, | ||
title = entity.title, | ||
description = entity.description, | ||
author = entity.author.name, | ||
createdAt = entity.createdAt!!, | ||
prevId = prev?.id, | ||
prevTitle = prev?.title, | ||
nextId = next?.id, | ||
nextTitle = next?.title | ||
) |
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.
CouncilEntity type이 REPORT 아닐 시 IllegalArgumentException
을 던진다던지 하는 식으로 무언가의 검사는 있으면 좋을듯?
report crud api
한줄 요약
CouncilEntity가 intro, report 까지 커버
소개 페이지 하나 때문에 type을 만드는게 좀 불필요하다고 생각해서 repository를 보면 title이 intro 인걸 제외하도록 되어있는데 id가 바뀔일이 없을거라 db 레코드 만든 후에 id 제외하도록 하는게 나을 것 같기도 한데 의견 부탁드립니다.