Skip to content

Commit

Permalink
refactor: createFestival 메서드 save 이전 validate 수행하도록 변경
Browse files Browse the repository at this point in the history
- save 호출 시 auto increment 값 증가 문제 수정 및 효율 향상
  • Loading branch information
seokjin8678 committed Apr 19, 2024
1 parent 3576112 commit 61e7e8b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public class FestivalCreateService {

public Long createFestival(FestivalCreateCommand command) {
School school = schoolRepository.getOrThrow(command.schoolId());
Festival festival = festivalRepository.save(command.toEntity(school));
Festival festival = command.toEntity(school);
validate(festival);
festivalRepository.save(festival);
eventPublisher.publishEvent(new FestivalCreatedEvent(festival.getId()));
return festival.getId();
}
Expand Down

0 comments on commit 61e7e8b

Please sign in to comment.