shinnosuke
4 天以前 38e39c50dcca12534c4efe2b49355a97c396b507
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.talentcard.server.business.portal;
 
import java.util.Map;
 
import com.talentcard.server.common.ApiResponse;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("/api/app/card-upgrades")
public class CardUpgradePortalController {
 
    private final CardUpgradePortalService cardUpgradePortalService;
 
    public CardUpgradePortalController(CardUpgradePortalService cardUpgradePortalService) {
        this.cardUpgradePortalService = cardUpgradePortalService;
    }
 
    @GetMapping
    public ApiResponse<Map<String, Object>> current(@RequestParam Long talentId) {
        return ApiResponse.success(cardUpgradePortalService.current(talentId));
    }
 
    @PostMapping
    public ApiResponse<Map<String, Object>> submit(
            @Valid @RequestBody CardUpgradeRequest request,
            @RequestHeader(value = "X-Idempotency-Key", required = false) String idempotencyKey
    ) {
        return ApiResponse.success(cardUpgradePortalService.submit(request, idempotencyKey));
    }
}