summaryrefslogtreecommitdiff
path: root/src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@skas.io>2024-07-25 20:36:11 +1000
committerSzymon Szukalski <szymon@skas.io>2024-07-25 20:36:11 +1000
commitaa9bdd514ab90d0da0391b879255a22c29450e9a (patch)
tree9ddd1de0ab7e376ead06f55bdb32a6190d3647d5 /src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java
parentec81d98e90f9fdb4dd12138a365fbbbb3a8efa5f (diff)
Validate import payload and return create/update stats
- Add validation to /import payload - Move import logic to service bean - Track whether entities have been created or update - Report number of created and updated entities as return value for the import endpoint - Add some test coverage to exercise the validators
Diffstat (limited to 'src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java')
-rw-r--r--src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java b/src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java
new file mode 100644
index 0000000..8613865
--- /dev/null
+++ b/src/main/java/com/stileeducation/markr/dto/ImportResponseDTO.java
@@ -0,0 +1,115 @@
+package com.stileeducation.markr.dto;
+
+public class ImportResponseDTO {
+
+ private String status;
+ private String message;
+ private ImportData data;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ImportData getData() {
+ return data;
+ }
+
+ public void setData(ImportData data) {
+ this.data = data;
+ }
+
+ public static class ImportData {
+ private int studentsCreated = 0;
+ private int studentsUpdated = 0;
+
+ private int testsCreated = 0;
+ private int testsUpdated = 0;
+
+ private int testResultsCreated = 0;
+ private int testResultsUpdated = 0;
+
+ public int getStudentsCreated() {
+ return studentsCreated;
+ }
+
+ public void setStudentsCreated(int studentsCreated) {
+ this.studentsCreated = studentsCreated;
+ }
+
+ public int getStudentsUpdated() {
+ return studentsUpdated;
+ }
+
+ public void setStudentsUpdated(int studentsUpdated) {
+ this.studentsUpdated = studentsUpdated;
+ }
+
+ public int getTestsCreated() {
+ return testsCreated;
+ }
+
+ public void setTestsCreated(int testsCreated) {
+ this.testsCreated = testsCreated;
+ }
+
+ public int getTestsUpdated() {
+ return testsUpdated;
+ }
+
+ public void setTestsUpdated(int testsUpdated) {
+ this.testsUpdated = testsUpdated;
+ }
+
+ public int getTestResultsCreated() {
+ return testResultsCreated;
+ }
+
+ public void setTestResultsCreated(int testResultsCreated) {
+ this.testResultsCreated = testResultsCreated;
+ }
+
+ public int getTestResultsUpdated() {
+ return testResultsUpdated;
+ }
+
+ public void setTestResultsUpdated(int testResultsUpdated) {
+ this.testResultsUpdated = testResultsUpdated;
+ }
+
+ public void incrementStudentsCreated() {
+ this.studentsCreated++;
+ }
+
+ public void incrementStudentsUpdated() {
+ this.studentsUpdated++;
+ }
+
+ public void incrementTestsCreated() {
+ this.testsCreated++;
+ }
+
+ public void incrementTestsUpdated() {
+ this.testsUpdated++;
+ }
+
+ public void incrementTestResultsCreated() {
+ this.testResultsCreated++;
+ }
+
+ public void incrementTestResultsUpdated() {
+ this.testResultsUpdated++;
+ }
+ }
+}