-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style: Response 패키지 위치 변경 (#64) * feat: 팔로잉 목록 조회 API 구현 (#64) * style: UserRepository 패키지 구조 변경 (#64)
- Loading branch information
Showing
14 changed files
with
120 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/listywave/user/application/domain/Follow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.listywave.user.application.domain; | ||
|
||
import com.listywave.common.BaseEntity; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Follow extends BaseEntity { | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "following_user_id") | ||
private User followingUser; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "follower_user_id") | ||
private User followerUser; | ||
} |
3 changes: 1 addition & 2 deletions
3
...on/dto/response/AllUserListsResponse.java → ...application/dto/AllUserListsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/listywave/user/application/dto/FollowingsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.listywave.user.application.dto; | ||
|
||
import com.listywave.user.application.domain.User; | ||
import java.util.List; | ||
import lombok.Builder; | ||
|
||
public record FollowingsResponse( | ||
List<FollowingUserInfo> followings | ||
) { | ||
|
||
public static FollowingsResponse of(List<User> users) { | ||
return new FollowingsResponse(FollowingUserInfo.toList(users)); | ||
} | ||
} | ||
|
||
@Builder | ||
record FollowingUserInfo( | ||
Long id, | ||
String nickname, | ||
String profileImageUrl | ||
) { | ||
|
||
public static List<FollowingUserInfo> toList(List<User> users) { | ||
return users.stream() | ||
.map(FollowingUserInfo::of) | ||
.toList(); | ||
} | ||
|
||
public static FollowingUserInfo of(User user) { | ||
return FollowingUserInfo.builder() | ||
.id(user.getId()) | ||
.nickname(user.getNickname()) | ||
.profileImageUrl(user.getProfileImageUrl()) | ||
.build(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/listywave/user/repository/follow/FollowRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.listywave.user.repository.follow; | ||
|
||
import com.listywave.user.application.domain.Follow; | ||
import com.listywave.user.application.domain.User; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface FollowRepository extends JpaRepository<Follow, Long> { | ||
|
||
List<Follow> getAllByFollowerUser(User user); | ||
} |
6 changes: 3 additions & 3 deletions
6
...ywave/user/repository/UserRepository.java → .../user/repository/user/UserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...pository/custom/UserRepositoryCustom.java → ...ory/user/custom/CustomUserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.listywave.user.repository.custom; | ||
package com.listywave.user.repository.user.custom; | ||
|
||
import com.listywave.list.application.domain.CategoryType; | ||
import com.listywave.list.application.domain.Lists; | ||
import java.util.List; | ||
|
||
public interface UserRepositoryCustom { | ||
public interface CustomUserRepository { | ||
|
||
List<Lists> findFeedLists(Long userId, String type, CategoryType category, Long cursorId, int size); | ||
} |
6 changes: 3 additions & 3 deletions
6
...itory/custom/impl/UserRepositoryImpl.java → ...custom/impl/CustomUserRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters