Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: 이미지생성 API구현(dall e) #96

Merged
merged 52 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c79b73b
chore: 환경변수 세팅
Mar 29, 2024
562a909
Merge branch 'chore/#2-aws_settings' of https://github.com/KAU2024-SA…
Mar 29, 2024
cae4c98
chore: aws secret manager 설정
Apr 1, 2024
fbd8664
Merge pull request #11 from KAU2024-SANHAK/chore/#2-aws_settings
hoeun0723 Apr 1, 2024
1b3f0ee
[chore] CI/CD settings (#13)
hoeun0723 Apr 3, 2024
e32370f
feat/14-entity develop브랜치에 merge
jms0324 Apr 10, 2024
b810ab8
Feat/#14 entity (#15)
jms0324 Apr 10, 2024
4959fa4
refactor: entity에 감정,조언 분리
jms0324 Apr 10, 2024
92f38b2
refactor:수정완료
jms0324 Apr 10, 2024
acf5dae
Merge branch 'develop' into refactor/#17-entity-retouch
jms0324 Apr 10, 2024
ba7962f
Merge pull request #18 from KAU2024-SANHAK/refactor/#17-entity-retouch
jms0324 Apr 10, 2024
a378d32
refactor: feeling클래스 감정추가
jms0324 Apr 12, 2024
bd24f25
feat: summary엔티티따로생성 후 member와 다대일양방향관계생성
jms0324 Apr 12, 2024
d8429e4
worried 스펠링수정
jms0324 Apr 12, 2024
2bfa311
Merge pull request #23 from KAU2024-SANHAK/refactor/#22-entity-feelin…
jms0324 Apr 12, 2024
e326417
feat: 카카오 로그인 구현+s3서버 세팅 (#31)
hoeun0723 Apr 29, 2024
d6645e8
Merge branch 'main' into develop
hoeun0723 Apr 29, 2024
58aa184
fix: build.gradle 파일 최신화
Apr 29, 2024
acb9ade
Feat/#30 slowtype save api (#32)
jms0324 Apr 30, 2024
a776f79
fix: bootstarp 파일이 없는 오류 해결
Apr 30, 2024
4219070
Merge branch 'develop' of https://github.com/KAU2024-SANHAK/SANHAK_Se…
Apr 30, 2024
4d614a2
refactor: 카카오 인가코드 프론트측엫서 받아오는 방식으로 수정 (#36)
hoeun0723 Apr 30, 2024
6364cfb
[refactor] kakao login 기존 프론트가 토큰 가져오는 방식으로 수정 (#38)
hoeun0723 May 2, 2024
f17b08e
Merge branch 'main' into develop
hoeun0723 May 2, 2024
d2b6f8c
Refactor/#40 slow type diary retry (#41)
jms0324 May 4, 2024
8debb90
Refactor/#40 slow type diary retry (#44)
jms0324 May 4, 2024
67f46db
Merge branch 'main' into develop
jms0324 May 4, 2024
4fcf436
Refactor/#46 choose diary type api retry (#47)
jms0324 May 5, 2024
4f39a5e
feeling별 diary list조회 api수정 (#50)
jms0324 May 6, 2024
c6cacf6
refactor:content api코드수정및 responseDto 수정 (#53)
jms0324 May 7, 2024
cc50f3d
Refactor/#55 list calendar api retry (#56)
jms0324 May 9, 2024
0ace7b3
Merge branch 'main' into develop
jms0324 May 9, 2024
e62b550
refactor:content api에서 advice와 feeling값 null값허용 (#59)
jms0324 May 9, 2024
b2fb077
Refactor/#58 diary content api exception retry (#61)
jms0324 May 9, 2024
769fe10
Merge branch 'main' into develop
jms0324 May 9, 2024
95f2c16
FeelingListResponseDto의 imageUrl필드추가 (#64)
jms0324 May 11, 2024
564a19b
CalendarDiaryResponseDto의 ImageUrl필드추가 (#67)
jms0324 May 11, 2024
9b528dd
feeling list,slowtype생성 request오류 추가
jms0324 May 12, 2024
3e479e1
refactor:ZonedDatetime추가 (#70)
jms0324 May 13, 2024
82f8c08
Merge branch 'main' into develop
jms0324 May 13, 2024
eba831e
refactor: imageFile 안줘도 가능하게 코드수정 (#73)
jms0324 May 14, 2024
93f26f5
feat: 수정 api구현 (#76)
jms0324 May 14, 2024
6f917c0
refactor: logging추가 (#80)
jms0324 May 14, 2024
fc6e4df
Merge branch 'main' into develop
jms0324 May 14, 2024
c59d21f
refactor-requestpart대신 modelattribute (#83)
jms0324 May 15, 2024
97256df
refactor:s3파일중복체크후 업로드하는 로직 추가 (#86)
jms0324 May 16, 2024
df5c542
Merge branch 'main' into develop
jms0324 May 16, 2024
0a7cd4d
feat: 일기삭제api구현 및 에러타입추가,slowtypeapi요청값대문자로수정 (#88)
jms0324 May 16, 2024
4fd5245
refactor:imageurl LONGTEXT로변경
jms0324 May 16, 2024
77a052b
refactor:slowtyperesponseDto에 createdDate필드추가 (#92)
jms0324 May 18, 2024
9dc4401
Merge branch 'main' into develop
jms0324 May 18, 2024
96ef6b4
refactor:이미지생성api구현 및 중복코드제거 (#95)
jms0324 May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ dependencies {

// JSON
implementation 'com.googlecode.json-simple:json-simple:1.1.1'




implementation 'org.apache.httpcomponents:httpclient:4.5.13'

}

tasks.named('bootBuildImage') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void main(String[] args) {

TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
TimeZone tz = TimeZone.getDefault();
System.out.println("현재 시간대: " + tz.getID());



}
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/kau/kkoolbeeServer/S3/S3UploaderService.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
Expand Down Expand Up @@ -50,13 +51,36 @@ public String upload(MultipartFile file) throws IOException, NoSuchAlgorithmExce
return amazonS3Client.getUrl(bucketName, fileName).toString();
}

public String uploadFile(File file) throws IOException, NoSuchAlgorithmException {
String fileHash = calculateFileHash(file);
String fileName = fileHash + "-" + file.getName();

if (!amazonS3Client.doesObjectExist(bucketName, fileName)) {
amazonS3Client.putObject(new PutObjectRequest(bucketName, fileName, file));
}

return amazonS3Client.getUrl(bucketName, fileName).toString();

}

private String calculateFileHash(MultipartFile file) throws IOException, NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] fileBytes = file.getBytes();
byte[] hash = digest.digest(fileBytes);
return Hex.encodeHexString(hash);
}

private String calculateFileHash(File file) throws IOException, NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
try (FileInputStream fis = new FileInputStream(file)) {
byte[] fileBytes = new byte[(int) file.length()];
fis.read(fileBytes);
byte[] hash = digest.digest(fileBytes);
return Hex.encodeHexString(hash);
}
}





Expand Down
Loading
Loading