generated from semicolondsm/Semicolon_Repository_Generator
-
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.
Merge pull request #764 from Walkhub/763-fcm-bug
- Loading branch information
Showing
9 changed files
with
141 additions
and
55 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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/walkhub/walkhub/domain/notification/domain/TopicList.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,18 @@ | ||
package com.walkhub.walkhub.domain.notification.domain; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
public class TopicList { | ||
|
||
@EmbeddedId | ||
private TopicListId id; | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/walkhub/walkhub/domain/notification/domain/TopicListId.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,40 @@ | ||
package com.walkhub.walkhub.domain.notification.domain; | ||
|
||
import com.walkhub.walkhub.domain.user.domain.User; | ||
import lombok.*; | ||
import org.hibernate.annotations.ColumnDefault; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
import javax.persistence.*; | ||
import java.io.Serializable; | ||
|
||
@Getter | ||
@Builder | ||
@Embeddable | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@DynamicInsert | ||
@EqualsAndHashCode | ||
public class TopicListId implements Serializable { | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "topic_id", nullable = false) | ||
private Topic topic; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@ColumnDefault("0") | ||
@Column(nullable = false) | ||
private Boolean isSubscribe; | ||
|
||
public void subscribeTopic() { | ||
this.isSubscribe = true; | ||
} | ||
|
||
public void snSubscribeTopic() { | ||
this.isSubscribe = false; | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...n/java/com/walkhub/walkhub/domain/notification/domain/repository/TopicListRepository.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,16 @@ | ||
package com.walkhub.walkhub.domain.notification.domain.repository; | ||
|
||
import com.walkhub.walkhub.domain.notification.domain.TopicList; | ||
import com.walkhub.walkhub.domain.notification.domain.TopicListId; | ||
import com.walkhub.walkhub.domain.user.domain.User; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface TopicListRepository extends CrudRepository<TopicList, TopicListId> { | ||
|
||
@Query("select tl from TopicList tl join fetch tl.id.user") | ||
List<TopicList> findAllByIdUser(User user); | ||
|
||
} |
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