This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* * added /pocnat endpoints and converted results for /app * * fixed checkstyle * * added tests for PoC-NAT * * added test coverage * * removed some code smells
- Loading branch information
Showing
9 changed files
with
499 additions
and
22 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
77 changes: 77 additions & 0 deletions
77
src/main/java/app/coronawarn/testresult/model/PocNatResult.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,77 @@ | ||
/* | ||
* Corona-Warn-App / cwa-testresult-server | ||
* | ||
* (C) 2020, T-Systems International GmbH | ||
* | ||
* Deutsche Telekom AG and all other contributors / | ||
* copyright owners license this file to you under the Apache | ||
* License, Version 2.0 (the "License"); you may not use this | ||
* file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package app.coronawarn.testresult.model; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import javax.validation.constraints.Max; | ||
import javax.validation.constraints.Min; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Pattern; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.experimental.Accessors; | ||
|
||
/** | ||
* Model of the test result. | ||
*/ | ||
@Schema( | ||
description = "The PoC-NAT result model." | ||
) | ||
@Getter | ||
@Setter | ||
@ToString | ||
@EqualsAndHashCode | ||
@Accessors(chain = true) | ||
public class PocNatResult { | ||
|
||
/** | ||
* Hash (SHA256) of test result id (aka QR-Code, GUID) encoded as hex string. | ||
*/ | ||
@NotBlank | ||
@Pattern(regexp = "^[XxA-Fa-f0-9]([A-Fa-f0-9]{63})$") | ||
@Schema(description = "the testId (Hashed GUID") | ||
private String id; | ||
|
||
/** | ||
* The test result. | ||
* 10: PoC-NAT-Pending | ||
* 11: PoC-NAT-Negative | ||
* 12: PoC-NAT-Positive | ||
* 13: PoC-NAT-Invalid | ||
* 14: PoC-NAT-Redeemed | ||
*/ | ||
@Min(10) | ||
@Max(14) | ||
@NotNull | ||
@Schema(description = "the result of the PoC-NAT", required = true) | ||
private Integer result; | ||
|
||
/** | ||
* Timestamp of the SampleCollection (sc). | ||
*/ | ||
@Schema(description = "the timestamp of the sample collection (sc) in unix epoch format. If not set," | ||
+ " the time of insertion will be used instead") | ||
private Long sc; | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/app/coronawarn/testresult/model/PocNatResultList.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,67 @@ | ||
/* | ||
* Corona-Warn-App / cwa-testresult-server | ||
* | ||
* (C) 2020, T-Systems International GmbH | ||
* | ||
* Deutsche Telekom AG and all other contributors / | ||
* copyright owners license this file to you under the Apache | ||
* License, Version 2.0 (the "License"); you may not use this | ||
* file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package app.coronawarn.testresult.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.NotNull; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.experimental.Accessors; | ||
|
||
|
||
|
||
/** | ||
* Model of the test result list. | ||
*/ | ||
@Schema( | ||
description = "The PoC-NAT result list model." | ||
) | ||
@Getter | ||
@Setter | ||
@ToString | ||
@EqualsAndHashCode | ||
@Accessors(chain = true) | ||
public class PocNatResultList { | ||
|
||
/** | ||
* The test result entries. | ||
*/ | ||
@NotNull | ||
@NotEmpty | ||
@Schema(description = "array of PoC-NAT results", required = true) | ||
private List<@Valid PocNatResult> testResults; | ||
|
||
/** | ||
* The labId of the uploader. | ||
*/ | ||
@Schema(description = "The id that identifies a lab. Every lab can choose its own labid, " | ||
+ "but it must be unique over all labs, should be generated once via cryptographic hash function", | ||
required = true, maxLength = 64) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
private String labId; | ||
} |
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,7 @@ | ||
package app.coronawarn.testresult.model; | ||
|
||
public enum TestType { | ||
PCR, | ||
QUICKTEST, | ||
POCNAT | ||
} |
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.