35023 task implement Bundle management Rest apis#35024
35023 task implement Bundle management Rest apis#35024hassandotcms wants to merge 6 commits intomainfrom
Conversation
…35023 - AddAssetsToBundleForm (extends Validated) with bundleId, bundleName, assetIds - AbstractAddAssetsToBundleView (Immutables) with bundleId, bundleName, created, total, errors - AbstractRemoveAssetsFromBundleForm (Immutables) with assetIds - AbstractRemoveAssetResultView (Immutables) with assetId, success, message - ResponseEntity wrappers for both endpoints
…35023 - POST /assets: existing bundle by ID, by name, auto-create, empty/null assetIds - DELETE /{bundleId}/assets: single/multiple removal, last asset cleanup, bundle not found (404), in-progress (409), asset not in bundle (success=false) - Register in MainSuite2b
|
Claude finished @hassandotcms's task in 2m 21s —— View job PR Review
Issues1.
} catch (DotPublisherException e) {
throw new BadRequestException(e.getMessage());
}
2. No authorization check on bundle ownership
3.
// doc says: "Total number of assets submitted for addition"
// actual: total comes from saveBundleAssets() result map, which is assets *successfully* added
4.
bundleAPI.get().getUnsendBundlesByName(user.getUserId(), form.getBundleName(), 1000, 0)
.stream()
.filter(b -> b.getName().equalsIgnoreCase(form.getBundleName()))
.findFirst()
...The underlying 5. TOCTOU race on in-progress status check for DELETE
6. Individual asset IDs not validated
7. Flaky permission test
8. Minor:
|
…-implement-add-assets-to-bundle-rest-api
… in addAssetsToBundle PublisherAPIImpl.addAssetsToQueue() throws AssetAlreadyLinkWithBundleException for duplicates, which rolls back the @WrapInTransaction and fails the entire batch. Pre-filter at the resource layer by reading existing assets from publishing_queue (same table/column the API checks) and passing only new assets to saveBundleAssets. Duplicates are silently skipped (idempotent). Also fixes test_addAssets_existingBundleByName where BundleDataGen set publishDate=new Date(), making bundles invisible to getUnsendBundlesByName. Adds non-admin permission test and duplicate-skip tests.
New REST API endpoints for managing bundle assets, replacing legacy
RemotePublishAjaxAction.addToBundle()and JSP-based asset deletion.Details
BundleManagementResourcewith Lazy DI, WebResource auth, Swagger/OpenAPI annotationsAddAssetsToBundleForm(Validated),RemoveAssetsFromBundleForm(Immutables)AddAssetsToBundleView,RemoveAssetResultView(Immutables + ResponseEntityView wrappers)Test plan
Resolves #34325 #35023
Screenshots