-
Notifications
You must be signed in to change notification settings - Fork 0
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
#74 - 탈퇴 및 이용제한을 당한 유저를 필터링한다. #111
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.
고생하셨습니다!👍👍 커맨트 남겼으니 확인해주세요!
@@ -15,7 +18,7 @@ data class Vote( | |||
val voteNumber: Int, | |||
val voteOptionsByVoteDate: VoteOptionsByVoteDate, | |||
val ballots: Ballots, | |||
) { | |||
) : AbstractAggregateRoot<Vote>() { |
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.
오호 AbstractAggregateRoot 이것도 스프링에서 제공하는군요!
이거 사용하는거랑 사용안하는거랑 차이가 어떻게 될까요?!🤔
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.
헉 자기야..
이거 안지웠어요 나이스
원래 이거쓰면 domain 내부에서 registerEvent()로 event 발행 가능한데, 발동조건이 조금 까다로워서 EventUtils 로 바꿨어요.
@Component | ||
class EventUtils private constructor(applicationEventPublisher: ApplicationEventPublisher) { | ||
|
||
init { | ||
Companion.applicationEventPublisher = applicationEventPublisher | ||
} | ||
|
||
companion object { | ||
|
||
private var applicationEventPublisher: ApplicationEventPublisher? = null | ||
|
||
fun publish(event: Any) { | ||
if (applicationEventPublisher == null) { | ||
return | ||
} | ||
applicationEventPublisher!!.publishEvent(event) | ||
} | ||
|
||
} | ||
|
||
} |
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.
이렇게 Util로 빼는거 좋은 것 같아요! 그런데, 이미 싱글톤으로 되어있는데 따로 init 이나 null 체크 안해도 되지 않을까요?!?
만약에 null 이면,,, 빌드할떄(Bean 주입) 터질 것 같아요👀
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 이 들어올일은 없어요.. 다만 조금 안티패턴이긴한데 도메인 테스트 할 때, bean이 뜨지 않아서 eventPublisher가 주입되지 않아 도메인 테스트가 어려워져서 이렇게 진행했어요 ㅠㅠ 미안해요
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.
아 그리고, init 이야기를 안했네요.
현재 applicationEventPublisher가 static 형식으로 선언되어 있어서 init으로 따로 주입해준거랍니다 하하
@Query( | ||
""" | ||
SELECT u | ||
FROM UserJpaEntity u | ||
WHERE u.schoolId = :schoolId | ||
AND u.grade = :grade | ||
AND u.classNumber = :classNumber | ||
AND u.withdrawalStatus != 'WITHDRAWN' | ||
AND u.restriction.messageRestrictionType = 'NONE' | ||
AND u.restriction.voteRestrictionType = 'NONE' | ||
""" | ||
) | ||
fun findAllBySchoolIdAndGradeAndClassNumber( | ||
schoolId: Long, | ||
grade: Int, | ||
classNumber: Int | ||
): List<UserJpaEntity> |
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.
여기는 본인이 조회되도 괜찮은건가요?!
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.
네네! 조회되도 괜찮아용 로직으로 애초에 처리하고 있는 상태에서 최적화 개념으로 도입한거라서, 문제는 없더영
1. 🔗 관련 이슈
2. 📄 구현한 내용 또는 수정한 내용
이걸 이제야하네요..
이제 flyway랑 쿼리최적화 리얼로다가 들어가야겠습니다.
3. 🙌 추가적으로 알리고 싶은 내용
4. 🙄 TODO / 고민하고 있는 것들
5. ✅ 배포 Checklist