package com.talentcard.server.upload; import java.util.Map; import com.talentcard.server.common.ApiResponse; import org.springframework.http.HttpStatus; 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.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("/api/merchant/uploads") public class MerchantUploadController { private final ImageUploadService imageUploadService; public MerchantUploadController(ImageUploadService imageUploadService) { this.imageUploadService = imageUploadService; } @PostMapping("/images") @ResponseStatus(HttpStatus.CREATED) public ApiResponse> uploadImage(@RequestParam("file") MultipartFile file) { String url = imageUploadService.upload(file).url(); return ApiResponse.success(Map.of("fileId", url, "url", url)); } }