Skip to content

Commit

Permalink
[refactor] #192 - 공연소개 & 유의사항 최대 글자수 500자로 구현 (#193)
Browse files Browse the repository at this point in the history
* [#192] refactor(Performance): 공연소개, 유의사항 최대 글자수 500자로 변경

* [#192] refactor(PerformanceErrorCode): 공연소개, 유의사항 글자 수 500자 초과 시 보여줄 에러메시지 추가

* [#192] refactor(PerformanceManagementService): 공연소개, 유의사항 글자수 500자 초과 시 예외처리 서비스 로직 구현
  • Loading branch information
hoonyworld authored Aug 29, 2024
1 parent ea79e35 commit 0bb1410
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.beat.domain.staff.dao.StaffRepository;
import com.beat.domain.staff.domain.Staff;
import com.beat.domain.user.domain.Users;
import com.beat.global.common.exception.BadRequestException;
import com.beat.global.common.exception.ForbiddenException;
import com.beat.global.common.exception.NotFoundException;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -47,6 +48,14 @@ public PerformanceResponse createPerformance(Long memberId, PerformanceRequest r

Users user = member.getUser();

if (request.performanceDescription().length() > 500) {
throw new BadRequestException(PerformanceErrorCode.INVALID_PERFORMANCE_DESCRIPTION_LENGTH);
}

if (request.performanceAttentionNote().length() > 500) {
throw new BadRequestException(PerformanceErrorCode.INVALID_ATTENTION_NOTE_LENGTH);
}

Performance performance = Performance.create(
request.performanceTitle(),
request.genre(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public class Performance extends BaseTimeEntity {
@Column(nullable = false)
private int runningTime;

@Column(nullable = false)
@Column(nullable = false, length = 500)
private String performanceDescription;

@Column(nullable = false)
@Column(nullable = false, length = 500)
private String performanceAttentionNote;

@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public enum PerformanceErrorCode implements BaseErrorCode {
PERFORMANCE_DELETE_FAILED(403, "예매자가 1명 이상 있을 경우, 공연을 삭제할 수 없습니다."),
NOT_PERFORMANCE_OWNER(403, "해당 공연의 메이커가 아닙니다."),
MAX_SCHEDULE_LIMIT_EXCEEDED(400, "공연 회차는 최대 3개까지 추가할 수 있습니다."),
INVALID_PERFORMANCE_DESCRIPTION_LENGTH(400, "공연 소개 글자수가 500자를 초과했습니다."),
INVALID_ATTENTION_NOTE_LENGTH(400, "공연 유의사항 글자수가 500자를 초과했습니다."),
INTERNAL_SERVER_ERROR(500, "서버 내부 오류입니다.")
;

Expand Down

0 comments on commit 0bb1410

Please sign in to comment.