Commit 2e99c6d
committed
LEGLINK-820: Delete reporting plans as a set rather than a row at a time
DeleteAllAsync and DeleteForFacilityAsync loaded every matching plan into the
change tracker and issued one DELETE per row. The table grows by a row per
facility, measure mapping and month, so once the sync stories populate it those
two endpoints would hold the whole table in memory and send a statement per row.
The repository gains ExecuteDeleteAsync, which deletes by predicate in a single
statement and returns the number of rows removed. It does not load or track the
rows, so it takes no part in a pending SaveChanges - which suits these two
actions, where the delete is the whole request.
DeleteForFacilityAsync now logs the rows the database actually removed instead of
a count taken before the delete.
The manager tests assert that GetAllAsync, FindAsync and Remove are no longer
called, so the load-then-delete pattern cannot return unnoticed, and that the
by-facility predicate matches only that facility rather than clearing the table.
Update also compares the two ids after the same normalization. The url id was
sanitized and the body id was not, so a client sending the identical raw string
in both places could be told they did not match.
The module registers AddHttpClient itself. Its fallback facility lookup resolves
IHttpClientFactory, which happened to work only because the Tenant host asks for
one; a host that did not would fail to resolve the service.
Claude-Session: https://claude.ai/code/session_0135KKpfA98BKzyQAsGS5kmg1 parent 8f4ab51 commit 2e99c6d
6 files changed
Lines changed: 44 additions & 48 deletions
File tree
- DotNet
- DMRP
- Business/Managers
- Controllers
- DependencyInjection
- ServiceTests/UnitTests/DMRP
Lines changed: 6 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 149 | + | |
152 | 150 | | |
153 | 151 | | |
154 | 152 | | |
| |||
160 | 158 | | |
161 | 159 | | |
162 | 160 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 161 | + | |
182 | 162 | | |
183 | | - | |
| 163 | + | |
| 164 | + | |
184 | 165 | | |
185 | | - | |
| 166 | + | |
186 | 167 | | |
187 | 168 | | |
188 | 169 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
225 | 227 | | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
229 | | - | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
Lines changed: 18 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
| 324 | + | |
| 325 | + | |
328 | 326 | | |
329 | 327 | | |
330 | 328 | | |
331 | 329 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 330 | + | |
| 331 | + | |
338 | 332 | | |
339 | 333 | | |
340 | 334 | | |
341 | | - | |
| 335 | + | |
342 | 336 | | |
343 | | - | |
344 | | - | |
| 337 | + | |
| 338 | + | |
345 | 339 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 340 | + | |
350 | 341 | | |
351 | 342 | | |
352 | 343 | | |
353 | 344 | | |
354 | 345 | | |
355 | | - | |
| 346 | + | |
356 | 347 | | |
357 | | - | |
358 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
359 | 351 | | |
360 | 352 | | |
361 | 353 | | |
362 | 354 | | |
363 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
364 | 361 | | |
365 | 362 | | |
366 | 363 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
0 commit comments