추세검색 화면 적용
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.goldenchart.controller;
|
||||
|
||||
import com.goldenchart.dto.TrendSearchRequest;
|
||||
import com.goldenchart.dto.TrendSearchResultDto;
|
||||
import com.goldenchart.service.TrendSearchService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 암호화폐 추세검색 API.
|
||||
*
|
||||
* POST /api/trend-search/scan — 조건 스캔
|
||||
* GET /api/trend-search/detail?market=KRW-BTC — 단일 종목 상세
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/trend-search")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TrendSearchController {
|
||||
|
||||
private final TrendSearchService trendSearchService;
|
||||
|
||||
@PostMapping("/scan")
|
||||
public ResponseEntity<List<TrendSearchResultDto>> scan(@RequestBody TrendSearchRequest request) {
|
||||
log.info("[TrendSearch] scan tf={} limit={}", request.getTimeframe(), request.getLimit());
|
||||
return ResponseEntity.ok(trendSearchService.scan(request));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public ResponseEntity<TrendSearchResultDto> detail(
|
||||
@RequestParam String market,
|
||||
@RequestParam(required = false) String timeframe) {
|
||||
TrendSearchRequest req = new TrendSearchRequest();
|
||||
if (timeframe != null) req.setTimeframe(timeframe);
|
||||
return ResponseEntity.ok(trendSearchService.detail(market, req));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user