package com.ai.da.controller; import com.ai.da.common.response.Response; import com.ai.da.model.dto.ContestantDTO; import com.ai.da.model.vo.CheckOTPVO; import com.ai.da.service.GlobalAwardService; import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.Map; @RestController @RequestMapping("/api/global-award") public class GlobalAwardController { @Resource private GlobalAwardService globalAwardService; @PostMapping("/uploads/pdf") public Response uploadPdf(@RequestParam("file") MultipartFile file, @RequestParam(value = "email", required = false) String email) throws Exception { return Response.success(globalAwardService.uploadPdf(file, email)); } @PostMapping("/uploads/video") public Response uploadVideo(@RequestParam("file") MultipartFile file, @RequestParam(value = "email", required = false) String email) throws Exception { return Response.success(globalAwardService.uploadVideo(file, email)); } @PostMapping("/contestants/save") public Response> submit(@RequestBody ContestantDTO request) { return Response.success(globalAwardService.saveContestant(request)); } @GetMapping("/contestants/by-email") public Response getContestantByEmail(@RequestParam("email") String email) { ContestantDTO dto = globalAwardService.getContestantByEmail(email); return Response.success(dto); } @GetMapping("/checkEmail") public Response checkEmail(@RequestParam("email") String email) { globalAwardService.checkEmail(email); return Response.success(); } @GetMapping("/checkCode") public Response checkOTP(@RequestParam("email") String email, @RequestParam("code") String code) { return Response.success(globalAwardService.checkOTP(email, code)); } }