Commit e7f3b6b
authored
[PM-26430] Remove Type property from PolicyRequestModel to use route parameter only (#6472)
* Enhance PolicyRequestModel and SavePolicyRequest with validation for policy data and metadata.
* Add integration tests for policy updates to validate handling of invalid data types in PolicyRequestModel and SavePolicyRequest.
* Add missing using
* Update PolicyRequestModel for null safety by making Data and ValidateAndSerializePolicyData nullable
* Add integration tests for public PoliciesController to validate handling of invalid data types in policy updates.
* Add PolicyDataValidator class for validating and serializing policy data and metadata based on policy type.
* Refactor PolicyRequestModel, SavePolicyRequest, and PolicyUpdateRequestModel to utilize PolicyDataValidator for data validation and serialization, removing redundant methods and improving code clarity.
* Update PolicyRequestModel and SavePolicyRequest to initialize Data and Metadata properties with empty dictionaries.
* Refactor PolicyDataValidator to remove null checks for input data in validation methods
* Rename test methods in SavePolicyRequestTests to reflect handling of empty data and metadata, and remove null assignments in test cases for improved clarity.
* Remove Type property from PolicyRequestModel to use route parameter only
* Run dotnet format
* Enhance error handling in PolicyDataValidator to include field-specific details in BadRequestException messages.
* Enhance PoliciesControllerTests to verify error messages for BadRequest responses by checking for specific field names in the response content.
* refactor: Update PolicyRequestModel and SavePolicyRequest to use nullable dictionaries for Data and Metadata properties; enhance validation methods in PolicyDataValidator to handle null cases.
* test: Add integration tests for handling policies with null data in PoliciesController
* fix: Catch specific JsonException in PolicyDataValidator to improve error handling
* test: Add unit tests for PolicyDataValidator to validate and serialize policy data and metadata
* test: Remove PolicyType from PolicyRequestModel in PoliciesControllerTests
* test: Update PolicyDataValidatorTests to validate organization data ownership metadata
* Refactor PoliciesControllerTests to include policy type in PutVNext method calls1 parent 7d39efe commit e7f3b6b
File tree
6 files changed
+30
-50
lines changed- src/Api/AdminConsole
- Controllers
- Models/Request
- test
- Api.IntegrationTest/AdminConsole/Controllers
- Api.Test
- AdminConsole/Models/Request
- Controllers
6 files changed
+30
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 212 | + | |
218 | 213 | | |
219 | 214 | | |
220 | 215 | | |
221 | 216 | | |
222 | | - | |
223 | 217 | | |
224 | 218 | | |
225 | 219 | | |
226 | | - | |
| 220 | + | |
227 | 221 | | |
228 | | - | |
| 222 | + | |
229 | 223 | | |
230 | 224 | | |
231 | 225 | | |
232 | 226 | | |
233 | 227 | | |
234 | 228 | | |
235 | 229 | | |
236 | | - | |
237 | 230 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | | - | |
| 16 | + | |
19 | 17 | | |
20 | | - | |
| 18 | + | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
25 | | - | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 0 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
151 | | - | |
152 | 150 | | |
153 | 151 | | |
154 | 152 | | |
| |||
218 | 216 | | |
219 | 217 | | |
220 | 218 | | |
221 | | - | |
222 | 219 | | |
223 | 220 | | |
224 | 221 | | |
| |||
244 | 241 | | |
245 | 242 | | |
246 | 243 | | |
247 | | - | |
248 | 244 | | |
249 | 245 | | |
250 | 246 | | |
| |||
267 | 263 | | |
268 | 264 | | |
269 | 265 | | |
270 | | - | |
271 | 266 | | |
272 | 267 | | |
273 | 268 | | |
| |||
292 | 287 | | |
293 | 288 | | |
294 | 289 | | |
295 | | - | |
296 | 290 | | |
297 | 291 | | |
298 | 292 | | |
| |||
321 | 315 | | |
322 | 316 | | |
323 | 317 | | |
324 | | - | |
325 | 318 | | |
326 | 319 | | |
327 | 320 | | |
| |||
347 | 340 | | |
348 | 341 | | |
349 | 342 | | |
350 | | - | |
351 | 343 | | |
352 | 344 | | |
353 | 345 | | |
| |||
371 | 363 | | |
372 | 364 | | |
373 | 365 | | |
374 | | - | |
375 | 366 | | |
376 | 367 | | |
377 | 368 | | |
| |||
393 | 384 | | |
394 | 385 | | |
395 | 386 | | |
396 | | - | |
397 | 387 | | |
398 | 388 | | |
399 | 389 | | |
| |||
Lines changed: 16 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
163 | | - | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | 201 | | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
206 | 205 | | |
207 | 206 | | |
208 | 207 | | |
209 | | - | |
| 208 | + | |
210 | 209 | | |
211 | 210 | | |
212 | 211 | | |
| |||
234 | 233 | | |
235 | 234 | | |
236 | 235 | | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
242 | 241 | | |
243 | 242 | | |
244 | 243 | | |
| |||
248 | 247 | | |
249 | 248 | | |
250 | 249 | | |
251 | | - | |
| 250 | + | |
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
| |||
266 | 265 | | |
267 | 266 | | |
268 | 267 | | |
269 | | - | |
| 268 | + | |
270 | 269 | | |
271 | 270 | | |
272 | 271 | | |
273 | 272 | | |
274 | | - | |
275 | 273 | | |
276 | 274 | | |
277 | 275 | | |
278 | 276 | | |
279 | 277 | | |
280 | 278 | | |
281 | | - | |
| 279 | + | |
282 | 280 | | |
283 | 281 | | |
284 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| |||
0 commit comments