Skip to content

Commit e05921b

Browse files
committed
Feat(DB): image size 추가
1 parent fb7129b commit e05921b

File tree

7 files changed

+19
-20
lines changed

7 files changed

+19
-20
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.gradle/
12
.idea/
23
build/
34

build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ plugins {
44
id 'org.springframework.boot' version '2.4.4'
55
}
66

7-
group 'efub.porkpotatoes'
7+
group 'skguma.fedi'
88
version '1.0-SNAPSHOT'
99

10+
1011
repositories {
1112
mavenCentral()
1213
jcenter()

src/main/java/com/fedi/domain/entity/Image.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ public class Image {
4040
private String vector;
4141

4242
private String eyes;
43+
44+
private String size;
4345

4446
@Builder
45-
public Image(Tweet tweet, String imageUrl, String vector, String eyes) {
47+
public Image(Tweet tweet, String imageUrl, String vector, String eyes, String size) {
4648
this.tweet = tweet;
4749
this.imageUrl = imageUrl;
4850
this.vector = vector;
4951
this.eyes = eyes;
52+
this.size = size;
5053
}
5154
}
5255

src/main/java/com/fedi/service/ImageService.java

+10-16
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,19 @@ public class ImageService {
3030

3131
@Transactional
3232
public String upload(List<MultipartFile> images, ImageRequestDto requestDto) throws IllegalArgumentException, IOException {
33-
if(images.get(0).isEmpty()){
34-
throw new IllegalArgumentException("image is null");
35-
}
36-
37-
if(requestDto.getAccountId() == null || requestDto.getAccountName() == null || requestDto.getTweetUrl() == null){
38-
throw new IllegalArgumentException("required parameter is null");
39-
}
40-
41-
if(requestDto.getAccountId().isEmpty() || requestDto.getAccountName().isEmpty() || requestDto.getTweetUrl().isEmpty()){
42-
throw new IllegalArgumentException("required parameter is empty");
43-
}
33+
checkParameterValues();
4434

4535
for(MultipartFile image : images){
46-
Account account = Account.builder()
47-
.accountId(requestDto.getAccountId())
48-
.accountName(requestDto.getAccountName())
49-
.build();
36+
if(isAccountExist(requestDto.getAccountId)){
37+
38+
}else{
39+
Account account = Account.builder()
40+
.accountId(requestDto.getAccountId())
41+
.accountName(requestDto.getAccountName())
42+
.build();
5043

51-
accountRepository.save(account);
44+
accountRepository.save(account);
45+
}
5246

5347
Tweet tweet = Tweet.builder()
5448
.account(account)

src/main/java/com/fedi/service/NetworkService.java

-1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ public List<LikeRpaRequestDto> extractUrl(List<Tweet> tweets){
4242
}
4343
return requestDtos;
4444
}
45-
4645
}

src/main/java/com/fedi/web/dto/NetworkResponseDto.java

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
@Getter
1111
public class NetworkResponseDto {
12-
1312
private ArrayList<NodeDto> nodes;
1413
private ArrayList<LinkDto> links;
1514

src/main/java/com/fedi/web/dto/ResultDto.java

+2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ public class ResultDto {
1111
private Double similarity;
1212
private String tweetUrl;
1313
private Long tweetId;
14+
private String size;
1415

1516
public ResultDto(Analysis analysis) {
1617
this.imageUrl = analysis.getImage().getImageUrl();
1718
this.eyes = analysis.getImage().getEyes();
1819
this.similarity = analysis.getSimilarity();
1920
this.tweetUrl = analysis.getImage().getTweet().getTweetUrl();
2021
this.tweetId = analysis.getImage().getTweet().getTweetId();
22+
this.size = analysis.getImage().getSize();
2123
}
2224
}

0 commit comments

Comments
 (0)