-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add updateSpecimenType mutation (#7017)
* get initial wiring added * add update type and endpoint * add tests and move some error handling around * lint codegen file * update comment and switch error handling order * update error message * typo * typo v2 * fix code smells
- Loading branch information
Showing
9 changed files
with
176 additions
and
0 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
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/gov/cdc/usds/simplereport/api/model/UpdateSpecimenType.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,15 @@ | ||
package gov.cdc.usds.simplereport.api.model; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class UpdateSpecimenType { | ||
private final String name; | ||
private final String typeCode; | ||
private final String collectionLocationName; | ||
private final String collectionLocationCode; | ||
|
||
// can potentially add isDeleted here if needed in the future | ||
} |
28 changes: 28 additions & 0 deletions
28
...in/java/gov/cdc/usds/simplereport/api/model/errors/UnidentifiedSpecimenTypeException.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,28 @@ | ||
package gov.cdc.usds.simplereport.api.model.errors; | ||
|
||
import graphql.ErrorClassification; | ||
import graphql.ErrorType; | ||
import graphql.GraphQLError; | ||
import graphql.language.SourceLocation; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** Exception to throw when a specimen type code can't be found */ | ||
public class UnidentifiedSpecimenTypeException extends RuntimeException implements GraphQLError { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public UnidentifiedSpecimenTypeException(String typeCode) { | ||
super("Specimen with type code " + typeCode + " wasn't found. Make sure that type code exists"); | ||
} | ||
|
||
@Override // should-be-defaulted unused interface method | ||
public List<SourceLocation> getLocations() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public ErrorClassification getErrorType() { | ||
return ErrorType.ExecutionAborted; | ||
} | ||
} |
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
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