package com.sikey.wa04.api.user.client.rest;

import com.sikey.wa04.business.application.service.AliyunOssService;
import com.sikey.wa04.business.domain.entity.UserId;
import com.sikey.wa04.business.infrastructure.configuration.ProjectContextConstant;
import com.sikey.wa04.business.infrastructure.dto.request.file.UploadFileRequest;
import com.sikey.wa04.business.infrastructure.dto.response.file.UploadFileResponse;
import com.sikey.wa04.common.interceptor.Authenticated;
import com.sikey.wa04.common.interceptor.CurrentRequestUser;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Instant;

@RestController
@RequestMapping(ProjectContextConstant.USER_CONTEXT_URL + "/file")
public class FileController {
    private final AliyunOssService aliyunOssService;

    public FileController(AliyunOssService aliyunOssServiceImpl) {
        this.aliyunOssService = aliyunOssServiceImpl;
    }

    @Authenticated
    @PostMapping("/upload")
    public UploadFileResponse upload(UploadFileRequest request) {
        return aliyunOssService.putObject(request);
    }

}
