Skip to content

Commit

Permalink
πŸ”¨ Refactor/#77 - 4.7 λ™μ°Έν•˜κΈ° requestBody ν•„λ“œμ— ν•„μš”μ—†λŠ” eventId κ°’ μ‚­μ œ
Browse files Browse the repository at this point in the history
  • Loading branch information
dongkyeomjang committed Nov 22, 2024
1 parent 502f01a commit 0bebe3a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion http/onjung/OnjungControllerHttpRequest.http
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ Authorization: Bearer {{access_token}}
Content-Type: application/json

{
"event_id": {{onjung.API_4_7.event_id}},
"donation_amount": {{onjung.API_4_7.donation_amount}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ public static StoreInfoDto fromEntity(Store store) {
@Getter
public static class EventInfoDto {

@NotNull(message = "idλŠ” null일 수 μ—†μŠ΅λ‹ˆλ‹€.")
@JsonProperty("id")
private final Long id;

@NotNull(message = "total_amountλŠ” null일 수 μ—†μŠ΅λ‹ˆλ‹€.")
@JsonProperty("total_amount")
private final Integer totalAmount;
Expand All @@ -144,15 +140,13 @@ public static class EventInfoDto {
private final Integer restOfDate;

@Builder
public EventInfoDto(Integer totalAmount, Integer restOfDate, Long id) {
this.id = id;
public EventInfoDto(Integer totalAmount, Integer restOfDate) {
this.totalAmount = totalAmount;
this.restOfDate = restOfDate;
}

public static EventInfoDto of(Long id, Integer totalAmount, Integer restOfDate) {
public static EventInfoDto of(Integer totalAmount, Integer restOfDate) {
return EventInfoDto.builder()
.id(id)
.totalAmount(totalAmount)
.restOfDate(restOfDate)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ReadStoreDetailResponseDto execute(Long id) {
// event 정보
Integer totalAmount = getTotalAmount(id);

ReadStoreDetailResponseDto.EventInfoDto eventInfoDto = ReadStoreDetailResponseDto.EventInfoDto.of(event.getId(), totalAmount, eventService.getRestOfDate(event));
ReadStoreDetailResponseDto.EventInfoDto eventInfoDto = ReadStoreDetailResponseDto.EventInfoDto.of(totalAmount, eventService.getRestOfDate(event));

// onjung 정보 (null κ°’ λŒ€μ‹  0으둜
Integer totalOnjungCount = Optional.ofNullable(storeRepository.countUsersByStoreId(id)).orElse(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

public record CreateDonationRequestDto(

@JsonProperty("event_id")
Long eventId,

@JsonProperty("donation_amount")
Integer donationAmount
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public CreateDonationResponseDto execute(UUID accountId, Long storeId, CreateDon
.orElseThrow(() -> new CommonException(ErrorCode.NOT_FOUND_RESOURCE));

// 이벀트 쑰회
Event event = eventRepository.findById(requestDto.eventId())
Event event = eventRepository.findINPROGRESSEventByStoreId(storeId)
.orElseThrow(() -> new CommonException(ErrorCode.NOT_FOUND_RESOURCE));

// 동참 생성
Expand Down

0 comments on commit 0bebe3a

Please sign in to comment.