-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/java/org/highmed/numportal/domain/dto/QueryDto.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,11 @@ | ||
package org.highmed.numportal.domain.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Schema | ||
public class QueryDto { | ||
@NotNull private String aql; | ||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/org/highmed/numportal/web/controller/QueryController.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,39 @@ | ||
package org.highmed.numportal.web.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import jakarta.validation.Valid; | ||
import lombok.AllArgsConstructor; | ||
import org.ehrbase.openehr.sdk.response.dto.QueryResponseData; | ||
import org.highmed.numportal.domain.dto.QueryDto; | ||
import org.highmed.numportal.service.ehrbase.EhrBaseService; | ||
import org.highmed.numportal.service.logger.AuditLog; | ||
import org.highmed.numportal.web.config.Role; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@AllArgsConstructor | ||
@RequestMapping(value = "/query", produces = "application/json") | ||
@SecurityRequirement(name = "security_auth") | ||
@ConditionalOnProperty(value = "feature.search-with-aql", havingValue = "true") | ||
public class QueryController { | ||
|
||
private final EhrBaseService ehrBaseService; | ||
|
||
@AuditLog | ||
@PostMapping("execute") | ||
@Operation(description = "Executes an AQL query") | ||
@PreAuthorize(Role.MANAGER) | ||
public ResponseEntity<QueryResponseData> executeManagerProject( | ||
@RequestBody @Valid QueryDto queryDto) { | ||
return ResponseEntity.ok( | ||
ehrBaseService.executePlainQuery(queryDto.getAql()) | ||
); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -107,3 +107,4 @@ user-service: | |
delete-users-cron: 0 0 5 * * * | ||
|
||
feature: | ||
search-with-aql: off |