Skip to content

Commit 82b909a

Browse files
committed
fix: report validation second solution
1 parent 342a750 commit 82b909a

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

accounting_reporting_core/src/main/java/org/cardanofoundation/lob/app/accounting_reporting_core/domain/entity/report/ReportEntity.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ public boolean isValid() {
255255
}
256256

257257
public void setPeriod(Optional<@Min(1) @Max(12) Short> period) {
258-
if (this.intervalType.equals(IntervalType.YEAR)) {
259-
this.period = null;
260-
return;
261-
}
262258
this.period = period.orElse(null);
263259
}
264260

blockchain_common/src/main/resources/api3_lob_blockchain_transaction_metadata_schema.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"enum": ["YEAR", "MONTH", "QUARTER"]
7272
},
7373
"period": {
74-
"type": ["integer", "null"],
74+
"type": ["integer"],
7575
"minimum": 1,
7676
"maximum": 12
7777
},
@@ -98,21 +98,38 @@
9898
}
9999
},
100100
"then": {
101-
"not": {
102-
"required": ["period"]
101+
"required": ["period"],
102+
"properties": {
103+
"period": {"const": 1}
103104
}
104105
}
105106
},
106107
{
107108
"if": {
108109
"properties": {
109110
"interval": {
110-
"enum": ["MONTH", "QUARTER"]
111+
"const": "QUARTER"
111112
}
112113
}
113114
},
114115
"then": {
115-
"required": ["period"]
116+
"required": ["period"],
117+
"properties": {
118+
"period": {
119+
"type": ["integer"],
120+
"minimum": 1,
121+
"maximum": 4
122+
}
123+
}
124+
}
125+
},
126+
{
127+
"if": {
128+
"properties": {
129+
"interval": {
130+
"enum": ["MONTH", "QUARTER"]
131+
}
132+
}
116133
}
117134
},
118135
{

blockchain_common/src/test/resources/api3_test_transactions_valid_bs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"results_carried_forward": "300000.00"
4343
}
4444
},
45+
"period": 1,
4546
"type": "REPORT",
4647
"subType": "BALANCE_SHEET",
4748
"interval": "YEAR",

blockchain_common/src/test/resources/api3_test_transactions_valid_is.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
},
4242
"profit_for_the_year": "3000000.00"
4343
},
44+
"period": 1,
4445
"type": "REPORT",
4546
"subType": "INCOME_STATEMENT",
4647
"interval": "YEAR",

0 commit comments

Comments
 (0)