-
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
공연 등록 테스트 및 리팩토링 #3
base: develop
Are you sure you want to change the base?
Changes from all commits
d571d56
4d928c5
b25320f
14d3c1b
ccdd451
94f3e30
e8c6851
6057082
b8d5132
14a1355
92e8244
8f96a9b
facba05
abf46e5
0581693
c6b7343
6528676
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.jummi.ticket.common.adapter.persistence; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@EntityListeners(AuditingEntityListener.class) | ||
@MappedSuperclass | ||
public abstract class BaseEntity { | ||
@CreatedDate | ||
@Column(updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
|
||
@Column(columnDefinition = "boolean default false") | ||
private boolean isDeleted; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.jummi.ticket.config.jpa; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
||
@EnableJpaAuditing | ||
@Configuration | ||
public class JpaConfiguration { | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
package com.jummi.ticket.performance.adapter.persistence; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import com.jummi.ticket.common.adapter.persistence.BaseEntity; | ||
import lombok.*; | ||
import org.hibernate.annotations.SQLDelete; | ||
import org.hibernate.annotations.Where; | ||
|
||
import javax.persistence.Embeddable; | ||
import javax.persistence.*; | ||
import java.time.LocalDate; | ||
import java.time.LocalTime; | ||
import java.util.List; | ||
|
||
@Embeddable | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class SeriesEntity { | ||
@Table(name = "series") | ||
@Where(clause = "is_deleted = false") | ||
@SQLDelete(sql = "UPDATE series SET is_deleted = true WHERE series_id = ?") | ||
@Entity | ||
public class SeriesEntity extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long seriesId; | ||
|
||
@Setter | ||
private Long performanceId; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "performance_id") | ||
private PerformanceEntity performance; | ||
|
||
private LocalDate playDate; | ||
|
||
private LocalTime playTime; | ||
|
||
@ElementCollection | ||
@Column(name = "casts") | ||
private List<String> casts; | ||
|
||
private boolean isPerformed; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package com.jummi.ticket.performance.application.port.in; | ||
package com.jummi.ticket.performance.adapter.web; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Builder | ||
@RequiredArgsConstructor | ||
|
@@ -16,5 +18,8 @@ public class SeriesRequest { | |
@DateTimeFormat(pattern = "yyyyMMddHHmm") | ||
private final LocalDateTime dateTime; | ||
|
||
@NotBlank | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
private final List<String> casts; | ||
|
||
private final boolean isPerformed; | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.jummi.ticket.performance.application.port.in; | ||
|
||
import com.jummi.ticket.performance.adapter.web.RegisterPerformanceRequest; | ||
|
||
public interface RegisterPerformanceUseCase { | ||
Long registerPerformance(RegisterPerformanceRequest request); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package com.jummi.ticket.performance.application.service; | ||
|
||
import com.jummi.ticket.performance.application.port.in.RegisterPerformanceCommand; | ||
import com.jummi.ticket.performance.application.port.in.RegisterPerformanceRequest; | ||
import com.jummi.ticket.performance.application.port.out.SavePerformancePort; | ||
import com.jummi.ticket.performance.adapter.web.RegisterPerformanceRequest; | ||
import com.jummi.ticket.performance.application.port.in.RegisterPerformanceUseCase; | ||
import com.jummi.ticket.performance.application.port.out.SavePerformanceCommand; | ||
import com.jummi.ticket.performance.converter.PerformanceMapper; | ||
import com.jummi.ticket.performance.domain.Performance; | ||
import com.jummi.ticket.performance.domain.PerformanceId; | ||
import com.jummi.ticket.performance.domain.Series; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
@@ -14,16 +13,15 @@ | |
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class RegisterPerformanceService implements RegisterPerformanceCommand { | ||
public class RegisterPerformanceService implements RegisterPerformanceUseCase { | ||
private final PerformanceMapper mapper; | ||
private final SavePerformancePort savePerformancePort; | ||
private final SavePerformanceCommand savePerformanceCommand; | ||
|
||
@Override | ||
public PerformanceId registerPerformance(RegisterPerformanceRequest request) { | ||
public Long registerPerformance(RegisterPerformanceRequest request) { | ||
Performance performance = mapper.convertRequestToDomainEntity(request); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Performance 도메인 객체에는 List가 존재하는데, 변환 시에는 없네욤...?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 수정하겠습니다! |
||
List<Series> series = mapper.extractSeriesDomainEntity(request); | ||
Long performanceId = savePerformancePort.savePerformance(performance, series); | ||
|
||
return new PerformanceId(performanceId); | ||
return savePerformanceCommand.savePerformance(performance, series); | ||
} | ||
} |
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.
요 부분을 이렇게 작업해두신 이유가 있을까욤???? 어떤 견해이신지 궁금하네요ㅎㅎ