Skip to content

Commit

Permalink
updated: TopicRepository.findByIdAndScopeNotDeleted method and TopicS…
Browse files Browse the repository at this point in the history
…ervice.getTopic
  • Loading branch information
Vladik-gif committed Sep 27, 2024
1 parent 277f34a commit e800da4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface TopicRepository extends JpaRepository<Topic, UUID> {
Optional<Topic> findByName(@Param("name") String name);

@Query(value = "SELECT t FROM Topic t Where t.id = :id and t.scope != 'DELETED'")
Optional<Topic> findById(@Param("id") UUID id);
Optional<Topic> findByIdAndScopeNotDeleted(@Param("id") UUID id);

@Query(value = """
SELECT t FROM Topic t JOIN FETCH t.topicSubscribers s
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/chat/yourway/service/TopicService.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public Topic save(Topic topic) {

public Topic getTopic(UUID topicId) {
return topicRepository
.findById(topicId)
.findByIdAndScopeNotDeleted(topicId)
.orElseThrow(
() -> {
log.warn("Topic id: {} wasn't found", topicId);
Expand Down

0 comments on commit e800da4

Please sign in to comment.