RED-9393 user stats controller
added filter for soft deleted dossiers
This commit is contained in:
parent
0d7b57dd6a
commit
0d3e3051ab
@ -8,6 +8,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.acl.custom.dossier.DossierACLService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.DossierService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.users.UserService;
|
||||
@ -32,13 +33,14 @@ public class UserStatsController implements UserStatsResource {
|
||||
public ResponseEntity<UserStats> getUserStats(String userId) {
|
||||
|
||||
if (userService.getUserById(userId).isEmpty()) {
|
||||
return new ResponseEntity(null, HttpStatus.NOT_FOUND);
|
||||
throw new NotFoundException(String.format("The user with id %s is not found.", userId));
|
||||
}
|
||||
List<String> dossierMemberships = new ArrayList<>();
|
||||
List<String> dossierOwnerships = new ArrayList<>();
|
||||
dossierService.getAllDossiers()
|
||||
.stream()
|
||||
.filter(dossierEntity -> dossierEntity.getHardDeletedTime() == null)
|
||||
.filter(dossierEntity -> dossierEntity.getSoftDeletedTime() == null)
|
||||
.forEach(d -> {
|
||||
if (dossierACLService.getMembers(d.getId()).contains(userId)) {
|
||||
dossierMemberships.add(d.getId());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user