Skip to content

Commit

Permalink
fix: report validation second solution
Browse files Browse the repository at this point in the history
  • Loading branch information
M4rc0Russ0 committed Mar 3, 2025
1 parent 342a750 commit 82b909a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ public boolean isValid() {
}

public void setPeriod(Optional<@Min(1) @Max(12) Short> period) {
if (this.intervalType.equals(IntervalType.YEAR)) {
this.period = null;
return;
}
this.period = period.orElse(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"enum": ["YEAR", "MONTH", "QUARTER"]
},
"period": {
"type": ["integer", "null"],
"type": ["integer"],
"minimum": 1,
"maximum": 12
},
Expand All @@ -98,21 +98,38 @@
}
},
"then": {
"not": {
"required": ["period"]
"required": ["period"],
"properties": {
"period": {"const": 1}
}
}
},
{
"if": {
"properties": {
"interval": {
"enum": ["MONTH", "QUARTER"]
"const": "QUARTER"
}
}
},
"then": {
"required": ["period"]
"required": ["period"],
"properties": {
"period": {
"type": ["integer"],
"minimum": 1,
"maximum": 4
}
}
}
},
{
"if": {
"properties": {
"interval": {
"enum": ["MONTH", "QUARTER"]
}
}
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"results_carried_forward": "300000.00"
}
},
"period": 1,
"type": "REPORT",
"subType": "BALANCE_SHEET",
"interval": "YEAR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
},
"profit_for_the_year": "3000000.00"
},
"period": 1,
"type": "REPORT",
"subType": "INCOME_STATEMENT",
"interval": "YEAR",
Expand Down

0 comments on commit 82b909a

Please sign in to comment.