mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACS-4117] Added possibility to create multiple categories (#8382)
* [ACS-4117] added possibility to create multiple subcategories * [ACS-4117] renamed api function to follow updated code * [ACS-4117] js-api update * [ACS-4117] package-lock * [ACS-4117] rebase * [ACS-4117] empty commit
This commit is contained in:
parent
7c988fe4d3
commit
0089f188a4
@ -13,11 +13,22 @@ Manages categories in Content Services.
|
|||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
- **createSubcategory**(parentCategoryId: `string`, payload: `CategoryBody`): [`Observable`](http://reactivex.io/documentation/observable.html)`<CategoryEntry>`<br/>
|
- **getSubcategories**(parentCategoryId: `string`, skipCount?: `number`, maxItems?: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CategoryPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryPaging.md)`>`<br/>
|
||||||
Creates subcategory under category with provided categoryId
|
Gets subcategories of a given parent category.
|
||||||
- _parentCategoryId:_ `string` - The identifier of a parent category.
|
- _parentCategoryId:_ `string` - Identifier of a parent category
|
||||||
- _payload:_ `CategoryBody` - Created category body
|
- _skipCount:_ `number` - Number of top categories to skip
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<CategoryEntry>` - [`Observable`](http://reactivex.io/documentation/observable.html)<CategoryEntry>
|
- _maxItems:_ `number` - Maximum number of subcategories returned from Observable
|
||||||
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CategoryPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryPaging.md)`>` - CategoryPaging object (defined in JS-API) with category paging list
|
||||||
|
- **createSubcategories**(parentCategoryId: `string`, payload: [`CategoryBody[]`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryBody.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CategoryPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryPaging.md) | [`CategoryEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryEntry.md)`>`<br/>
|
||||||
|
Creates subcategories under category with provided categoryId.
|
||||||
|
- _parentCategoryId:_ `string` - Identifier of a parent category
|
||||||
|
- _payload:_ [`CategoryBody[]`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryBody.md) - List of categories to be created
|
||||||
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CategoryPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryPaging.md) | [`CategoryEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryEntry.md)`>` - CategoryEntry object (defined in JS-API) containing the category
|
||||||
|
- **updateCategory**(categoryId: `string`, payload: [`CategoryBody`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryBody.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CategoryEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryEntry.md)`>`<br/>
|
||||||
|
Updates category.
|
||||||
|
- _categoryId:_ `string` - Identifier of a category
|
||||||
|
- _payload:_ [`CategoryBody`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryBody.md) - Created category body
|
||||||
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CategoryEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/api/content-rest-api/docs/CategoryEntry.md)`>` - CategoryEntry object (defined in JS-API) containing the category
|
||||||
- **deleteCategory**(categoryId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<void>`<br/>
|
- **deleteCategory**(categoryId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<void>`<br/>
|
||||||
Deletes category
|
Deletes category
|
||||||
- _categoryId:_ `string` - The identifier of a category.
|
- _categoryId:_ `string` - The identifier of a category.
|
||||||
|
2
lib/cli/package-lock.json
generated
2
lib/cli/package-lock.json
generated
@ -5,7 +5,7 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": {
|
"@alfresco/js-api": {
|
||||||
"version": "5.5.0-741",
|
"version": "5.5.0-754",
|
||||||
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.5.0-741.tgz",
|
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.5.0-741.tgz",
|
||||||
"integrity": "sha512-ABqr6zYO2jsh4pei7HEQkxVKSkGcMXEQScrdevX0/QoybVTuAyBQ+HvKf/cs36aECjHEkNqY3wN0Cjtqu/nOag==",
|
"integrity": "sha512-ABqr6zYO2jsh4pei7HEQkxVKSkGcMXEQScrdevX0/QoybVTuAyBQ+HvKf/cs36aECjHEkNqY3wN0Cjtqu/nOag==",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli"
|
"dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": "5.5.0-741",
|
"@alfresco/js-api": "5.5.0-754",
|
||||||
"commander": "6.2.1",
|
"commander": "6.2.1",
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"@angular/platform-browser": ">=14.1.3",
|
"@angular/platform-browser": ">=14.1.3",
|
||||||
"@angular/platform-browser-dynamic": ">=14.1.3",
|
"@angular/platform-browser-dynamic": ">=14.1.3",
|
||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@alfresco/js-api": "5.5.0-741",
|
"@alfresco/js-api": "5.5.0-754",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
"moment": ">=2.22.2",
|
"moment": ">=2.22.2",
|
||||||
"@alfresco/adf-core": "6.0.0-A.3"
|
"@alfresco/adf-core": "6.0.0-A.3"
|
||||||
|
@ -62,8 +62,8 @@ describe('CategoryService', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should create subcategory', fakeAsync(() => {
|
it('should create subcategory', fakeAsync(() => {
|
||||||
const createSpy = spyOn(categoryService.categoriesApi, 'createSubcategory').and.returnValue(Promise.resolve(fakeCategoryEntry));
|
const createSpy = spyOn(categoryService.categoriesApi, 'createSubcategories').and.returnValue(Promise.resolve(fakeCategoryEntry));
|
||||||
categoryService.createSubcategory(fakeParentCategoryId, fakeCategoryEntry.entry).subscribe(() => {
|
categoryService.createSubcategories(fakeParentCategoryId, [fakeCategoryEntry.entry]).subscribe(() => {
|
||||||
expect(createSpy).toHaveBeenCalledOnceWith(fakeParentCategoryId, [fakeCategoryEntry.entry], {});
|
expect(createSpy).toHaveBeenCalledOnceWith(fakeParentCategoryId, [fakeCategoryEntry.entry], {});
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -58,14 +58,14 @@ export class CategoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates subcategory under category with provided categoryId
|
* Creates subcategories under category with provided categoryId
|
||||||
*
|
*
|
||||||
* @param parentCategoryId The identifier of a parent category.
|
* @param parentCategoryId The identifier of a parent category.
|
||||||
* @param payload Created category body
|
* @param payload List of categories to be created.
|
||||||
* @return Observable<CategoryEntry>
|
* @return Observable<CategoryPaging | CategoryEntry>
|
||||||
*/
|
*/
|
||||||
createSubcategory(parentCategoryId: string, payload: CategoryBody): Observable<CategoryEntry> {
|
createSubcategories(parentCategoryId: string, payload: CategoryBody[]): Observable<CategoryPaging | CategoryEntry> {
|
||||||
return from(this.categoriesApi.createSubcategory(parentCategoryId, [payload], {}));
|
return from(this.categoriesApi.createSubcategories(parentCategoryId, payload, {}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@mat-datetimepicker/core": "^9.0.68",
|
"@mat-datetimepicker/core": "^9.0.68",
|
||||||
"@mat-datetimepicker/moment": "^9.0.68",
|
"@mat-datetimepicker/moment": "^9.0.68",
|
||||||
"@alfresco/js-api": "5.5.0-741",
|
"@alfresco/js-api": "5.5.0-754",
|
||||||
"@alfresco/adf-extensions": "6.0.0-A.3",
|
"@alfresco/adf-extensions": "6.0.0-A.3",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
"minimatch-browser": ">=1.0.0",
|
"minimatch-browser": ">=1.0.0",
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": ">=14.1.3",
|
"@angular/common": ">=14.1.3",
|
||||||
"@angular/core": ">=14.1.3",
|
"@angular/core": ">=14.1.3",
|
||||||
"@alfresco/js-api": "5.5.0-741"
|
"@alfresco/js-api": "5.5.0-754"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"extensions",
|
"extensions",
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"@angular/platform-browser": ">=14.1.3",
|
"@angular/platform-browser": ">=14.1.3",
|
||||||
"@angular/platform-browser-dynamic": ">=14.1.3",
|
"@angular/platform-browser-dynamic": ">=14.1.3",
|
||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@alfresco/js-api": "5.5.0-741",
|
"@alfresco/js-api": "5.5.0-754",
|
||||||
"@alfresco/adf-core": "6.0.0-A.3",
|
"@alfresco/adf-core": "6.0.0-A.3",
|
||||||
"@alfresco/adf-content-services": "6.0.0-A.3",
|
"@alfresco/adf-content-services": "6.0.0-A.3",
|
||||||
"@apollo/client": "^3.7.2",
|
"@apollo/client": "^3.7.2",
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"@angular/platform-browser": ">=14.1.3",
|
"@angular/platform-browser": ">=14.1.3",
|
||||||
"@angular/platform-browser-dynamic": ">=14.1.3",
|
"@angular/platform-browser-dynamic": ">=14.1.3",
|
||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@alfresco/js-api": "5.5.0-741",
|
"@alfresco/js-api": "5.5.0-754",
|
||||||
"@alfresco/adf-core": "6.0.0-A.3",
|
"@alfresco/adf-core": "6.0.0-A.3",
|
||||||
"@alfresco/adf-content-services": "6.0.0-A.3",
|
"@alfresco/adf-content-services": "6.0.0-A.3",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
|
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@alfresco/js-api": "5.5.0-741"
|
"@alfresco/js-api": "5.5.0-754"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"testing",
|
"testing",
|
||||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -5,9 +5,9 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": {
|
"@alfresco/js-api": {
|
||||||
"version": "5.5.0-741",
|
"version": "5.5.0-754",
|
||||||
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.5.0-741.tgz",
|
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.5.0-754.tgz",
|
||||||
"integrity": "sha512-ABqr6zYO2jsh4pei7HEQkxVKSkGcMXEQScrdevX0/QoybVTuAyBQ+HvKf/cs36aECjHEkNqY3wN0Cjtqu/nOag==",
|
"integrity": "sha512-XhczCemqdB62+zztv09ZXPHWCNeprDcFN7Wo/98271Yqse7YiY4kYlt1Oifq3xBu4JiJ30QWdKjWwiNDtCXuzg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"event-emitter": "^0.3.5",
|
"event-emitter": "^0.3.5",
|
||||||
"superagent": "^6.0.0",
|
"superagent": "^6.0.0",
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
"process services-cloud"
|
"process services-cloud"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": "5.5.0-741",
|
"@alfresco/js-api": "5.5.0-754",
|
||||||
"@angular/animations": "14.1.3",
|
"@angular/animations": "14.1.3",
|
||||||
"@angular/cdk": "14.1.2",
|
"@angular/cdk": "14.1.2",
|
||||||
"@angular/common": "14.1.3",
|
"@angular/common": "14.1.3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user