[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:
Nikita Maliarchuk 2023-03-24 10:38:06 +01:00 committed by GitHub
parent 7c988fe4d3
commit 0089f188a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 35 additions and 24 deletions

View File

@ -13,11 +13,22 @@ Manages categories in Content Services.
### Methods
- **createSubcategory**(parentCategoryId: `string`, payload: `CategoryBody`): [`Observable`](http://reactivex.io/documentation/observable.html)`<CategoryEntry>`<br/>
Creates subcategory under category with provided categoryId
- _parentCategoryId:_ `string` - The identifier of a parent category.
- _payload:_ `CategoryBody` - Created category body
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<CategoryEntry>` - [`Observable`](http://reactivex.io/documentation/observable.html)&lt;CategoryEntry>
- **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/>
Gets subcategories of a given parent category.
- _parentCategoryId:_ `string` - Identifier of a parent category
- _skipCount:_ `number` - Number of top categories to skip
- _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/>
Deletes category
- _categoryId:_ `string` - The identifier of a category.

View File

@ -5,7 +5,7 @@
"requires": true,
"dependencies": {
"@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",
"integrity": "sha512-ABqr6zYO2jsh4pei7HEQkxVKSkGcMXEQScrdevX0/QoybVTuAyBQ+HvKf/cs36aECjHEkNqY3wN0Cjtqu/nOag==",
"requires": {

View File

@ -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"
},
"dependencies": {
"@alfresco/js-api": "5.5.0-741",
"@alfresco/js-api": "5.5.0-754",
"commander": "6.2.1",
"ejs": "^2.6.1",
"license-checker": "^25.0.1",

View File

@ -22,7 +22,7 @@
"@angular/platform-browser": ">=14.1.3",
"@angular/platform-browser-dynamic": ">=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",
"moment": ">=2.22.2",
"@alfresco/adf-core": "6.0.0-A.3"

View File

@ -62,8 +62,8 @@ describe('CategoryService', () => {
}));
it('should create subcategory', fakeAsync(() => {
const createSpy = spyOn(categoryService.categoriesApi, 'createSubcategory').and.returnValue(Promise.resolve(fakeCategoryEntry));
categoryService.createSubcategory(fakeParentCategoryId, fakeCategoryEntry.entry).subscribe(() => {
const createSpy = spyOn(categoryService.categoriesApi, 'createSubcategories').and.returnValue(Promise.resolve(fakeCategoryEntry));
categoryService.createSubcategories(fakeParentCategoryId, [fakeCategoryEntry.entry]).subscribe(() => {
expect(createSpy).toHaveBeenCalledOnceWith(fakeParentCategoryId, [fakeCategoryEntry.entry], {});
});
}));

View File

@ -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 payload Created category body
* @return Observable<CategoryEntry>
* @param payload List of categories to be created.
* @return Observable<CategoryPaging | CategoryEntry>
*/
createSubcategory(parentCategoryId: string, payload: CategoryBody): Observable<CategoryEntry> {
return from(this.categoriesApi.createSubcategory(parentCategoryId, [payload], {}));
createSubcategories(parentCategoryId: string, payload: CategoryBody[]): Observable<CategoryPaging | CategoryEntry> {
return from(this.categoriesApi.createSubcategories(parentCategoryId, payload, {}));
}
/**

View File

@ -44,7 +44,7 @@
"@angular/router": ">=14.1.3",
"@mat-datetimepicker/core": "^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",
"@ngx-translate/core": ">=14.0.0",
"minimatch-browser": ">=1.0.0",

View File

@ -14,7 +14,7 @@
"peerDependencies": {
"@angular/common": ">=14.1.3",
"@angular/core": ">=14.1.3",
"@alfresco/js-api": "5.5.0-741"
"@alfresco/js-api": "5.5.0-754"
},
"keywords": [
"extensions",

View File

@ -23,7 +23,7 @@
"@angular/platform-browser": ">=14.1.3",
"@angular/platform-browser-dynamic": ">=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-content-services": "6.0.0-A.3",
"@apollo/client": "^3.7.2",

View File

@ -22,7 +22,7 @@
"@angular/platform-browser": ">=14.1.3",
"@angular/platform-browser-dynamic": ">=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-content-services": "6.0.0-A.3",
"@ngx-translate/core": ">=14.0.0",

View File

@ -11,7 +11,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"peerDependencies": {
"@alfresco/js-api": "5.5.0-741"
"@alfresco/js-api": "5.5.0-754"
},
"keywords": [
"testing",

6
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@alfresco/js-api": {
"version": "5.5.0-741",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.5.0-741.tgz",
"integrity": "sha512-ABqr6zYO2jsh4pei7HEQkxVKSkGcMXEQScrdevX0/QoybVTuAyBQ+HvKf/cs36aECjHEkNqY3wN0Cjtqu/nOag==",
"version": "5.5.0-754",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.5.0-754.tgz",
"integrity": "sha512-XhczCemqdB62+zztv09ZXPHWCNeprDcFN7Wo/98271Yqse7YiY4kYlt1Oifq3xBu4JiJ30QWdKjWwiNDtCXuzg==",
"requires": {
"event-emitter": "^0.3.5",
"superagent": "^6.0.0",

View File

@ -54,7 +54,7 @@
"process services-cloud"
],
"dependencies": {
"@alfresco/js-api": "5.5.0-741",
"@alfresco/js-api": "5.5.0-754",
"@angular/animations": "14.1.3",
"@angular/cdk": "14.1.2",
"@angular/common": "14.1.3",