Skip to content

Commit 35a70df

Browse files
authored
Merge pull request #235 from prgrms-web-devcourse-final-project/cdj/schedule/hotfix
🐛 fix: ScheduleQueryService 메서드에 Transectional Read Only 적용
2 parents 1049e21 + 865818f commit 35a70df

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/java/com/grepp/spring/app/model/event/entity/Event.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ private static void validateTitle(String title) {
8282
if (title == null || title.trim().isEmpty()) {
8383
throw new IllegalArgumentException("이벤트 제목은 필수입니다.");
8484
}
85-
if (title.length() > 10) {
86-
throw new IllegalArgumentException("이벤트 제목은 10자를 초과할 수 없습니다.");
85+
if (title.length() > 20) {
86+
throw new IllegalArgumentException("이벤트 제목은 20자를 초과할 수 없습니다.");
8787
}
8888
}
8989

src/main/java/com/grepp/spring/app/model/schedule/service/ScheduleQueryService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public ShowScheduleResponse showSchedule(Schedule schedule, String userId) {
8080
throw new NotScheduleMemberException(ScheduleErrorCode.NOT_SCHEDULE_MEMBER);
8181
}
8282

83+
@Transactional(readOnly = true)
8384
public ShowSuggestedLocationsResponse showSuggestedLocation(Long scheduleId) {
8485
List<MetroInfoDto> infoDto = getMetroInfoDtos(scheduleId);
8586
int scheduleMemberNumber = scheduleMemberQueryRepository.findByScheduleId(scheduleId).size();
@@ -114,6 +115,7 @@ private int getDepartLocationCount(Long scheduleId) {
114115
return departLocationCount;
115116
}
116117

118+
@Transactional(readOnly = true)
117119
public ShowVoteMembersResponse findVoteMembers(Long scheduleId) {
118120

119121
List<VoteMemberDto> voteMemberList = getVoteMemberDtos(scheduleId);
@@ -138,29 +140,34 @@ private List<VoteMemberDto> getVoteMemberDtos(Long scheduleId) {
138140
return voteMemberList;
139141
}
140142

143+
@Transactional(readOnly = true)
141144
public Schedule findScheduleById(Long scheduleId) {
142145
return scheduleQueryRepository.findById(scheduleId)
143146
.orElseThrow(() -> new ScheduleNotFoundException(
144147
GroupErrorCode.SCHEDULE_NOT_FOUND));
145148
}
146149

150+
@Transactional(readOnly = true)
147151
public Event findEventById(Long eventId) {
148152
return eventRepository.findById(eventId).orElseThrow(() -> new EventNotFoundException(
149153
EventErrorCode.EVENT_NOT_FOUND));
150154
}
151155

156+
@Transactional(readOnly = true)
152157
public Location findLocationById(Long locationId) {
153158
return locationQueryRepository.findById(locationId)
154159
.orElseThrow(() -> new LocationNotFoundException(
155160
ScheduleErrorCode.LOCATION_NOT_FOUND));
156161
}
157162

163+
@Transactional(readOnly = true)
158164
public ScheduleMember findScheduleMemberById(Long scheduleMemberId) {
159165
return scheduleMemberQueryRepository.findById(scheduleMemberId)
160166
.orElseThrow(() -> new ScheduleMemberNotFoundException(
161167
ScheduleErrorCode.LOCATION_NOT_FOUND));
162168
}
163169

170+
@Transactional(readOnly = true)
164171
public Workspace findWorkspaceById(Long workspaceId) {
165172
return workspaceQueryRepository.findById(workspaceId).orElseThrow(
166173
() -> new WorkSpaceNotFoundException(ScheduleErrorCode.WORKSPACE_NOT_FOUND));

0 commit comments

Comments
 (0)