Commit 39fa181
authored
Ensure collection safety on /catalogs route (#562)
**Related Issue(s):**
- None
**Description:**
This PR implements a **"Safety-First" deletion policy** for the Catalogs
Extension. It fundamentally changes the behavior of `DELETE` operations
to strictly separate **Organization** (Catalogs) from **Content**
(Collections). Deleting a catalog now "disbands" the group but **never
destroys the underlying data**, preventing accidental loss of large
datasets.
#### Key Changes:
#### 1. Safety Architecture ("Unlink & Adopt")
* **Safe Catalog Deletion**: `DELETE /catalogs/{id}` now removes the
catalog container but strictly **unlinks** all child collections. If a
collection becomes an orphan (no parents left), it is automatically
**adopted by the Root**.
* **Safe Collection Removal**: `DELETE /catalogs/{id}/collections/{id}`
now unlinks the collection from that specific catalog context only. It
**never deletes the collection data**, even if it was the only parent.
#### 2. Removed Destructive Features
* **Removed `cascade` parameter**: The `?cascade=true` option has been
removed. It is no longer possible to trigger a recursive data delete via
the catalogs route. Intentional data deletion must now be done via the
core `/collections/{id}` endpoint.
**PR Checklist:**
- [x] Code is formatted and linted (run `pre-commit run --all-files`)
- [x] Tests pass (run `make test`)
- [x] Documentation has been updated to reflect changes, if applicable
- [x] Changes are added to the changelog1 parent 2b8cb54 commit 39fa181
File tree
13 files changed
+159
-167
lines changed- stac_fastapi
- core/stac_fastapi/core
- extensions
- elasticsearch
- stac_fastapi/elasticsearch
- opensearch
- stac_fastapi/opensearch
- sfeos_helpers
- stac_fastapi/sfeos_helpers
- tests/extensions
13 files changed
+159
-167
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
26 | | - | |
| 36 | + | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
689 | 699 | | |
690 | 700 | | |
691 | 701 | | |
692 | | - | |
| 702 | + | |
| 703 | + | |
693 | 704 | | |
694 | 705 | | |
695 | 706 | | |
| |||
730 | 741 | | |
731 | 742 | | |
732 | 743 | | |
| 744 | + | |
Large diffs are not rendered by default.
Lines changed: 57 additions & 72 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
350 | 351 | | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
354 | | - | |
355 | | - | |
356 | 355 | | |
357 | 356 | | |
358 | 357 | | |
| |||
361 | 360 | | |
362 | 361 | | |
363 | 362 | | |
364 | | - | |
| 363 | + | |
365 | 364 | | |
366 | 365 | | |
367 | | - | |
368 | | - | |
369 | | - | |
| 366 | + | |
370 | 367 | | |
371 | 368 | | |
372 | 369 | | |
373 | 370 | | |
374 | 371 | | |
375 | 372 | | |
376 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
401 | 389 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | 390 | | |
413 | | - | |
414 | | - | |
| 391 | + | |
| 392 | + | |
415 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
416 | 399 | | |
417 | 400 | | |
418 | 401 | | |
| |||
929 | 912 | | |
930 | 913 | | |
931 | 914 | | |
932 | | - | |
| 915 | + | |
933 | 916 | | |
934 | | - | |
935 | | - | |
936 | | - | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
937 | 920 | | |
938 | 921 | | |
939 | 922 | | |
| |||
959 | 942 | | |
960 | 943 | | |
961 | 944 | | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
| 945 | + | |
| 946 | + | |
966 | 947 | | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
971 | 954 | | |
972 | | - | |
| 955 | + | |
973 | 956 | | |
974 | | - | |
| 957 | + | |
975 | 958 | | |
976 | 959 | | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | 960 | | |
982 | | - | |
| 961 | + | |
983 | 962 | | |
984 | 963 | | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
985 | 970 | | |
986 | 971 | | |
987 | 972 | | |
988 | 973 | | |
989 | | - | |
| 974 | + | |
990 | 975 | | |
991 | 976 | | |
992 | 977 | | |
993 | 978 | | |
994 | | - | |
| 979 | + | |
995 | 980 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
0 commit comments