Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a833ea9
[refactor] Tag를 Feed의 밸류 타입 객체로 변경 (#52)
buzz0331 Jul 9, 2025
f08bfe8
[refactor] Feed Tag의 관계테이블 정의 (#53)
buzz0331 Jul 9, 2025
e59bc09
[refactor] Tag안에 TagName 선언 (#53)
buzz0331 Jul 9, 2025
9a82076
[refactor] TagMapper 삭제 (#53)
buzz0331 Jul 9, 2025
438a9f2
[refactor] Alias 관련 밸류 타입 수정 (#53)
buzz0331 Jul 9, 2025
178c42f
[refactor] User, Alias 도메인 구조 수정 (#53)
seongjunnoh Jul 10, 2025
91726bd
[refactor] Alias 관련 영속성 코드 삭제 (#53)
seongjunnoh Jul 10, 2025
2841e50
[refactor] User 관련 영속성 코드 수정 (#53)
seongjunnoh Jul 10, 2025
fa11a2d
[refactor] 프로덕션 코드 수정 (#53)
seongjunnoh Jul 10, 2025
2634c37
[refactor] 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
e67989d
develop merge (#53)
seongjunnoh Jul 10, 2025
bc984e5
[fix] 조회용 api의 Service에 @Transactional(readOnly = true) 추가 (#53)
seongjunnoh Jul 10, 2025
efd0934
[fix] aliasId 조회하는 코드 수정 (#53)
seongjunnoh Jul 10, 2025
f32ec22
[refactor] 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
061addb
[refactor] 방 검색 Service에서 Category 생성 로직 수정 (#53)
seongjunnoh Jul 10, 2025
6d02a81
[refactor] TestEntityFactory 코드 수정 (#53)
seongjunnoh Jul 10, 2025
7dddea8
[refactor] 방 검색 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
c37eade
[refactor] 방 비밀번호 검증 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
184b103
[refactor] 방 생성 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
0b80343
[refactor] 책 상태변경 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
e520515
[refactor] 책 상세조회 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
cf422bf
[refactor] 책 검색 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
d83a080
[refactor] 책 검색 순위 조회 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
ded0ee9
[refactor] 기록 생성 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
0ea62e0
[refactor] 기록장 조회 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
a900023
[refactor] 기록장 조회 영속성 코드 수정 (#53)
seongjunnoh Jul 10, 2025
3c2dffe
[refactor] 유저 회원가입 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
bf4f433
[refactor] 유저 닉네임 검증 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
736d887
[refactor] 칭호 선택 화면 조회 api 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
f6287dc
[refactor] jpa entity 테스트 코드 수정 (#53)
seongjunnoh Jul 10, 2025
e0ea655
[refactor] category 이름 수정 (#53)
buzz0331 Jul 10, 2025
bd05a14
[refactor] alias 오타 수정 (#53)
buzz0331 Jul 10, 2025
da02c34
[refactor] 필요없는 생성자 제거 (#53)
buzz0331 Jul 10, 2025
43305b4
[refactor] 필요없는 trasactional 제거 (#53)
buzz0331 Jul 10, 2025
c02de47
[refactor] TagName과 Tag를 병합 (#53)
buzz0331 Jul 10, 2025
45181e2
[refactor] Tag에서 Category를 Enumdㅡ로 매핑 (#53)
buzz0331 Jul 10, 2025
168716e
[refactor] tag에서 category 정보 제거 (#53)
seongjunnoh Jul 10, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import konkuk.thip.user.application.port.out.UserCommandPort;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.List;
Expand All @@ -18,6 +19,7 @@ public class BookMostSearchService implements BookMostSearchUseCase {
private final UserCommandPort userCommandPort;

@Override
@Transactional(readOnly = true)
public BookMostSearchResult getMostSearchedBooks(Long userId) {

userCommandPort.findById(userId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package konkuk.thip.book.application.service;

import jakarta.transaction.Transactional;
import konkuk.thip.book.adapter.out.api.dto.NaverBookParseResult;
import konkuk.thip.book.adapter.out.api.dto.NaverDetailBookParseResult;
import konkuk.thip.book.application.port.in.BookSearchUseCase;
Expand All @@ -21,6 +20,7 @@
import konkuk.thip.user.domain.User;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.HashSet;
Expand All @@ -44,9 +44,8 @@ public class BookSearchService implements BookSearchUseCase {
private final UserCommandPort userCommandPort;
private final BookRedisCommandPort bookRedisCommandPort;


@Override
@Transactional
@Transactional(readOnly = true)
public NaverBookParseResult searchBooks(String keyword, int page, Long userId) {

if (keyword == null || keyword.isBlank()) {
Expand Down Expand Up @@ -79,6 +78,7 @@ public NaverBookParseResult searchBooks(String keyword, int page, Long userId) {
}

@Override
@Transactional(readOnly = true)
public BookDetailSearchResult searchDetailBooks(String isbn,Long userId) {

//유저정보찾기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public enum ErrorCode implements ResponseCode {
* 60000 : alias error
*/
ALIAS_NOT_FOUND(HttpStatus.NOT_FOUND, 60001, "존재하지 않는 ALIAS 입니다."),
ALIAS_NAME_NOT_MATCH(HttpStatus.BAD_REQUEST, 60002, "일치하는 칭호 이름이 없습니다."),


/**
Expand Down Expand Up @@ -102,7 +103,13 @@ public enum ErrorCode implements ResponseCode {
* 150000 : Category error
*/
CATEGORY_NOT_FOUND(HttpStatus.NOT_FOUND, 150000, "존재하지 않는 CATEGORY 입니다."),
CATEGORY_NOT_MATCH(HttpStatus.BAD_REQUEST, 150001, "일치하는 카테고리 이름이 없습니다.")
CATEGORY_NOT_MATCH(HttpStatus.BAD_REQUEST, 150001, "일치하는 카테고리 이름이 없습니다."),

/**
* 160000 : Feed error
*/
FEED_NOT_FOUND(HttpStatus.NOT_FOUND, 160000, "존재하지 않는 FEED 입니다."),
TAG_NAME_NOT_MATCH(HttpStatus.BAD_REQUEST, 160001, "일치하는 태그 이름이 없습니다.")

;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package konkuk.thip.feed.adapter.out.jpa;

import jakarta.persistence.*;
import konkuk.thip.common.entity.BaseJpaEntity;
import lombok.*;

@Entity
@Table(name = "feed_tags")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class FeedTagJpaEntity extends BaseJpaEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long feedTagId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", nullable = false)
private FeedJpaEntity feedJpaEntity;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tag_id", nullable = false)
private TagJpaEntity tagJpaEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import konkuk.thip.book.adapter.out.jpa.BookJpaEntity;
import konkuk.thip.feed.adapter.out.jpa.FeedJpaEntity;
import konkuk.thip.feed.adapter.out.jpa.TagJpaEntity;
import konkuk.thip.feed.domain.Feed;
import konkuk.thip.feed.domain.Tag;
import konkuk.thip.user.adapter.out.jpa.UserJpaEntity;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class FeedMapper {

Expand All @@ -19,14 +23,18 @@ public FeedJpaEntity toJpaEntity(Feed feed, UserJpaEntity userJpaEntity, BookJpa
.build();
}

public Feed toDomainEntity(FeedJpaEntity feedJpaEntity) {
public Feed toDomainEntity(FeedJpaEntity feedJpaEntity, List<TagJpaEntity> tagJpaEntityList) {
return Feed.builder()
.id(feedJpaEntity.getPostId())
.content(feedJpaEntity.getContent())
.creatorId(feedJpaEntity.getUserJpaEntity().getUserId())
.isPublic(feedJpaEntity.getIsPublic())
.reportCount(feedJpaEntity.getReportCount())
.targetBookId(feedJpaEntity.getBookJpaEntity().getBookId())
.tagList(tagJpaEntityList.stream()
.map(TagJpaEntity::getValue)
.map(Tag::from)
.toList())
.createdAt(feedJpaEntity.getCreatedAt())
.modifiedAt(feedJpaEntity.getModifiedAt())
.status(feedJpaEntity.getStatus())
Expand Down
31 changes: 0 additions & 31 deletions src/main/java/konkuk/thip/feed/adapter/out/mapper/TagMapper.java

This file was deleted.

16 changes: 16 additions & 0 deletions src/main/java/konkuk/thip/feed/domain/Feed.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import lombok.Getter;
import lombok.experimental.SuperBuilder;

import java.util.List;

@Getter
@SuperBuilder
public class Feed extends BaseDomainEntity {
Expand All @@ -20,4 +22,18 @@ public class Feed extends BaseDomainEntity {

private Long targetBookId;

private List<Tag> tagList;

public static Feed withoutId(String content, Long creatorId, Boolean isPublic, int reportCount, Long targetBookId, List<Tag> tagList) {
return Feed.builder()
.id(null)
.content(content)
.creatorId(creatorId)
.isPublic(isPublic)
.reportCount(reportCount)
.targetBookId(targetBookId)
.tagList(tagList)
.build();
}

}
41 changes: 31 additions & 10 deletions src/main/java/konkuk/thip/feed/domain/Tag.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
package konkuk.thip.feed.domain;

import konkuk.thip.common.entity.BaseDomainEntity;
import konkuk.thip.common.exception.InvalidStateException;
import konkuk.thip.room.domain.Category;
import lombok.Getter;
import lombok.experimental.SuperBuilder;
import lombok.RequiredArgsConstructor;

@Getter
@SuperBuilder
public class Tag extends BaseDomainEntity {

private Long id;
import static konkuk.thip.common.exception.code.ErrorCode.TAG_NAME_NOT_MATCH;

private String value;
@Getter
@RequiredArgsConstructor
public enum Tag {
BOOK_RECOMMEND("책추천"),
TODAYS_BOOK("오늘의책"),
READING_LOG("독서기록"),
BOOK_REVIEW("책리뷰"),
QUOTE("책속한줄"),
BOOK_REPORT("독후감"),
LIFE_BOOK("내인생책"),
RE_READ("다시읽고싶은책"),
BOOK_TALK("북토크"),
BOOKSTAGRAM("책스타그램"),
NOVEL("소설추천"),
SELF_IMPROVEMENT("자기계발서"),
PHILOSOPHY("인문학책"),
SCIENCE("과학책"),
ECONOMY("경제책");

private Long targetPostId;
private final String value;

private Long categoryId;
public static Tag from(String value) {
for (Tag tagName : Tag.values()) {
if (tagName.value.equalsIgnoreCase(value)) {
return tagName;
}
}
throw new InvalidStateException(TAG_NAME_NOT_MATCH);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static RecordDto of(Record record, String postDate, User user, int likeCo
.page(record.getPage())
.userId(record.getCreatorId())
.nickName(user.getNickname())
.profileImageUrl(user.getImageUrl())
.profileImageUrl(user.getAlias().getImageUrl())
.content(record.getContent())
.likeCount(likeCount)
.commentCount(commentCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static VoteDto of(
.page(vote.getPage())
.userId(vote.getCreatorId())
.nickName(user.getNickname())
.profileImageUrl(user.getImageUrl())
.profileImageUrl(user.getAlias().getImageUrl())
.content(vote.getContent())
.likeCount(likeCount)
.commentCount(commentCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Comparator;
Expand All @@ -46,6 +47,7 @@ public class RecordSearchService implements RecordSearchUseCase {
private static final int PAGE_SIZE = 10;

@Override
@Transactional(readOnly = true)
public RecordSearchResponse search(RecordSearchQuery query) {
validateQueryParams(query);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static konkuk.thip.common.exception.code.ErrorCode.CATEGORY_NOT_FOUND;
import static konkuk.thip.common.exception.code.ErrorCode.INVALID_ROOM_SEARCH_SORT;
Expand All @@ -25,6 +26,7 @@ public class RoomSearchService implements RoomSearchUseCase {
private final RoomQueryPort roomQueryPort;

@Override
@Transactional(readOnly = true)
public RoomSearchResponse searchRoom(String keyword, String category, String sort, int page) {
// 1. validation
String sortVal = validateSort(sort);
Expand Down Expand Up @@ -58,12 +60,8 @@ private String validateCategory(String category) {
if (category == null || category.isEmpty()) {
return "";
}
try {
Category cat = Category.from(category);
return cat.getValue();
} catch (IllegalArgumentException ex) {
throw new BusinessException(CATEGORY_NOT_FOUND, ex);
}

return Category.from(category).getValue();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class RoomVerifyPasswordService implements RoomVerifyPasswordUseCase {
private final RoomCommandPort roomCommandPort;

@Override
@Transactional(readOnly = true)
public Void verifyRoomPassword(RoomVerifyPasswordQuery query) {

//방 검증
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/konkuk/thip/room/domain/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum Category {
* TODO : DB에서 value를 통해 카테고리를 조회하는것보다 id로 조회하는게 성능상 좋으니, id 값도 같이 보관 ??
*/
SCIENCE_IT("과학/IT"),
Literature("문학"),
LITERATURE("문학"),
ART("예술"),
SOCIAL_SCIENCE("사회과학"),
HUMANITY("인문학");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package konkuk.thip.user.adapter.in.web.request;

import jakarta.validation.constraints.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import konkuk.thip.user.application.port.in.dto.UserSignupCommand;

public record UserSignupRequest(
@NotNull(message = "aliasId는 필수입니다.")
Long aliasId,
@NotBlank(message = "aliasName은 필수입니다.")
String aliasName,

@Pattern(regexp = "[가-힣a-zA-Z0-9]+", message = "닉네임은 한글, 영어, 숫자로만 구성되어야 합니다.(공백불가)")
@Size(max = 10, message = "닉네임은 최대 10자 입니다.")
String nickname
) {
public UserSignupCommand toCommand(String oAuth2Id) {
return UserSignupCommand.builder()
.aliasId(aliasId)
.aliasName(aliasName)
.nickname(nickname)
.oauth2Id(oAuth2Id)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public record UserViewAliasChoiceResponse(List<AliasChoice> aliasChoices) {
public static UserViewAliasChoiceResponse of(UserViewAliasChoiceResult result) {
List<AliasChoice> choices = result.aliasChoices().stream()
.map(ac -> new AliasChoice(
ac.aliasId(),
ac.aliasName(),
ac.categoryName(),
ac.imageUrl(),
Expand All @@ -20,7 +19,6 @@ public static UserViewAliasChoiceResponse of(UserViewAliasChoiceResult result) {
}

public record AliasChoice(
Long aliasId,
String aliasName,
String categoryName,
String imageUrl,
Expand Down
29 changes: 0 additions & 29 deletions src/main/java/konkuk/thip/user/adapter/out/mapper/AliasMapper.java

This file was deleted.

Loading