-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into NABI-124--beommo-feat-…
…-jjim-CD # Conflicts: # src/main/java/org/prgrms/nabimarketbe/domain/card/api/CardController.java
- Loading branch information
Showing
35 changed files
with
1,171 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...main/java/org/prgrms/nabimarketbe/domain/card/dto/request/CardStatusUpdateRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.prgrms.nabimarketbe.domain.card.dto.request; | ||
|
||
import org.prgrms.nabimarketbe.domain.card.entity.CardStatus; | ||
import org.prgrms.nabimarketbe.global.annotation.ValidEnum; | ||
|
||
public record CardStatusUpdateRequestDTO( | ||
@ValidEnum(enumClass = CardStatus.class, message = "유효하지 않은 상태입니다.") | ||
CardStatus cardStatus | ||
) { | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/prgrms/nabimarketbe/domain/card/dto/response/CardSummaryResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.prgrms.nabimarketbe.domain.card.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; | ||
|
||
@Getter | ||
public class CardSummaryResponseDTO{ | ||
private Long cardId; | ||
|
||
private String itemName; | ||
|
||
private String thumbnail; | ||
|
||
private PriceRange priceRange; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
package org.prgrms.nabimarketbe.domain.card.repository; | ||
|
||
import org.prgrms.nabimarketbe.domain.card.entity.Card; | ||
import org.prgrms.nabimarketbe.domain.user.entity.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface CardRepository extends JpaRepository<Card, Long>, CardRepositoryCustom { | ||
Optional<Card> findByCardIdAndUser(Long cardId, User user); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...in/java/org/prgrms/nabimarketbe/domain/completeRequest/api/CompleteRequestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.prgrms.nabimarketbe.domain.completeRequest.api; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.CompleteRequestDTO; | ||
import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.HistoryListReadLimitResponseDTO; | ||
import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.HistoryListReadPagingResponseDTO; | ||
import org.prgrms.nabimarketbe.domain.completeRequest.service.CompleteRequestService; | ||
import org.prgrms.nabimarketbe.global.util.ResponseFactory; | ||
import org.prgrms.nabimarketbe.global.util.model.SingleResult; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/complete-requests") | ||
public class CompleteRequestController { | ||
private final CompleteRequestService completeRequestService; | ||
|
||
@PostMapping | ||
public ResponseEntity<SingleResult<CompleteRequestDTO>> createCompleteRequest( | ||
@RequestHeader(name = "Authorization") String token, | ||
@RequestBody org.prgrms.nabimarketbe.domain.completeRequest.dto.request.CompleteRequestDTO completeRequestDTO | ||
) { | ||
CompleteRequestDTO completeRequestResponseDTO = completeRequestService.createCompleteRequest( | ||
token, | ||
completeRequestDTO | ||
); | ||
|
||
return ResponseEntity.ok(ResponseFactory.getSingleResult(completeRequestResponseDTO)); | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<SingleResult<HistoryListReadLimitResponseDTO>> getHistoryBySize(@RequestParam Integer size) { | ||
HistoryListReadLimitResponseDTO historyListReadLimitResponseDTO = completeRequestService.getHistoryBySize(size); | ||
|
||
return ResponseEntity.ok(ResponseFactory.getSingleResult(historyListReadLimitResponseDTO)); | ||
} | ||
|
||
@GetMapping("/user") | ||
public ResponseEntity<SingleResult<HistoryListReadPagingResponseDTO>> getHistoryByUser( | ||
@RequestHeader("Authorization") String token, | ||
@RequestParam(required = false) String cursorId, | ||
@RequestParam Integer size | ||
){ | ||
HistoryListReadPagingResponseDTO historyByUser = completeRequestService.getHistoryByUser( | ||
token, | ||
cursorId, | ||
size | ||
); | ||
|
||
return ResponseEntity.ok(ResponseFactory.getSingleResult(historyByUser)); | ||
} | ||
|
||
@PutMapping("/confirm") | ||
public ResponseEntity<SingleResult<CompleteRequestDTO>> updateCompleteRequestStatus( | ||
@RequestHeader(name = "Authorization") String token, | ||
@RequestParam Long fromCardId, | ||
@RequestParam Long toCardId, | ||
@RequestParam Boolean isAccepted | ||
) { | ||
CompleteRequestDTO completeRequestDTO = completeRequestService.updateCompleteRequestStatus( | ||
token, | ||
fromCardId, | ||
toCardId, | ||
isAccepted | ||
); | ||
|
||
return ResponseEntity.ok(ResponseFactory.getSingleResult(completeRequestDTO)); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...n/java/org/prgrms/nabimarketbe/domain/completeRequest/dto/request/CompleteRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.prgrms.nabimarketbe.domain.completeRequest.dto.request; | ||
|
||
public record CompleteRequestDTO( | ||
Long fromCardId, | ||
Long toCardId | ||
) { | ||
} |
Oops, something went wrong.