polishing the workspace migration

This commit is contained in:
2026-06-22 13:40:58 +02:00
parent caf4e4bc89
commit 598287b0cc
43 changed files with 730 additions and 167 deletions

View File

@@ -2,9 +2,8 @@ package zw.qantra.tm.domain.controllers;
import lombok.RequiredArgsConstructor;
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.domain.Like;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Or;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@@ -22,22 +21,23 @@ public class RecipientController {
private final RecipientService recipientService;
@GetMapping("/search")
public ResponseEntity<List<Recipient>> searchRecipients(
@GetMapping
public ResponseEntity searchRecipients(
@And({
@Spec(path = "name", spec = Equal.class),
@Spec(path = "email", spec = Equal.class),
@Spec(path = "phoneNumber", spec = Equal.class),
@Spec(path = "account", spec = Equal.class),
@Spec(path = "latestProviderLabel", spec = Equal.class),
@Spec(path = "userId", defaultVal = "null", spec = Equal.class)
}) Specification<Recipient> specification) {
return ResponseEntity.ok(recipientService.searchRecipients(specification));
@Spec(path = "userId", spec = Equal.class),
@Spec(path = "workspaceId", defaultVal = "null", spec = Equal.class)
}) Specification<Recipient> specification, Pageable pageable) {
return ResponseEntity.ok(recipientService.findAllRecipients(specification, pageable));
}
@GetMapping("/{account}/user/{userId}")
public ResponseEntity<Recipient> getRecipient(@PathVariable String account, @PathVariable String userId) {
List<Recipient> recipients = recipientService.getRecipient(account, userId);
@GetMapping("/{account}/workspace/{workspaceId}")
public ResponseEntity<Recipient> getRecipient(@PathVariable String account, @PathVariable UUID workspaceId) {
List<Recipient> recipients = recipientService.getRecipient(account, workspaceId);
if(recipients.size() > 0){
return ResponseEntity.ok(recipients.get(0));
}