-
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.
- Loading branch information
1 parent
aeafd1d
commit 1d9a07a
Showing
35 changed files
with
195 additions
and
181 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
2 changes: 1 addition & 1 deletion
2
...s/usermanagement/domain/Organization.java → ...k/modules/collab/domain/Organization.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: 3 additions & 1 deletion
4
...k/modules/usermanagement/domain/Team.java → .../flexwork/modules/collab/domain/Team.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
2 changes: 1 addition & 1 deletion
2
...dules/usermanagement/domain/TeamRole.java → ...xwork/modules/collab/domain/TeamRole.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
7 changes: 4 additions & 3 deletions
7
...les/crm/repository/CommentRepository.java → .../collab/repository/CommentRepository.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,11 +1,12 @@ | ||
package io.flexwork.modules.crm.repository; | ||
package io.flexwork.modules.collab.repository; | ||
|
||
import io.flexwork.modules.crm.domain.Comment; | ||
import io.flexwork.modules.collab.domain.Comment; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CommentRepository extends JpaRepository<Comment, Long> { | ||
List<Comment> findByEntityTypeAndEntityId(Comment.EntityType entityType, Long entityId); | ||
|
||
List<Comment> findByEntityTypeAndEntityId(String entityType, Long entityId); | ||
} |
4 changes: 2 additions & 2 deletions
4
...nt/repository/OrganizationRepository.java → ...ab/repository/OrganizationRepository.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
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
...gement/repository/TeamRoleRepository.java → ...collab/repository/TeamRoleRepository.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
40 changes: 40 additions & 0 deletions
40
server/src/main/java/io/flexwork/modules/collab/service/CommentService.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 io.flexwork.modules.collab.service; | ||
|
||
import io.flexwork.modules.collab.domain.Comment; | ||
import io.flexwork.modules.collab.repository.CommentRepository; | ||
import jakarta.transaction.Transactional; | ||
import java.util.List; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Transactional | ||
public class CommentService { | ||
|
||
private final CommentRepository commentRepository; | ||
|
||
public CommentService(CommentRepository commentRepository) { | ||
this.commentRepository = commentRepository; | ||
} | ||
|
||
public Comment saveComment(Comment comment) { | ||
return commentRepository.save(comment); | ||
} | ||
|
||
public Comment getCommentById(Long id) { | ||
return commentRepository | ||
.findById(id) | ||
.orElseThrow( | ||
() -> new IllegalArgumentException("Comment not found with id: " + id)); | ||
} | ||
|
||
public List<Comment> getCommentsForEntity(String entityType, Long entityId) { | ||
return commentRepository.findByEntityTypeAndEntityId(entityType, entityId); | ||
} | ||
|
||
public void deleteComment(Long id) { | ||
if (!commentRepository.existsById(id)) { | ||
throw new IllegalArgumentException("Comment not found with id: " + id); | ||
} | ||
commentRepository.deleteById(id); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...s/usermanagement/service/MailService.java → ...k/modules/collab/service/MailService.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
6 changes: 3 additions & 3 deletions
6
...nagement/service/OrganizationService.java → ...s/collab/service/OrganizationService.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
14 changes: 7 additions & 7 deletions
14
...s/usermanagement/service/TeamService.java → ...k/modules/collab/service/TeamService.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
2 changes: 1 addition & 1 deletion
2
...nagement/service/dto/OrganizationDTO.java → ...s/collab/service/dto/OrganizationDTO.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
2 changes: 1 addition & 1 deletion
2
...s/usermanagement/service/dto/TeamDTO.java → ...k/modules/collab/service/dto/TeamDTO.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
10 changes: 5 additions & 5 deletions
10
...nt/service/mapper/OrganizationMapper.java → ...ab/service/mapper/OrganizationMapper.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
8 changes: 4 additions & 4 deletions
8
...management/service/mapper/TeamMapper.java → ...les/collab/service/mapper/TeamMapper.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
46 changes: 46 additions & 0 deletions
46
server/src/main/java/io/flexwork/modules/collab/web/rest/CommentController.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,46 @@ | ||
package io.flexwork.modules.collab.web.rest; | ||
|
||
import io.flexwork.modules.collab.domain.Comment; | ||
import io.flexwork.modules.collab.service.CommentService; | ||
import java.util.List; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/comments") | ||
public class CommentController { | ||
|
||
private final CommentService commentService; | ||
|
||
public CommentController(CommentService commentService) { | ||
this.commentService = commentService; | ||
} | ||
|
||
@PostMapping | ||
public ResponseEntity<Comment> saveComment(@RequestBody Comment comment) { | ||
Comment savedComment = commentService.saveComment(comment); | ||
return ResponseEntity.ok(savedComment); | ||
} | ||
|
||
// Get a Comment by ID | ||
@GetMapping("/{id}") | ||
public ResponseEntity<Comment> getCommentById(@PathVariable Long id) { | ||
Comment comment = commentService.getCommentById(id); | ||
return ResponseEntity.ok(comment); | ||
} | ||
|
||
// Get Comments for an Entity | ||
@GetMapping | ||
public ResponseEntity<List<Comment>> getCommentsForEntity( | ||
@RequestParam String entityType, @RequestParam Long entityId) { | ||
List<Comment> comments = commentService.getCommentsForEntity(entityType, entityId); | ||
return ResponseEntity.ok(comments); | ||
} | ||
|
||
// Delete a Comment | ||
@DeleteMapping("/{id}") | ||
public ResponseEntity<Void> deleteComment(@PathVariable Long id) { | ||
commentService.deleteComment(id); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
...ment/web/rest/OrganizationController.java → ...llab/web/rest/OrganizationController.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
8 changes: 4 additions & 4 deletions
8
...ermanagement/web/rest/TeamController.java → ...dules/collab/web/rest/TeamController.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
Oops, something went wrong.