Skip to content

Commit

Permalink
style: auto-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
younghoonkwon committed Oct 28, 2021
1 parent 0237e91 commit bf18137
Show file tree
Hide file tree
Showing 23 changed files with 346 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ public CommentRepositoryImpl(EntityManager em) {
@Override
public List<Comment> findByUserId(Long userId) {
return queryFactory.selectFrom(comment)
.leftJoin(comment.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(comment.createdAt.desc())
.fetch();
.leftJoin(comment.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(comment.createdAt.desc())
.fetch();
}

@Override
public List<Comment> findByUserId(Long userId, int offset, int size) {
return queryFactory.selectFrom(comment)
.leftJoin(comment.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(comment.createdAt.desc())
.offset(offset)
.limit(size)
.fetch();
.leftJoin(comment.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(comment.createdAt.desc())
.offset(offset)
.limit(size)
.fetch();
}

private BooleanExpression userIdEq(Long userId) {
Expand Down
15 changes: 5 additions & 10 deletions backend/domain-cvi/src/main/java/com/cvi/image/domain/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@
import com.cvi.config.entity.BaseEntity;
import com.cvi.exception.NotFoundException;
import com.cvi.post.domain.model.Post;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Objects;
import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Objects;

@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ public LikeRepositoryImpl(EntityManager em) {
@Override
public List<Like> findByUserId(Long userId) {
return queryFactory.selectFrom(like)
.leftJoin(like.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(like.createdAt.desc())
.fetch();
.leftJoin(like.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(like.createdAt.desc())
.fetch();
}

@Override
public List<Like> findByUserId(Long userId, int offset, int size) {
return queryFactory.selectFrom(like)
.leftJoin(like.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(like.createdAt.desc())
.offset(offset)
.limit(size)
.fetch();
.leftJoin(like.user, user).fetchJoin()
.where(userIdEq(userId))
.orderBy(like.createdAt.desc())
.offset(offset)
.limit(size)
.fetch();
}

private BooleanExpression userIdEq(Long userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

import com.cvi.exception.NotFoundException;
import com.cvi.image.domain.Image;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.Embeddable;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.Embeddable;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Embeddable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,16 @@
import com.cvi.image.domain.Image;
import com.cvi.like.domain.model.Like;
import com.cvi.user.domain.model.User;
import lombok.*;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotBlank;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Getter
@Entity
Expand Down Expand Up @@ -62,7 +49,7 @@ public class Post extends BaseEntity {

@Builder
public Post(Long id, LocalDateTime createdAt, LocalDateTime lastModifiedAt, User user,
String content, int viewCount, VaccinationType vaccinationType) {
String content, int viewCount, VaccinationType vaccinationType) {
super(id, createdAt, lastModifiedAt);
this.user = user;
this.content = content;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.cvi.post.domain.model;

import static com.cvi.post.domain.model.QPost.post;

import com.cvi.exception.InvalidInputException;
import com.querydsl.core.types.OrderSpecifier;
import java.util.Arrays;
import lombok.Getter;

import static com.cvi.post.domain.model.QPost.post;

@Getter
public enum Sort {
LIKE_COUNT_ASC(post.likes.likes.size().asc()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package com.cvi.post.domain.repository;

import static com.cvi.comment.domain.model.QComment.comment;
import static com.cvi.like.domain.model.QLike.like;
import static com.cvi.post.domain.model.QPost.post;
import static com.cvi.user.domain.model.QUser.user;

import com.cvi.post.domain.model.Post;
import com.cvi.post.domain.model.QPost;
import com.cvi.post.domain.model.VaccinationType;
import com.querydsl.core.types.OrderSpecifier;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.jpa.JPQLQueryFactory;
import com.querydsl.jpa.impl.JPAQueryFactory;

import javax.persistence.EntityManager;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.persistence.EntityManager;

import static com.cvi.comment.domain.model.QComment.comment;
import static com.cvi.like.domain.model.QLike.like;
import static com.cvi.post.domain.model.QPost.post;
import static com.cvi.user.domain.model.QUser.user;

public class PostRepositoryImpl implements PostQueryDsl {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.cvi.publicdata.domain.model;

import lombok.Getter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;

@Getter
public enum RegionPopulation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class VaccinationStatistic extends PublicData {

@Builder
public VaccinationStatistic(Long id, LocalDateTime createdAt, LocalDateTime lastModifiedAt, RegionPopulation regionPopulation,
LocalDate baseDate, long firstCnt, long secondCnt, long totalFirstCnt, long totalSecondCnt, long accumulatedFirstCnt,
long accumulatedSecondCnt, BigDecimal totalFirstRate, BigDecimal totalSecondRate) {
LocalDate baseDate, long firstCnt, long secondCnt, long totalFirstCnt, long totalSecondCnt, long accumulatedFirstCnt,
long accumulatedSecondCnt, BigDecimal totalFirstRate, BigDecimal totalSecondRate) {
super(id, createdAt, lastModifiedAt, regionPopulation);
this.baseDate = baseDate;
this.firstCnt = firstCnt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
import com.cvi.exception.InvalidInputException;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.Length;
import org.springframework.util.StringUtils;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Slf4j
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.cvi.comment.domain.model;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import com.cvi.exception.InvalidOperationException;
import com.cvi.exception.NotFoundException;
import com.cvi.exception.UnAuthorizedException;
Expand All @@ -11,11 +8,15 @@
import com.cvi.user.domain.model.AgeRange;
import com.cvi.user.domain.model.SocialProvider;
import com.cvi.user.domain.model.User;
import java.time.LocalDateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.time.LocalDateTime;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

@DisplayName("๋Œ“๊ธ€ ๋„๋ฉ”์ธ ํ…Œ์ŠคํŠธ")
class CommentTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.cvi.comment.domain.repository;

import com.cvi.comment.domain.model.Comment;
import com.cvi.image.domain.Image;
import com.cvi.post.domain.model.Post;
import com.cvi.post.domain.model.VaccinationType;
import com.cvi.post.domain.repository.PostRepository;
Expand All @@ -15,8 +14,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;

import java.util.Arrays;

import static org.assertj.core.api.Assertions.assertThat;

@DisplayName("CommentRepository ํ…Œ์ŠคํŠธ")
Expand Down Expand Up @@ -49,51 +46,51 @@ void setUp() {

private void initUsers() {
user1 = User.builder()
.nickname("์ธ๋น„")
.ageRange(AgeRange.TEENS)
.socialProvider(SocialProvider.KAKAO)
.socialId("1000")
.profileUrl("profile url 1")
.build();
.nickname("์ธ๋น„")
.ageRange(AgeRange.TEENS)
.socialProvider(SocialProvider.KAKAO)
.socialId("1000")
.profileUrl("profile url 1")
.build();
user2 = User.builder()
.nickname("๊ฒ€ํ”„")
.ageRange(AgeRange.FIFTIES)
.socialProvider(SocialProvider.NAVER)
.socialId("1001")
.profileUrl("profile url 2")
.build();
.nickname("๊ฒ€ํ”„")
.ageRange(AgeRange.FIFTIES)
.socialProvider(SocialProvider.NAVER)
.socialId("1001")
.profileUrl("profile url 2")
.build();
userRepository.save(user1);
userRepository.save(user2);
}

private void initPost() {
post1 = Post.builder()
.user(user1)
.content("๋‚ด์šฉ 1")
.vaccinationType(VaccinationType.PFIZER)
.build();
.user(user1)
.content("๋‚ด์šฉ 1")
.vaccinationType(VaccinationType.PFIZER)
.build();
postRepository.save(post1);
}

private void initComments() {
comment1 = Comment.builder()
.content("๋Œ“๊ธ€ ๋‚ด์šฉ1")
.user(user1)
.build();
.content("๋Œ“๊ธ€ ๋‚ด์šฉ1")
.user(user1)
.build();
comment1.assignPost(post1);
commentRepository.save(comment1);

comment2 = Comment.builder()
.content("๋Œ“๊ธ€ ๋‚ด์šฉ2")
.user(user2)
.build();
.content("๋Œ“๊ธ€ ๋‚ด์šฉ2")
.user(user2)
.build();
comment2.assignPost(post1);
commentRepository.save(comment2);

comment3 = Comment.builder()
.content("๋Œ“๊ธ€ ๋‚ด์šฉ3")
.user(user2)
.build();
.content("๋Œ“๊ธ€ ๋‚ด์šฉ3")
.user(user2)
.build();
comment3.assignPost(post1);
commentRepository.save(comment3);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;

@DisplayName("Boolean ์„ Y/N๋กœ ๋ณ€ํ™˜ ํ…Œ์ŠคํŠธ")
class BooleanToYNConverterTest {
Expand Down
Loading

0 comments on commit bf18137

Please sign in to comment.