Skip to content

Commit

Permalink
strip User Details from submission
Browse files Browse the repository at this point in the history
  • Loading branch information
tcezard committed Jun 27, 2024
1 parent 722a8d2 commit e98b5a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import uk.ac.ebi.eva.submission.service.LsriTokenService;
import uk.ac.ebi.eva.submission.service.WebinTokenService;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class BaseController {
private final WebinTokenService webinTokenService;
Expand All @@ -35,6 +37,10 @@ public SubmissionAccount getSubmissionAccount(String bearerToken) {
return submissionAccount;
}

public List<Submission> stripUserDetails(List<Submission> submission){
return submission.stream().map(this::stripUserDetails).collect(Collectors.toList());
}

public Submission stripUserDetails(Submission submission) {
Submission responseSubmission = new Submission(submission.getSubmissionId());
responseSubmission.setStatus(submission.getStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ResponseEntity<?> markSubmissionStatus(@PathVariable("submissionId") Stri
public ResponseEntity<?> getSubmissionsbyStatus(@PathVariable("status") SubmissionStatus status) {
try {
ArrayList<Submission> submissions = (ArrayList<Submission>) submissionService.getSubmissionsByStatus(status);
return new ResponseEntity<>(submissions, HttpStatus.OK);
return new ResponseEntity<>(stripUserDetails(submissions), HttpStatus.OK);
} catch (SubmissionDoesNotExistException ex) {
return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_FOUND);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.ac.ebi.eva.submission.entity;

import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.lang.NonNull;

import javax.persistence.Column;
Expand Down Expand Up @@ -39,6 +40,7 @@ public SubmissionProcessing(String submissionId) {
private Integer priority;

@Column(nullable = false)
@UpdateTimestamp
private LocalDateTime lastUpdateTime;

public String getSubmissionId() {
Expand Down Expand Up @@ -76,10 +78,6 @@ public LocalDateTime getLastUpdateTime() {
return lastUpdateTime;
}

public void setLastUpdateTime(LocalDateTime lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down

0 comments on commit e98b5a6

Please sign in to comment.