-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(follow): Follow 객체 생성 * refactor(follow): Follow 영속화 * refactor(follow): Followers 제거 * refactor(follow): 트랜잭션 지정
- Loading branch information
Showing
5 changed files
with
58 additions
and
113 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/demo/feedsystemdesign/follow/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,27 @@ | ||
package com.demo.feedsystemdesign.follow.domain; | ||
|
||
import com.demo.feedsystemdesign.common.BaseTimeEntity; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Follow extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "follow_id") | ||
private Long id; | ||
|
||
private long sourceId; | ||
private long targetId; | ||
|
||
public Follow(long sourceId, long targetId) { | ||
this.sourceId = sourceId; | ||
this.targetId = targetId; | ||
} | ||
|
||
} | ||
|
13 changes: 13 additions & 0 deletions
13
src/main/java/com/demo/feedsystemdesign/follow/domain/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,13 @@ | ||
package com.demo.feedsystemdesign.follow.domain; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface FollowRepository extends JpaRepository<Follow, Long> { | ||
List<Follow> findAllByTargetId(Long targetId); | ||
|
||
List<Follow> findAllBySourceId(Long sourceId); | ||
} |
42 changes: 0 additions & 42 deletions
42
src/main/java/com/demo/feedsystemdesign/follow/domain/Followers.java
This file was deleted.
Oops, something went wrong.
38 changes: 18 additions & 20 deletions
38
src/main/java/com/demo/feedsystemdesign/follow/service/FollowService.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
51 changes: 0 additions & 51 deletions
51
src/test/java/com/demo/feedsystemdesign/follow/domain/FollowersTest.java
This file was deleted.
Oops, something went wrong.