Commodity.cs 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. using Microsoft.AspNetCore.Mvc;
  2. using System.ComponentModel.DataAnnotations;
  3. namespace economy.Models.Price.Global.Commodity
  4. {
  5. /*
  6. * 국제 원자재 시세 (구리, 알루미늄, 밀, 섬유(면화), 설탕, 커피, 원자재 종합지수)
  7. * 예시 ) https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=EFOBUHL5SFLBF2LN
  8. */
  9. // 검색요청 변수
  10. public class Request
  11. {
  12. [BindProperty(Name = "commodity", SupportsGet = true)]
  13. [StringLength(30, ErrorMessage = "상품 형식이 잘못되었습니다.")]
  14. public string? Commodity { get; set; }
  15. [BindProperty(Name = "page", SupportsGet = true)]
  16. [Range(1, int.MaxValue, ErrorMessage = "페이지 허용량을 초과하였습니다.")]
  17. public int PageNo { get; set; } = 1;
  18. [BindProperty(Name = "perPage", SupportsGet = true)]
  19. [Range(1, int.MaxValue, ErrorMessage = "출력 허용량을 초과하였습니다.")]
  20. public int NumOfRows { get; set; } = 10;
  21. [BindProperty(Name = "interval", SupportsGet = true)]
  22. [Required(ErrorMessage = "검색 구간을 입력해주세요.")]
  23. [StringLength(120, ErrorMessage = "검색 구간을 초과하였습니다.")]
  24. public string Interval { get; set; } = "monthly"; // quarterly, annual
  25. }
  26. }