-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9a2ca5
commit 710336b
Showing
43 changed files
with
866 additions
and
164 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
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
56 changes: 56 additions & 0 deletions
56
src/main/java/com/gt/genti/adapter/in/web/admin/AdminWithdrawRequestController.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,56 @@ | ||
package com.gt.genti.adapter.in.web.admin; | ||
|
||
import static com.gt.genti.other.util.ApiUtils.*; | ||
|
||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Sort; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.gt.genti.dto.admin.response.WithdrawCompletionResponseDto; | ||
import com.gt.genti.dto.admin.response.WithdrawFindResponseDto; | ||
import com.gt.genti.other.auth.UserDetailsImpl; | ||
import com.gt.genti.other.valid.ValidWithdrawStatus; | ||
import com.gt.genti.service.WithdrawService; | ||
|
||
import jakarta.validation.constraints.Min; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequestMapping("/api/admin/withdraw-requests") | ||
@RequiredArgsConstructor | ||
public class AdminWithdrawRequestController { | ||
private final WithdrawService withDrawService; | ||
|
||
@GetMapping("") | ||
public ResponseEntity<ApiResult<Page<WithdrawFindResponseDto>>> getAllWithdrawList( | ||
@RequestParam(name = "page") @NotNull @Min(0) int page, | ||
@RequestParam(name = "size") @NotNull @Min(1) int size, | ||
@RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, | ||
@RequestParam(name = "direction", defaultValue = "desc") String direction, | ||
@RequestParam(name = "status", defaultValue = "ALL") @ValidWithdrawStatus String status | ||
) { | ||
Sort.Direction sortDirection = Sort.Direction.fromString(direction); | ||
Pageable pageable = PageRequest.of(page, size, Sort.by(sortDirection, sortBy)); | ||
|
||
return success(withDrawService.getAllWithdrawRequests(pageable, status)); | ||
} | ||
|
||
@PostMapping("{withdrawRequestId}") | ||
public ResponseEntity<ApiResult<WithdrawCompletionResponseDto>> complete( | ||
@PathVariable(name = "withdrawRequestId") Long withdrawRequestId, | ||
@AuthenticationPrincipal UserDetailsImpl userDetails | ||
) { | ||
return success(withDrawService.complete(withdrawRequestId, userDetails.getUser())); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/gt/genti/adapter/in/web/creator/CreatorWithdrawController.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,41 @@ | ||
package com.gt.genti.adapter.in.web.creator; | ||
|
||
import static com.gt.genti.other.util.ApiUtils.*; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.gt.genti.dto.creator.response.WithdrawCreateResponseDto; | ||
import com.gt.genti.other.auth.UserDetailsImpl; | ||
import com.gt.genti.service.WithdrawService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequestMapping("/api/creators/withdraw") | ||
@RequiredArgsConstructor | ||
public class CreatorWithdrawController { | ||
private final WithdrawService withDrawService; | ||
|
||
@PostMapping("") | ||
public ResponseEntity<ApiResult<WithdrawCreateResponseDto>> createWithdrawRequest( | ||
@AuthenticationPrincipal UserDetailsImpl userDetails) { | ||
|
||
return success(withDrawService.create(userDetails.getUser())); | ||
} | ||
|
||
@GetMapping("") | ||
public ResponseEntity<ApiResult<List<WithdrawCreateResponseDto>>> getWithdrawRequest( | ||
@AuthenticationPrincipal UserDetailsImpl userDetails) { | ||
|
||
return success(withDrawService.findWithdrawList(userDetails.getUser())); | ||
} | ||
|
||
|
||
} |
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
Oops, something went wrong.