Skip to content

Commit

Permalink
Merge pull request #31 from AWS-CV-Project-3355/feat/#28-video-compress
Browse files Browse the repository at this point in the history
[Update] 파일 유형
  • Loading branch information
melitina915 authored Nov 29, 2024
2 parents c18f396 + e814887 commit 0ccb13b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/main/java/aws/teamthreefive/aws/s3/AmazonS3Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public class AmazonS3Manager {
private final AmazonS3 amazonS3;
private final AmazonConfig amazonConfig;

public String uploadFile(String KeyName, MultipartFile file){
public String uploadFileWithContentType(String KeyName, MultipartFile file){
System.out.println(KeyName);

ObjectMetadata metadata = new ObjectMetadata();
// metaData는 필수는 아니고 추가적인 정보를 담아주는 것입니다.
metadata.setContentType(file.getContentType());
metadata.setContentLength(file.getSize());

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,13 @@ public Photo savePhoto(Long diecastUuid, DiecastRequestDTO.PhotoDTO request) {
.build()
);

String photoUrl = s3Manager.uploadFile(s3Manager.generatePhotoKeyName(savedUuid), request.getPhotoFile());
String photoUrl = s3Manager.uploadFileWithContentType(s3Manager.generatePhotoKeyName(savedUuid), request.getPhotoFile());

Photo photo = DiecastConverter.toPhoto(request, photoUrl);

photo.setDiecast(diecastRepository.findById(diecastUuid).get());

// photo = PhotoConverter.toPhoto(fileUrl);

///
//photo.setPhotoUrl(fileUrl);
///

return photoRepository.save(photo);
// return photoRepository.save(PhotoConverter.toPhoto(photoUrl, photo));
// return photoRepository.save(PhotoConverter.toPhoto(fileUrl));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ public class DiecastvideoRequestDTO {
@Setter
public static class DiecastvideoDTO {
@NotNull
// String diecastvideoUrl;
MultipartFile diecastvideo;
// List<MultipartFile> diecastvideo;
// String videoType;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class DiecastvideoCommandService {
private final AmazonS3Manager s3Manager;

public Diecastvideo saveDiecastvideo(DiecastvideoRequestDTO.DiecastvideoDTO request) {
//Diecastvideo diecastvideo = DiecastvideoConverter.toDiecastvideo(request);

String uuid = UUID.randomUUID().toString();
Uuid savedUuid = uuidRepository.save(
Expand All @@ -34,9 +33,10 @@ public Diecastvideo saveDiecastvideo(DiecastvideoRequestDTO.DiecastvideoDTO requ
.build()
);

String diecastvideoUrl = s3Manager.uploadFile(s3Manager.generateVideoKeyName(savedUuid), request.getDiecastvideo());
String diecastvideoUrl = s3Manager.uploadFileWithContentType(s3Manager.generateVideoKeyName(savedUuid), request.getDiecastvideo());

return diecastvideoRepository.save(DiecastvideoConverter.toDiecastvideo(diecastvideoUrl));

}


Expand Down

0 comments on commit 0ccb13b

Please sign in to comment.