This repository has been archived by the owner on Jun 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/232-exposure-contacts
- Loading branch information
Showing
27 changed files
with
698 additions
and
46 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
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
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
59 changes: 59 additions & 0 deletions
59
server/src/main/java/de/coronavirus/imis/api/IncidentController.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,59 @@ | ||
package de.coronavirus.imis.api; | ||
|
||
/* | ||
To ease migration, incidents are currently automatically created when | ||
- Creating Tests | ||
- Updating Tests | ||
- Sending to Quarantine | ||
- Creating Patients (equivalent to Initial Patient Event) | ||
- Scheduling appointments (implemented, not tested. Could not find frontend feature) | ||
*/ | ||
|
||
import de.coronavirus.imis.domain.Incident; | ||
import de.coronavirus.imis.domain.IncidentType; | ||
import de.coronavirus.imis.services.IncidentService; | ||
import lombok.AllArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/api/incidents") | ||
@AllArgsConstructor | ||
public class IncidentController { | ||
|
||
private final IncidentService incidentService; | ||
|
||
@GetMapping("/{id}") | ||
public Incident getIncident(@PathVariable("id") String incidentId) { | ||
return incidentService.getCurrent(incidentId); | ||
} | ||
|
||
@GetMapping("/{id}/log") | ||
public List<Incident> getLog(@PathVariable("id") String incidentId) { | ||
return incidentService.getLog(incidentId, false); | ||
} | ||
|
||
@GetMapping("/patient/{id}") | ||
public List<Incident> getPatientCurrent(@PathVariable("id") String patientId) { | ||
return incidentService.getCurrentByPatient(patientId); | ||
} | ||
|
||
@GetMapping("/{type}/patient/{id}") | ||
public List<Incident> getPatientCurrentByType(@PathVariable("type") IncidentType incidentType, @PathVariable("id") String patientId) { | ||
return incidentService.getCurrentByPatient(patientId, incidentType); | ||
} | ||
|
||
@GetMapping("/patient/{id}/log") | ||
public List<Incident> getPatientLog(@PathVariable("id") String patientId) { | ||
return incidentService.getLog(patientId, true); | ||
} | ||
|
||
@GetMapping("/{type}/patient/{id}/log") | ||
public List<Incident> getPatientLogByType(@PathVariable("type") IncidentType incidentType, @PathVariable("id") String patientId) { | ||
return incidentService.getLog(incidentType.IMPLEMENTATION, patientId, true); | ||
} | ||
|
||
} |
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
12 changes: 0 additions & 12 deletions
12
server/src/main/java/de/coronavirus/imis/api/dto/UpdateLabTestDTO.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
server/src/main/java/de/coronavirus/imis/config/AuditConfiguration.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,24 @@ | ||
package de.coronavirus.imis.config; | ||
|
||
import org.hibernate.envers.AuditReader; | ||
import org.hibernate.envers.AuditReaderFactory; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.persistence.EntityManagerFactory; | ||
|
||
|
||
@Configuration | ||
public class AuditConfiguration { | ||
|
||
private final EntityManagerFactory entityManagerFactory; | ||
|
||
AuditConfiguration(EntityManagerFactory entityManagerFactory) { | ||
this.entityManagerFactory = entityManagerFactory; | ||
} | ||
|
||
@Bean | ||
AuditReader auditReader() { | ||
return AuditReaderFactory.get(entityManagerFactory.createEntityManager()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
server/src/main/java/de/coronavirus/imis/config/AuditorAwareImpl.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,25 @@ | ||
package de.coronavirus.imis.config; | ||
|
||
import de.coronavirus.imis.config.domain.User; | ||
import org.springframework.data.domain.AuditorAware; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
|
||
import java.util.Optional; | ||
|
||
public class AuditorAwareImpl implements AuditorAware<User> { | ||
@Override | ||
public Optional<User> getCurrentAuditor() { | ||
|
||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
|
||
if(authentication != null && SecurityContextHolder.getContext().getAuthentication().isAuthenticated()) | ||
{ | ||
var user = (User) authentication.getPrincipal(); | ||
Optional<User> opt = Optional.of(user); | ||
return opt; | ||
} | ||
|
||
return Optional.empty(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
server/src/main/java/de/coronavirus/imis/config/PersistanceConfig.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,27 @@ | ||
package de.coronavirus.imis.config; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import de.coronavirus.imis.config.domain.User; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.domain.AuditorAware; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
@Configuration | ||
@EnableTransactionManagement | ||
@EnableJpaAuditing (auditorAwareRef = "auditorAware") | ||
class PersistenceConfig { | ||
|
||
@Bean | ||
public AuditorAware<User> auditorAware() { | ||
return new AuditorAwareImpl(); | ||
} | ||
|
||
@Bean | ||
public ObjectMapper objectMapper() { | ||
return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); | ||
} | ||
|
||
} |
Oops, something went wrong.