-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add mjr endpoint * serialize json * code review * Trivy * Sonar coverage
- Loading branch information
Showing
14 changed files
with
554 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,4 @@ | ||
# Date: June 16, 2023 | ||
# Issue: snappy-java high issue, https://www.cvedetails.com/cve/CVE-2023-34453/ | ||
# Solution: Spring needs to update its version of kafka | ||
# CVE-2023-34455 | ||
|
||
# Date: August 24, 2023 | ||
# Issue: snappy-java used by kafka, which is used by spring-kafka | ||
# Solution: Spring needs to update its version of kafka | ||
# CVE-2023-34453 | ||
# CVE-2023-34454 | ||
|
||
# Date: August 25 | ||
# Manually set kafka version to 3.5.1. This version addresses the above CVEs | ||
# Should remove this property once spring-kafka updates | ||
|
||
# Date: November 14, 2023 | ||
# Issue: openssl: Incorrect cipher key and IV length processing https://avd.aquasec.com/nvd/cve-2023-5363 | ||
# Solution: Docker image needs an update | ||
CVE-2023-5363 |
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
56 changes: 56 additions & 0 deletions
56
src/main/java/eu/dissco/backend/controller/MasJobRecordController.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,56 @@ | ||
package eu.dissco.backend.controller; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import eu.dissco.backend.domain.AnnotationState; | ||
import eu.dissco.backend.domain.jsonapi.JsonApiListResponseWrapper; | ||
import eu.dissco.backend.domain.jsonapi.JsonApiWrapper; | ||
import eu.dissco.backend.exceptions.NotFoundException; | ||
import eu.dissco.backend.properties.ApplicationProperties; | ||
import eu.dissco.backend.service.MasJobRecordService; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import java.util.UUID; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@Slf4j | ||
@RestControllerAdvice | ||
@RestController | ||
@RequestMapping("api/v1/mjr") | ||
public class MasJobRecordController extends BaseController { | ||
|
||
private final MasJobRecordService service; | ||
|
||
public MasJobRecordController(ObjectMapper mapper, | ||
ApplicationProperties applicationProperties, MasJobRecordService service) { | ||
super(mapper, applicationProperties); | ||
this.service = service; | ||
} | ||
|
||
@GetMapping(value = "/{jobId}", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<JsonApiWrapper> getMasJobRecord( | ||
@PathVariable("jobId") UUID jobId, HttpServletRequest request) throws NotFoundException { | ||
return ResponseEntity.ok().body(service.getMasJobRecordById(jobId, getPath(request))); | ||
} | ||
|
||
@GetMapping(value = "/creator/" | ||
+ "{creatorId}", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<JsonApiListResponseWrapper> getMasJobRecordsForCreator( | ||
@PathVariable("creatorId") String creatorId, | ||
@RequestParam(defaultValue = DEFAULT_PAGE_NUM) int pageNumber, | ||
@RequestParam(defaultValue = DEFAULT_PAGE_SIZE) int pageSize, | ||
@RequestParam(required = false) AnnotationState state, | ||
HttpServletRequest request) { | ||
return ResponseEntity.ok().body( | ||
service.getMasJobRecordsByCreator(creatorId, getPath(request), pageNumber, pageSize, | ||
state)); | ||
|
||
} | ||
|
||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/eu/dissco/backend/domain/MasJobRecordFull.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,17 @@ | ||
package eu.dissco.backend.domain; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import java.time.Instant; | ||
import java.util.UUID; | ||
|
||
public record MasJobRecordFull( | ||
AnnotationState state, | ||
String creatorId, | ||
String targetId, | ||
UUID jobId, | ||
Instant timeStarted, | ||
Instant timeCompleted, | ||
JsonNode annotations | ||
) { | ||
|
||
} |
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
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.