| | |
| | | package com.dji.sample.media.controller; |
| | | |
| | | import com.dji.sample.common.model.CustomClaim; |
| | | import com.dji.sample.common.model.PaginationData; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.media.model.MediaFileDTO; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URL; |
| | | |
| | | import static com.dji.sample.component.AuthInterceptor.TOKEN_CLAIM; |
| | | |
| | | /** |
| | | * @author sean |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{workspace_id}/files") |
| | | public ResponseResult<PaginationData<MediaFileDTO>> getFilesList(@RequestParam(defaultValue = "1") Long page, |
| | | public ResponseResult<PaginationData<MediaFileEntity>> getFilesList(@RequestParam(defaultValue = "1") Long page, |
| | | @RequestParam(name = "page_size", defaultValue = "10") Long pageSize, |
| | | @PathVariable(name = "workspace_id") String workspaceId, |
| | | MediaFileQueryParam mediaFileQueryParam) { |
| | | PaginationData<MediaFileDTO> filesList = fileService.getMediaFilesPaginationByWorkspaceId(workspaceId, page, pageSize,mediaFileQueryParam); |
| | | PaginationData<MediaFileEntity> filesList = fileService.getMediaFilesPaginationByWorkspaceId(workspaceId, page, pageSize,mediaFileQueryParam); |
| | | return ResponseResult.success(filesList); |
| | | } |
| | | |
| | | @GetMapping("/{workspace_id}/updateFile") |
| | | public ResponseResult updateFile(@PathVariable(name = "workspace_id") String workspaceId, MediaFileEntity mediaFileEntity) { |
| | | @GetMapping("/{workspace_id}/files/{job_id}") |
| | | public ResponseResult findFilesList(@PathVariable(name = "workspace_id") String workspaceId,@PathVariable(name = "job_id") String jobId) { |
| | | return ResponseResult.success(fileService.listMediaFileEntity(workspaceId,jobId)); |
| | | } |
| | | |
| | | @PostMapping("/{workspace_id}/updateFile") |
| | | public ResponseResult updateFile(HttpServletRequest request, @PathVariable(name = "workspace_id") String workspaceId, @RequestBody MediaFileEntity mediaFileEntity) { |
| | | CustomClaim claims = (CustomClaim) request.getAttribute(TOKEN_CLAIM); |
| | | mediaFileEntity.setUserId(claims.getId()); |
| | | return ResponseResult.success(fileService.updateMediaFile(workspaceId, mediaFileEntity)); |
| | | } |
| | | |