Added tags rest routes
MODIFY
src/server/rest/v1/router/api/TagRouter.ts
src/server/rest/v1/router/api/TagRouter.ts
@@ -18,6 +18,8 @@ export default class TagRouter {
this.buildRouteCreateTag();
this.buildRouteDeleteTag();
this.buildRouteUpdateTag();
+ this.buildRouteImportTag();
+ this.buildRouteExportTag();
return this.router;
}
@@ -53,4 +55,16 @@ export default class TagRouter {
await RouterUtils.handleServerAction(TagService.handleUpdateTag.bind(this), ServerAction.TAG_UPDATE, req, res, next);
});
}
+
+ protected buildRouteImportTag(): void {
+ this.router.post(`/${ServerRoute.REST_TAG_IMPORT}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(TagService.handleImportTags.bind(this), ServerAction.TAGS_IMPORT, req, res, next);
+ });
+ }
+
+ protected buildRouteExportTag(): void {
+ this.router.get(`/${ServerRoute.REST_TAG_EXPORT}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(TagService.handleExportTags.bind(this), ServerAction.TAGS_EXPORT, req, res, next);
+ });
+ }
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -506,6 +506,8 @@ export enum ServerRoute {
REST_TAGS = 'tags',
REST_TAG = 'tags/:id',
+ REST_TAG_IMPORT = 'tags/action/import',
+ REST_TAG_EXPORT = 'tags/action/export',
REST_ASSET_CONSUMPTION = 'assets/:assetID/consumption',

MODIFY
test/api/client/UserApi.ts
test/api/client/UserApi.ts
+import AuthenticatedBaseApi from './utils/AuthenticatedBaseApi';
import CrudApi from './utils/CrudApi';
import { ServerRoute } from '../../../src/types/Server';
import TestConstants from './utils/TestConstants';
export default class UserApi extends CrudApi {
- public constructor(authenticatedApi) {
+ public constructor(authenticatedApi: AuthenticatedBaseApi) {
super(authenticatedApi);
}
@@ -40,27 +41,27 @@ export default class UserApi extends CrudApi {
}
public async readTags(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return super.readAll(params, paging, ordering, '/client/api/Tags');
+ return super.readAll(params, paging, ordering, this.buildRestEndpointUrl(ServerRoute.REST_TAGS));
}
public async readTag(id) {
- return super.read({ ID: id }, '/client/api/Tag');
+ return super.read({ ID: id }, this.buildRestEndpointUrl(ServerRoute.REST_TAG, { id }));
}
public async updateTag(data) {
- return super.update(data, '/client/api/TagUpdate');
+ return super.update(data, this.buildRestEndpointUrl(ServerRoute.REST_TAG, { id: data.id }));
}
public async createTag(data) {
- return super.create(data, '/client/api/TagCreate');
+ return super.create(data, this.buildRestEndpointUrl(ServerRoute.REST_TAGS));
}
public async deleteTag(id) {
- return super.delete(id, '/client/api/TagDelete');
+ return super.delete(id, this.buildRestEndpointUrl(ServerRoute.REST_TAG, { id }));
}
public async exportTags(params) {
- return await super.read(params, '/client/api/TagsExport');
+ return await super.read(params, this.buildRestEndpointUrl(ServerRoute.REST_TAG_EXPORT));
}
public async exportUsers(params) {

Added tags rest routes