From ba129e90715ddf529aa5e729f8120c2c491df460 Mon Sep 17 00:00:00 2001 From: NicoleNG18 Date: Tue, 17 Feb 2026 19:08:46 +0200 Subject: [PATCH] regenerate module --- codbex-uoms/codbex-uoms.gen | 50 +- .../api/Settings/DimensionController.ts | 181 +++ .../api/Settings/DimensionService.ts | 159 -- .../codbex-uoms/api/Settings/UoMController.ts | 181 +++ .../codbex-uoms/api/Settings/UoMService.ts | 159 -- .../codbex-uoms/api/utils/ForbiddenError.ts | 8 - .../gen/codbex-uoms/api/utils/HttpUtils.ts | 60 - .../codbex-uoms/api/utils/ValidationError.ts | 8 - .../gen/codbex-uoms/codbex-uoms.openapi | 1375 ----------------- .../dao/Settings/DimensionRepository.ts | 8 +- .../codbex-uoms/dao/Settings/UoMRepository.ts | 8 +- .../data/Settings/Dimension.extensionpoint | 4 + .../data/Settings/DimensionEntity.ts | 36 + .../data/Settings/DimensionRepository.ts | 25 + .../data/Settings/UoM.extensionpoint | 4 + .../codbex-uoms/data/Settings/UoMEntity.ts | 86 ++ .../data/Settings/UoMRepository.ts | 25 + .../ui/Settings/Dimension/controller.js | 9 +- .../Dimension/dialog-filter/controller.js | 29 +- .../Dimension/dialog-filter/index.html | 3 +- .../Dimension/dialog-window/controller.js | 2 +- .../Dimension/dialog-window/index.html | 3 +- .../ui/Settings/Dimension/index.html | 3 +- .../codbex-uoms/ui/Settings/UoM/controller.js | 11 +- .../Settings/UoM/dialog-filter/controller.js | 47 +- .../ui/Settings/UoM/dialog-filter/index.html | 3 +- .../Settings/UoM/dialog-window/controller.js | 6 +- .../ui/Settings/UoM/dialog-window/index.html | 3 +- .../codbex-uoms/ui/Settings/UoM/index.html | 3 +- 29 files changed, 638 insertions(+), 1861 deletions(-) create mode 100644 codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts delete mode 100644 codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts create mode 100644 codbex-uoms/gen/codbex-uoms/api/Settings/UoMController.ts delete mode 100644 codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts delete mode 100644 codbex-uoms/gen/codbex-uoms/api/utils/ForbiddenError.ts delete mode 100644 codbex-uoms/gen/codbex-uoms/api/utils/HttpUtils.ts delete mode 100644 codbex-uoms/gen/codbex-uoms/api/utils/ValidationError.ts delete mode 100644 codbex-uoms/gen/codbex-uoms/codbex-uoms.openapi create mode 100644 codbex-uoms/gen/codbex-uoms/data/Settings/Dimension.extensionpoint create mode 100644 codbex-uoms/gen/codbex-uoms/data/Settings/DimensionEntity.ts create mode 100644 codbex-uoms/gen/codbex-uoms/data/Settings/DimensionRepository.ts create mode 100644 codbex-uoms/gen/codbex-uoms/data/Settings/UoM.extensionpoint create mode 100644 codbex-uoms/gen/codbex-uoms/data/Settings/UoMEntity.ts create mode 100644 codbex-uoms/gen/codbex-uoms/data/Settings/UoMRepository.ts diff --git a/codbex-uoms/codbex-uoms.gen b/codbex-uoms/codbex-uoms.gen index e4a308a..92421c5 100644 --- a/codbex-uoms/codbex-uoms.gen +++ b/codbex-uoms/codbex-uoms.gen @@ -2,28 +2,15 @@ "tablePrefix": "CODBEX_", "brand": "codbex", "brandUrl": "https://www.codbex.com/", - "title": "UoM Management Application", - "description": "Managing UoMs data", - "fileName": "codbex-uoms", - "genFolderName": "codbex-uoms", - "dataSource": "DefaultDB", - "roles": [ - { - "entityName": "Dimension", - "roleRead": "codbex-uoms.Dimensions.DimensionReadOnly", - "roleWrite": "codbex-uoms.Dimensions.DimensionFullAccess" - }, - { - "entityName": "UoM", - "roleRead": "codbex-uoms.UnitsOfMeasures.UoMReadOnly", - "roleWrite": "codbex-uoms.UnitsOfMeasures.UoMFullAccess" - } - ], - "tprefix": "codbex-uoms-model", + "title": "UOMs Management Module", + "description": "Managing UOMs Data", "projectName": "codbex-uoms", "workspaceName": "workspace", "filePath": "codbex-uoms.model", - "templateId": "template-application-angular/template/template.js", + "templateId": "template-application-angular-v2/template/template.js", + "fileName": "codbex-uoms", + "genFolderName": "codbex-uoms", + "dataSource": "DefaultDB", "perspectives": { "Settings": { "views": [ @@ -39,6 +26,19 @@ "role": "" } }, + "roles": [ + { + "entityName": "Dimension", + "roleRead": "codbex-uoms.Dimensions.DimensionReadOnly", + "roleWrite": "codbex-uoms.Dimensions.DimensionFullAccess" + }, + { + "entityName": "UoM", + "roleRead": "codbex-uoms.UnitsOfMeasures.UoMReadOnly", + "roleWrite": "codbex-uoms.UnitsOfMeasures.UoMFullAccess" + } + ], + "tprefix": "codbex-uoms-model", "models": [ { "properties": [ @@ -61,6 +61,7 @@ "isCalculatedProperty": false, "widgetLabel": "Id", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", "inputRule": "" @@ -85,6 +86,7 @@ "isCalculatedProperty": false, "widgetLabel": "Name", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", "minLength": 0, @@ -111,6 +113,7 @@ "isCalculatedProperty": false, "widgetLabel": "SAP", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", "minLength": 0, @@ -172,6 +175,7 @@ "isCalculatedProperty": false, "widgetLabel": "Id", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", "inputRule": "" @@ -196,6 +200,7 @@ "isCalculatedProperty": false, "widgetLabel": "Name", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", "minLength": 0, @@ -222,6 +227,7 @@ "isCalculatedProperty": false, "widgetLabel": "ISO", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", "minLength": 0, @@ -253,6 +259,7 @@ "isCalculatedProperty": false, "widgetLabel": "Dimension", "widgetDropdownUrl": "/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts", + "widgetDropdownControllerUrl": "/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts", "dataTypeJava": "int", "dataTypeTypescript": "number", "inputRule": "" @@ -281,6 +288,7 @@ "isCalculatedProperty": false, "widgetLabel": "SAP", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", "minLength": 0, @@ -306,6 +314,7 @@ "isCalculatedProperty": false, "widgetLabel": "Numerator", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "long", "dataTypeTypescript": "number", "inputRule": "" @@ -329,6 +338,7 @@ "isCalculatedProperty": false, "widgetLabel": "Denominator", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "long", "dataTypeTypescript": "number", "inputRule": "" @@ -352,6 +362,7 @@ "isCalculatedProperty": false, "widgetLabel": "Rounding", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", "inputRule": "" @@ -375,6 +386,7 @@ "isCalculatedProperty": false, "widgetLabel": "Base", "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", "dataTypeJava": "boolean", "dataTypeTypescript": "boolean", "inputRule": "" diff --git a/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts b/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts new file mode 100644 index 0000000..3627fee --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts @@ -0,0 +1,181 @@ +import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' +import { HttpUtils } from "@aerokit/sdk/http/utils"; +import { ValidationError } from '@aerokit/sdk/http/errors' +import { ForbiddenError } from '@aerokit/sdk/http/errors' +import { user } from '@aerokit/sdk/security' +import { Options } from '@aerokit/sdk/db' +import { Extensions } from "@aerokit/sdk/extensions" +import { Injected, Inject } from '@aerokit/sdk/component' +import { DimensionRepository } from '../../data/Settings/DimensionRepository' +import { DimensionEntity } from '../../data/Settings/DimensionEntity' + +const validationModules = await Extensions.loadExtensionModules('codbex-uoms-Settings-Dimension', ['validate']); + +@Controller +@Documentation('codbex-uoms - Dimension Controller') +@Injected() +class DimensionController { + + @Inject('DimensionRepository') + private readonly repository!: DimensionRepository; + + @Get('/') + @Documentation('Get All Dimension') + public getAll(_: any, ctx: any): DimensionEntity[] { + try { + this.checkPermissions('read'); + const options: Options = { + limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, + offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, + language: request.getLocale().slice(0, 2) + }; + + return this.repository.findAll(options); + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Post('/') + @Documentation('Create Dimension') + public create(entity: DimensionEntity): DimensionEntity { + try { + this.checkPermissions('write'); + this.validateEntity(entity); + entity.Id = this.repository.create(entity) as any; + response.setHeader('Content-Location', '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts/' + entity.Id); + response.setStatus(response.CREATED); + return entity; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/count') + @Documentation('Count Dimension') + public count(): { count: number } { + try { + this.checkPermissions('read'); + return { count: this.repository.count() }; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Post('/count') + @Documentation('Count Dimension with filter') + public countWithFilter(filter: any): { count: number } { + try { + this.checkPermissions('read'); + return { count: this.repository.count(filter) }; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Post('/search') + @Documentation('Search Dimension') + public search(filter: any): DimensionEntity[] { + try { + this.checkPermissions('read'); + return this.repository.findAll(filter); + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/:id') + @Documentation('Get Dimension by id') + public getById(_: any, ctx: any): DimensionEntity { + try { + this.checkPermissions('read'); + const id = parseInt(ctx.pathParameters.id); + const options: Options = { + language: request.getLocale().slice(0, 2) + }; + const entity = this.repository.findById(id, options); + if (entity) { + return entity; + } else { + HttpUtils.sendResponseNotFound('Dimension not found'); + } + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Put('/:id') + @Documentation('Update Dimension by id') + public update(entity: DimensionEntity, ctx: any): DimensionEntity { + try { + this.checkPermissions('write'); + const id = parseInt(ctx.pathParameters.id); + entity.Id = id; + this.validateEntity(entity); + this.repository.update(entity); + return entity; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Delete('/:id') + @Documentation('Delete Dimension by id') + public deleteById(_: any, ctx: any): void { + try { + this.checkPermissions('write'); + const id = parseInt(ctx.pathParameters.id); + const entity = this.repository.findById(id); + if (entity) { + this.repository.deleteById(id); + HttpUtils.sendResponseNoContent(); + } else { + HttpUtils.sendResponseNotFound('Dimension not found'); + } + } catch (error: any) { + this.handleError(error); + } + } + + private handleError(error: any) { + if (error.name === 'ForbiddenError') { + HttpUtils.sendForbiddenRequest(error.message); + } else if (error.name === 'ValidationError') { + HttpUtils.sendResponseBadRequest(error.message); + } else { + HttpUtils.sendInternalServerError(error.message); + } + } + + private checkPermissions(operationType: string) { + if (operationType === 'read' && !(user.isInRole('codbex-uoms.Dimensions.DimensionReadOnly') || user.isInRole('codbex-uoms.Dimensions.DimensionFullAccess'))) { + throw new ForbiddenError(); + } + if (operationType === 'write' && !user.isInRole('codbex-uoms.Dimensions.DimensionFullAccess')) { + throw new ForbiddenError(); + } + } + + private validateEntity(entity: any): void { + if (entity.Name === null || entity.Name === undefined) { + throw new ValidationError(`The 'Name' property is required, provide a valid value`); + } + if (entity.Name?.length > 100) { + throw new ValidationError(`The 'Name' exceeds the maximum length of [100] characters`); + } + if (entity.SAP?.length > 20) { + throw new ValidationError(`The 'SAP' exceeds the maximum length of [20] characters`); + } + for (const next of validationModules) { + next.validate(entity); + } + } + +} diff --git a/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts b/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts deleted file mode 100644 index c8bfced..0000000 --- a/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { Controller, Get, Post, Put, Delete, request, response } from "sdk/http" -import { Extensions } from "sdk/extensions" -import { DimensionRepository, DimensionEntityOptions } from "../../dao/Settings/DimensionRepository"; -import { user } from "sdk/security" -import { ForbiddenError } from "../utils/ForbiddenError"; -import { ValidationError } from "../utils/ValidationError"; -import { HttpUtils } from "../utils/HttpUtils"; - -const validationModules = await Extensions.loadExtensionModules("codbex-uoms-Settings-Dimension", ["validate"]); - -@Controller -class DimensionService { - - private readonly repository = new DimensionRepository(); - - @Get("/") - public getAll(_: any, ctx: any) { - try { - this.checkPermissions("read"); - const options: DimensionEntityOptions = { - $limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : undefined, - $offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : undefined, - $language: request.getLocale().slice(0, 2) - }; - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - } - - @Post("/") - public create(entity: any) { - try { - this.checkPermissions("write"); - this.validateEntity(entity); - entity.Id = this.repository.create(entity); - response.setHeader("Content-Location", "/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts/" + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - } - - @Get("/count") - public count() { - try { - this.checkPermissions("read"); - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - } - - @Post("/count") - public countWithFilter(filter: any) { - try { - this.checkPermissions("read"); - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - } - - @Post("/search") - public search(filter: any) { - try { - this.checkPermissions("read"); - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - } - - @Get("/:id") - public getById(_: any, ctx: any) { - try { - this.checkPermissions("read"); - const id = parseInt(ctx.pathParameters.id); - const options: DimensionEntityOptions = { - $language: request.getLocale().slice(0, 2) - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound("Dimension not found"); - } - } catch (error: any) { - this.handleError(error); - } - } - - @Put("/:id") - public update(entity: any, ctx: any) { - try { - this.checkPermissions("write"); - entity.Id = ctx.pathParameters.id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - } - - @Delete("/:id") - public deleteById(_: any, ctx: any) { - try { - this.checkPermissions("write"); - const id = ctx.pathParameters.id; - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound("Dimension not found"); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === "ForbiddenError") { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === "ValidationError") { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private checkPermissions(operationType: string) { - if (operationType === "read" && !(user.isInRole("codbex-uoms.Dimensions.DimensionReadOnly") || user.isInRole("codbex-uoms.Dimensions.DimensionFullAccess"))) { - throw new ForbiddenError(); - } - if (operationType === "write" && !user.isInRole("codbex-uoms.Dimensions.DimensionFullAccess")) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.Name === null || entity.Name === undefined) { - throw new ValidationError(`The 'Name' property is required, provide a valid value`); - } - if (entity.Name?.length > 100) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [100] characters`); - } - if (entity.SAP?.length > 20) { - throw new ValidationError(`The 'SAP' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-uoms/gen/codbex-uoms/api/Settings/UoMController.ts b/codbex-uoms/gen/codbex-uoms/api/Settings/UoMController.ts new file mode 100644 index 0000000..a50443e --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/api/Settings/UoMController.ts @@ -0,0 +1,181 @@ +import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' +import { HttpUtils } from "@aerokit/sdk/http/utils"; +import { ValidationError } from '@aerokit/sdk/http/errors' +import { ForbiddenError } from '@aerokit/sdk/http/errors' +import { user } from '@aerokit/sdk/security' +import { Options } from '@aerokit/sdk/db' +import { Extensions } from "@aerokit/sdk/extensions" +import { Injected, Inject } from '@aerokit/sdk/component' +import { UoMRepository } from '../../data/Settings/UoMRepository' +import { UoMEntity } from '../../data/Settings/UoMEntity' + +const validationModules = await Extensions.loadExtensionModules('codbex-uoms-Settings-UoM', ['validate']); + +@Controller +@Documentation('codbex-uoms - UoM Controller') +@Injected() +class UoMController { + + @Inject('UoMRepository') + private readonly repository!: UoMRepository; + + @Get('/') + @Documentation('Get All UoM') + public getAll(_: any, ctx: any): UoMEntity[] { + try { + this.checkPermissions('read'); + const options: Options = { + limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, + offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, + language: request.getLocale().slice(0, 2) + }; + + return this.repository.findAll(options); + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Post('/') + @Documentation('Create UoM') + public create(entity: UoMEntity): UoMEntity { + try { + this.checkPermissions('write'); + this.validateEntity(entity); + entity.Id = this.repository.create(entity) as any; + response.setHeader('Content-Location', '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts/' + entity.Id); + response.setStatus(response.CREATED); + return entity; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/count') + @Documentation('Count UoM') + public count(): { count: number } { + try { + this.checkPermissions('read'); + return { count: this.repository.count() }; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Post('/count') + @Documentation('Count UoM with filter') + public countWithFilter(filter: any): { count: number } { + try { + this.checkPermissions('read'); + return { count: this.repository.count(filter) }; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Post('/search') + @Documentation('Search UoM') + public search(filter: any): UoMEntity[] { + try { + this.checkPermissions('read'); + return this.repository.findAll(filter); + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/:id') + @Documentation('Get UoM by id') + public getById(_: any, ctx: any): UoMEntity { + try { + this.checkPermissions('read'); + const id = parseInt(ctx.pathParameters.id); + const options: Options = { + language: request.getLocale().slice(0, 2) + }; + const entity = this.repository.findById(id, options); + if (entity) { + return entity; + } else { + HttpUtils.sendResponseNotFound('UoM not found'); + } + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Put('/:id') + @Documentation('Update UoM by id') + public update(entity: UoMEntity, ctx: any): UoMEntity { + try { + this.checkPermissions('write'); + const id = parseInt(ctx.pathParameters.id); + entity.Id = id; + this.validateEntity(entity); + this.repository.update(entity); + return entity; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Delete('/:id') + @Documentation('Delete UoM by id') + public deleteById(_: any, ctx: any): void { + try { + this.checkPermissions('write'); + const id = parseInt(ctx.pathParameters.id); + const entity = this.repository.findById(id); + if (entity) { + this.repository.deleteById(id); + HttpUtils.sendResponseNoContent(); + } else { + HttpUtils.sendResponseNotFound('UoM not found'); + } + } catch (error: any) { + this.handleError(error); + } + } + + private handleError(error: any) { + if (error.name === 'ForbiddenError') { + HttpUtils.sendForbiddenRequest(error.message); + } else if (error.name === 'ValidationError') { + HttpUtils.sendResponseBadRequest(error.message); + } else { + HttpUtils.sendInternalServerError(error.message); + } + } + + private checkPermissions(operationType: string) { + if (operationType === 'read' && !(user.isInRole('codbex-uoms.UnitsOfMeasures.UoMReadOnly') || user.isInRole('codbex-uoms.UnitsOfMeasures.UoMFullAccess'))) { + throw new ForbiddenError(); + } + if (operationType === 'write' && !user.isInRole('codbex-uoms.UnitsOfMeasures.UoMFullAccess')) { + throw new ForbiddenError(); + } + } + + private validateEntity(entity: any): void { + if (entity.Name?.length > 100) { + throw new ValidationError(`The 'Name' exceeds the maximum length of [100] characters`); + } + if (entity.ISO?.length > 20) { + throw new ValidationError(`The 'ISO' exceeds the maximum length of [20] characters`); + } + if (entity.SAP?.length > 20) { + throw new ValidationError(`The 'SAP' exceeds the maximum length of [20] characters`); + } + for (const next of validationModules) { + next.validate(entity); + } + } + +} diff --git a/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts b/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts deleted file mode 100644 index 2d137f0..0000000 --- a/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { Controller, Get, Post, Put, Delete, request, response } from "sdk/http" -import { Extensions } from "sdk/extensions" -import { UoMRepository, UoMEntityOptions } from "../../dao/Settings/UoMRepository"; -import { user } from "sdk/security" -import { ForbiddenError } from "../utils/ForbiddenError"; -import { ValidationError } from "../utils/ValidationError"; -import { HttpUtils } from "../utils/HttpUtils"; - -const validationModules = await Extensions.loadExtensionModules("codbex-uoms-Settings-UoM", ["validate"]); - -@Controller -class UoMService { - - private readonly repository = new UoMRepository(); - - @Get("/") - public getAll(_: any, ctx: any) { - try { - this.checkPermissions("read"); - const options: UoMEntityOptions = { - $limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : undefined, - $offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : undefined, - $language: request.getLocale().slice(0, 2) - }; - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - } - - @Post("/") - public create(entity: any) { - try { - this.checkPermissions("write"); - this.validateEntity(entity); - entity.Id = this.repository.create(entity); - response.setHeader("Content-Location", "/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts/" + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - } - - @Get("/count") - public count() { - try { - this.checkPermissions("read"); - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - } - - @Post("/count") - public countWithFilter(filter: any) { - try { - this.checkPermissions("read"); - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - } - - @Post("/search") - public search(filter: any) { - try { - this.checkPermissions("read"); - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - } - - @Get("/:id") - public getById(_: any, ctx: any) { - try { - this.checkPermissions("read"); - const id = parseInt(ctx.pathParameters.id); - const options: UoMEntityOptions = { - $language: request.getLocale().slice(0, 2) - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound("UoM not found"); - } - } catch (error: any) { - this.handleError(error); - } - } - - @Put("/:id") - public update(entity: any, ctx: any) { - try { - this.checkPermissions("write"); - entity.Id = ctx.pathParameters.id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - } - - @Delete("/:id") - public deleteById(_: any, ctx: any) { - try { - this.checkPermissions("write"); - const id = ctx.pathParameters.id; - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound("UoM not found"); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === "ForbiddenError") { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === "ValidationError") { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private checkPermissions(operationType: string) { - if (operationType === "read" && !(user.isInRole("codbex-uoms.UnitsOfMeasures.UoMReadOnly") || user.isInRole("codbex-uoms.UnitsOfMeasures.UoMFullAccess"))) { - throw new ForbiddenError(); - } - if (operationType === "write" && !user.isInRole("codbex-uoms.UnitsOfMeasures.UoMFullAccess")) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.Name?.length > 100) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [100] characters`); - } - if (entity.ISO?.length > 20) { - throw new ValidationError(`The 'ISO' exceeds the maximum length of [20] characters`); - } - if (entity.SAP?.length > 20) { - throw new ValidationError(`The 'SAP' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-uoms/gen/codbex-uoms/api/utils/ForbiddenError.ts b/codbex-uoms/gen/codbex-uoms/api/utils/ForbiddenError.ts deleted file mode 100644 index 775ae84..0000000 --- a/codbex-uoms/gen/codbex-uoms/api/utils/ForbiddenError.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class ForbiddenError extends Error { - readonly name = "ForbiddenError"; - readonly stack = (new Error()).stack; - - constructor(message: string = "You don't have permission to access this resource") { - super(message); - } -} \ No newline at end of file diff --git a/codbex-uoms/gen/codbex-uoms/api/utils/HttpUtils.ts b/codbex-uoms/gen/codbex-uoms/api/utils/HttpUtils.ts deleted file mode 100644 index 80efced..0000000 --- a/codbex-uoms/gen/codbex-uoms/api/utils/HttpUtils.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { response } from "sdk/http"; - -export class HttpUtils { - - // HTTP 200 - public static sendResponseOk(entity: any): void { - HttpUtils.sendResponse(200, entity); - } - - // HTTP 201 - public static sendResponseCreated(entity): void { - HttpUtils.sendResponse(201, entity); - } - - // HTTP 204 - public static sendResponseNoContent(): void { - HttpUtils.sendResponse(204); - } - - // HTTP 400 - public static sendResponseBadRequest(message): void { - HttpUtils.sendResponse(400, { - "code": 400, - "message": message - }); - } - - // HTTP 403 - public static sendForbiddenRequest(message): void { - HttpUtils.sendResponse(403, { - "code": 403, - "message": message - }); - } - - // HTTP 404 - public static sendResponseNotFound(message): void { - HttpUtils.sendResponse(404, { - "code": 404, - "message": message - }); - } - - // HTTP 500 - public static sendInternalServerError(message): void { - HttpUtils.sendResponse(500, { - "code": 500, - "message": message - }); - } - - // Generic - private static sendResponse(status: number, body?: any): void { - response.setContentType("application/json"); - response.setStatus(status); - if (body) { - response.println(JSON.stringify(body)); - } - } -} \ No newline at end of file diff --git a/codbex-uoms/gen/codbex-uoms/api/utils/ValidationError.ts b/codbex-uoms/gen/codbex-uoms/api/utils/ValidationError.ts deleted file mode 100644 index 9b894fa..0000000 --- a/codbex-uoms/gen/codbex-uoms/api/utils/ValidationError.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class ValidationError extends Error { - readonly name = "ValidationError"; - readonly stack = (new Error()).stack; - - constructor(message: string) { - super(message); - } -} \ No newline at end of file diff --git a/codbex-uoms/gen/codbex-uoms/codbex-uoms.openapi b/codbex-uoms/gen/codbex-uoms/codbex-uoms.openapi deleted file mode 100644 index 2a75d85..0000000 --- a/codbex-uoms/gen/codbex-uoms/codbex-uoms.openapi +++ /dev/null @@ -1,1375 +0,0 @@ -openapi: 3.0.3 -info: - title: UoM Management Application - OpenAPI 3.0 - version: 1.0.0 - description: Managing UoMs data -externalDocs: - description: Find out more about Eclipse Dirigible - url: https://dirigible.io -servers: - - url: /services/ts -tags: - - name: Settings - - name: Settings -paths: - /codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts: - get: - summary: List Dimension - parameters: - - in: query - name: $limit - description: The number of records to be returned _(both `$limit` and `$offset` should be provided)_. - required: false - allowReserved: true - schema: - type: integer - allowEmptyValue: true - - in: query - name: $offset - description: The number of records to skip _(both `$limit` and `$offset` should be provided)_. - required: false - allowReserved: true - schema: - type: integer - allowEmptyValue: true - tags: - - Settings - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Dimension' - 400: - description: Bad Request Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - post: - summary: Create Dimension - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Dimension' - required: true - responses: - 201: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/Dimension' - 400: - description: Bad Request Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts/{id}: - get: - summary: Get Dimension by Id - parameters: - - in: path - name: id - description: The Id of the entity. - required: true - schema: - type: string - tags: - - Settings - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Dimension' - 404: - description: Entity Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - put: - summary: Update Dimension by Id - parameters: - - in: path - name: id - description: The Id of the entity. - required: true - schema: - type: string - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Dimension' - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/Dimension' - 400: - description: Bad Request Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 404: - description: Entity Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - delete: - summary: Delete Dimension by Id - parameters: - - in: path - name: id - description: The Id of the entity. - required: true - schema: - type: string - tags: - - Settings - responses: - 204: - description: Successful Request - 404: - description: Entity Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts/count: - get: - summary: Count the number of Dimension - tags: - - Settings - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: integer - example: 100 - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - post: - summary: Count the number of Dimension by DimensionFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DimensionFilterOptions' - examples: - countWithMultipleCriteria: - summary: Count with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "abcd" - SAP: "abcd" - greaterThan: - Id: 0 - lessThanOrEqual: - Id: 100 - countWithEquals: - summary: Count with Equals - value: - $filter: - equals: - Id: 0 - countWithNotEquals: - summary: Count with Not Equals - value: - $filter: - notEquals: - Id: 0 - countWithContains: - summary: Count with Contains - value: - $filter: - contains: - Name: "abcd" - SAP: "abcd" - countWithGreaterThan: - summary: Count with Greater Than - value: - $filter: - greaterThan: - Id: 0 - countWithGreaterThanOrEqual: - summary: Count with Greater Than Or Equal - value: - $filter: - greaterThanOrEqual: - Id: 0 - countWithLessThan: - summary: Count with Less Than - value: - $filter: - lessThan: - Id: 0 - countWithLessThanOrEqual: - summary: Count with Less Than Or Equal - value: - $filter: - lessThanOrEqual: - Id: 0 - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: integer - example: 100 - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts/search: - post: - summary: Search Dimension by DimensionFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DimensionFilterOptions' - examples: - searchWithMultipleCriteria: - summary: Search with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "abcd" - SAP: "abcd" - greaterThan: - Id: 0 - lessThanOrEqual: - Id: 100 - searchWithEquals: - summary: Search with Equals - value: - $filter: - equals: - Id: 0 - searchWithNotEquals: - summary: Search with Not Equals - value: - $filter: - notEquals: - Id: 0 - searchWithContains: - summary: Search with Contains - value: - $filter: - contains: - Name: "abcd" - SAP: "abcd" - searchWithGreaterThan: - summary: Search with Greater Than - value: - $filter: - greaterThan: - Id: 0 - searchWithGreaterThanOrEqual: - summary: Search with Greater Than Or Equal - value: - $filter: - greaterThanOrEqual: - Id: 0 - searchWithLessThan: - summary: Search with Less Than - value: - $filter: - lessThan: - Id: 0 - searchWithLessThanOrEqual: - summary: Search with Less Than Or Equal - value: - $filter: - lessThanOrEqual: - Id: 0 - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Dimension' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts: - get: - summary: List UoM - parameters: - - in: query - name: $limit - description: The number of records to be returned _(both `$limit` and `$offset` should be provided)_. - required: false - allowReserved: true - schema: - type: integer - allowEmptyValue: true - - in: query - name: $offset - description: The number of records to skip _(both `$limit` and `$offset` should be provided)_. - required: false - allowReserved: true - schema: - type: integer - allowEmptyValue: true - tags: - - Settings - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UoM' - 400: - description: Bad Request Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - post: - summary: Create UoM - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UoM' - required: true - responses: - 201: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/UoM' - 400: - description: Bad Request Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts/{id}: - get: - summary: Get UoM by Id - parameters: - - in: path - name: id - description: The Id of the entity. - required: true - schema: - type: string - tags: - - Settings - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UoM' - 404: - description: Entity Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - put: - summary: Update UoM by Id - parameters: - - in: path - name: id - description: The Id of the entity. - required: true - schema: - type: string - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UoM' - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/UoM' - 400: - description: Bad Request Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 404: - description: Entity Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - delete: - summary: Delete UoM by Id - parameters: - - in: path - name: id - description: The Id of the entity. - required: true - schema: - type: string - tags: - - Settings - responses: - 204: - description: Successful Request - 404: - description: Entity Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts/count: - get: - summary: Count the number of UoM - tags: - - Settings - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: integer - example: 100 - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - post: - summary: Count the number of UoM by UoMFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UoMFilterOptions' - examples: - countWithMultipleCriteria: - summary: Count with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "abcd" - ISO: "abcd" - SAP: "abcd" - greaterThan: - Id: 0 - lessThanOrEqual: - Id: 100 - countWithEquals: - summary: Count with Equals - value: - $filter: - equals: - Id: 0 - countWithNotEquals: - summary: Count with Not Equals - value: - $filter: - notEquals: - Id: 0 - countWithContains: - summary: Count with Contains - value: - $filter: - contains: - Name: "abcd" - ISO: "abcd" - SAP: "abcd" - countWithGreaterThan: - summary: Count with Greater Than - value: - $filter: - greaterThan: - Id: 0 - countWithGreaterThanOrEqual: - summary: Count with Greater Than Or Equal - value: - $filter: - greaterThanOrEqual: - Id: 0 - countWithLessThan: - summary: Count with Less Than - value: - $filter: - lessThan: - Id: 0 - countWithLessThanOrEqual: - summary: Count with Less Than Or Equal - value: - $filter: - lessThanOrEqual: - Id: 0 - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: integer - example: 100 - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts/search: - post: - summary: Search UoM by UoMFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UoMFilterOptions' - examples: - searchWithMultipleCriteria: - summary: Search with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "abcd" - ISO: "abcd" - SAP: "abcd" - greaterThan: - Id: 0 - lessThanOrEqual: - Id: 100 - searchWithEquals: - summary: Search with Equals - value: - $filter: - equals: - Id: 0 - searchWithNotEquals: - summary: Search with Not Equals - value: - $filter: - notEquals: - Id: 0 - searchWithContains: - summary: Search with Contains - value: - $filter: - contains: - Name: "abcd" - ISO: "abcd" - SAP: "abcd" - searchWithGreaterThan: - summary: Search with Greater Than - value: - $filter: - greaterThan: - Id: 0 - searchWithGreaterThanOrEqual: - summary: Search with Greater Than Or Equal - value: - $filter: - greaterThanOrEqual: - Id: 0 - searchWithLessThan: - summary: Search with Less Than - value: - $filter: - lessThan: - Id: 0 - searchWithLessThanOrEqual: - summary: Search with Less Than Or Equal - value: - $filter: - lessThanOrEqual: - Id: 0 - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UoM' - 403: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' -components: - schemas: - Dimension: - type: object - required: - - Name - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - SAP: - type: string - minLength: 0 - maxLength: 20 - DimensionFilterOptions: - type: object - properties: - $filter: - type: object - properties: - equals: - type: object - properties: - Id: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - Name: - oneOf: - - type: string - minLength: 0 - maxLength: 100 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 100 - SAP: - oneOf: - - type: string - minLength: 0 - maxLength: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - notEquals: - type: object - properties: - Id: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - Name: - oneOf: - - type: string - minLength: 0 - maxLength: 100 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 100 - SAP: - oneOf: - - type: string - minLength: 0 - maxLength: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - contains: - type: object - properties: - Id: - Name: - type: string - minLength: 0 - maxLength: 100 - SAP: - type: string - minLength: 0 - maxLength: 20 - greaterThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - SAP: - type: string - minLength: 0 - maxLength: 20 - greaterThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - SAP: - type: string - minLength: 0 - maxLength: 20 - lessThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - SAP: - type: string - minLength: 0 - maxLength: 20 - lessThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - SAP: - type: string - minLength: 0 - maxLength: 20 - $select: - type: array - example: ["Id", "Name", "SAP"] - items: - type: string - $sort: - - type: string - example: "Id,Name,SAP" - $order: - type: string - enum: ["asc", "desc"] - example: "asc" - $offset: - type: integer - example: 0 - $limit: - type: integer - example: 10 - UoM: - type: object - required: - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - ISO: - type: string - minLength: 0 - maxLength: 20 - Dimension: - type: integer - format: int32 - SAP: - type: string - minLength: 0 - maxLength: 20 - Numerator: - type: integer - format: int64 - Denominator: - type: integer - format: int64 - Rounding: - type: integer - format: int32 - Base: - type: boolean - UoMFilterOptions: - type: object - properties: - $filter: - type: object - properties: - equals: - type: object - properties: - Id: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - Name: - oneOf: - - type: string - minLength: 0 - maxLength: 100 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 100 - ISO: - oneOf: - - type: string - minLength: 0 - maxLength: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - Dimension: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - SAP: - oneOf: - - type: string - minLength: 0 - maxLength: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - Numerator: - oneOf: - - type: integer - format: int64 - - type: array - items: - type: integer - format: int64 - Denominator: - oneOf: - - type: integer - format: int64 - - type: array - items: - type: integer - format: int64 - Rounding: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - Base: - oneOf: - - type: boolean - - type: array - items: - type: boolean - notEquals: - type: object - properties: - Id: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - Name: - oneOf: - - type: string - minLength: 0 - maxLength: 100 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 100 - ISO: - oneOf: - - type: string - minLength: 0 - maxLength: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - Dimension: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - SAP: - oneOf: - - type: string - minLength: 0 - maxLength: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - Numerator: - oneOf: - - type: integer - format: int64 - - type: array - items: - type: integer - format: int64 - Denominator: - oneOf: - - type: integer - format: int64 - - type: array - items: - type: integer - format: int64 - Rounding: - oneOf: - - type: integer - format: int32 - - type: array - items: - type: integer - format: int32 - Base: - oneOf: - - type: boolean - - type: array - items: - type: boolean - contains: - type: object - properties: - Id: - Name: - type: string - minLength: 0 - maxLength: 100 - ISO: - type: string - minLength: 0 - maxLength: 20 - Dimension: - SAP: - type: string - minLength: 0 - maxLength: 20 - Numerator: - Denominator: - Rounding: - Base: - greaterThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - ISO: - type: string - minLength: 0 - maxLength: 20 - Dimension: - type: integer - format: int32 - SAP: - type: string - minLength: 0 - maxLength: 20 - Numerator: - type: integer - format: int64 - Denominator: - type: integer - format: int64 - Rounding: - type: integer - format: int32 - Base: - greaterThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - ISO: - type: string - minLength: 0 - maxLength: 20 - Dimension: - type: integer - format: int32 - SAP: - type: string - minLength: 0 - maxLength: 20 - Numerator: - type: integer - format: int64 - Denominator: - type: integer - format: int64 - Rounding: - type: integer - format: int32 - Base: - lessThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - ISO: - type: string - minLength: 0 - maxLength: 20 - Dimension: - type: integer - format: int32 - SAP: - type: string - minLength: 0 - maxLength: 20 - Numerator: - type: integer - format: int64 - Denominator: - type: integer - format: int64 - Rounding: - type: integer - format: int32 - Base: - lessThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 100 - ISO: - type: string - minLength: 0 - maxLength: 20 - Dimension: - type: integer - format: int32 - SAP: - type: string - minLength: 0 - maxLength: 20 - Numerator: - type: integer - format: int64 - Denominator: - type: integer - format: int64 - Rounding: - type: integer - format: int32 - Base: - $select: - type: array - example: ["Id", "Name", "ISO", "Dimension", "SAP", "Numerator", "Denominator", "Rounding", "Base"] - items: - type: string - $sort: - - type: string - example: "Id,Name,ISO,Dimension,SAP,Numerator,Denominator,Rounding,Base" - $order: - type: string - enum: ["asc", "desc"] - example: "asc" - $offset: - type: integer - example: 0 - $limit: - type: integer - example: 10 - Error: - type: object - properties: - code: - type: integer - message: - type: string \ No newline at end of file diff --git a/codbex-uoms/gen/codbex-uoms/dao/Settings/DimensionRepository.ts b/codbex-uoms/gen/codbex-uoms/dao/Settings/DimensionRepository.ts index a86a982..351dfa3 100644 --- a/codbex-uoms/gen/codbex-uoms/dao/Settings/DimensionRepository.ts +++ b/codbex-uoms/gen/codbex-uoms/dao/Settings/DimensionRepository.ts @@ -1,7 +1,7 @@ -import { sql, query } from "sdk/db"; -import { producer } from "sdk/messaging"; -import { extensions } from "sdk/extensions"; -import { dao as daoApi } from "sdk/db"; +import { sql, query } from "@aerokit/sdk/db"; +import { producer } from "@aerokit/sdk/messaging"; +import { extensions } from "@aerokit/sdk/extensions"; +import { dao as daoApi } from "@aerokit/sdk/db"; export interface DimensionEntity { readonly Id: number; diff --git a/codbex-uoms/gen/codbex-uoms/dao/Settings/UoMRepository.ts b/codbex-uoms/gen/codbex-uoms/dao/Settings/UoMRepository.ts index a58560f..250ad1c 100644 --- a/codbex-uoms/gen/codbex-uoms/dao/Settings/UoMRepository.ts +++ b/codbex-uoms/gen/codbex-uoms/dao/Settings/UoMRepository.ts @@ -1,7 +1,7 @@ -import { sql, query } from "sdk/db"; -import { producer } from "sdk/messaging"; -import { extensions } from "sdk/extensions"; -import { dao as daoApi } from "sdk/db"; +import { sql, query } from "@aerokit/sdk/db"; +import { producer } from "@aerokit/sdk/messaging"; +import { extensions } from "@aerokit/sdk/extensions"; +import { dao as daoApi } from "@aerokit/sdk/db"; import { EntityUtils } from "../utils/EntityUtils"; export interface UoMEntity { diff --git a/codbex-uoms/gen/codbex-uoms/data/Settings/Dimension.extensionpoint b/codbex-uoms/gen/codbex-uoms/data/Settings/Dimension.extensionpoint new file mode 100644 index 0000000..78ace43 --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/data/Settings/Dimension.extensionpoint @@ -0,0 +1,4 @@ +{ + "name": "codbex-uoms-Settings-Dimension", + "description": "Extension Point for the codbex-uoms-Settings-Dimension entity" +} \ No newline at end of file diff --git a/codbex-uoms/gen/codbex-uoms/data/Settings/DimensionEntity.ts b/codbex-uoms/gen/codbex-uoms/data/Settings/DimensionEntity.ts new file mode 100644 index 0000000..80c22bf --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/data/Settings/DimensionEntity.ts @@ -0,0 +1,36 @@ +import { Entity, Table, Id, Generated, Column, Documentation } from '@aerokit/sdk/db' + +@Entity('DimensionEntity') +@Table('CODBEX_DIMENSION') +@Documentation('Dimension entity mapping') +export class DimensionEntity { + + @Id() + @Generated('sequence') + @Documentation('Id') + @Column({ + name: 'DIMENSION_ID', + type: 'integer', + }) + public Id?: number; + + @Documentation('Name') + @Column({ + name: 'DIMENSION_NAME', + type: 'string', + length: 100, + }) + public Name!: string; + + @Documentation('SAP') + @Column({ + name: 'DIMENSION_SAP', + type: 'string', + length: 20, + nullable: true, + }) + public SAP?: string; + +} + +(new DimensionEntity()); diff --git a/codbex-uoms/gen/codbex-uoms/data/Settings/DimensionRepository.ts b/codbex-uoms/gen/codbex-uoms/data/Settings/DimensionRepository.ts new file mode 100644 index 0000000..ec5ed37 --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/data/Settings/DimensionRepository.ts @@ -0,0 +1,25 @@ +import { Repository, EntityEvent, EntityConstructor } from '@aerokit/sdk/db' +import { Component } from '@aerokit/sdk/component' +import { Producer } from '@aerokit/sdk/messaging' +import { Extensions } from '@aerokit/sdk/extensions' +import { DimensionEntity } from './DimensionEntity' + +@Component('DimensionRepository') +export class DimensionRepository extends Repository { + + constructor() { + super((DimensionEntity as EntityConstructor)); + } + + protected override async triggerEvent(data: EntityEvent): Promise { + const triggerExtensions = await Extensions.loadExtensionModules('codbex-uoms-Settings-Dimension', ['trigger']); + triggerExtensions.forEach(triggerExtension => { + try { + triggerExtension.trigger(data); + } catch (error) { + console.error(error); + } + }); + Producer.topic('codbex-uoms-Settings-Dimension').send(JSON.stringify(data)); + } +} diff --git a/codbex-uoms/gen/codbex-uoms/data/Settings/UoM.extensionpoint b/codbex-uoms/gen/codbex-uoms/data/Settings/UoM.extensionpoint new file mode 100644 index 0000000..d1a4785 --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/data/Settings/UoM.extensionpoint @@ -0,0 +1,4 @@ +{ + "name": "codbex-uoms-Settings-UoM", + "description": "Extension Point for the codbex-uoms-Settings-UoM entity" +} \ No newline at end of file diff --git a/codbex-uoms/gen/codbex-uoms/data/Settings/UoMEntity.ts b/codbex-uoms/gen/codbex-uoms/data/Settings/UoMEntity.ts new file mode 100644 index 0000000..746d120 --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/data/Settings/UoMEntity.ts @@ -0,0 +1,86 @@ +import { Entity, Table, Id, Generated, Column, Documentation } from '@aerokit/sdk/db' + +@Entity('UoMEntity') +@Table('CODBEX_UOM') +@Documentation('UoM entity mapping') +export class UoMEntity { + + @Id() + @Generated('sequence') + @Documentation('Id') + @Column({ + name: 'UOM_ID', + type: 'integer', + }) + public Id?: number; + + @Documentation('Name') + @Column({ + name: 'UOM_NAME', + type: 'string', + length: 100, + nullable: true, + }) + public Name?: string; + + @Documentation('ISO') + @Column({ + name: 'UOM_ISO', + type: 'string', + length: 20, + nullable: true, + }) + public ISO?: string; + + @Documentation('Dimension') + @Column({ + name: 'UOM_DIMENSION', + type: 'integer', + nullable: true, + }) + public Dimension?: number; + + @Documentation('SAP') + @Column({ + name: 'UOM_SAP', + type: 'string', + length: 20, + nullable: true, + }) + public SAP?: string; + + @Documentation('Numerator') + @Column({ + name: 'UOM_NUMERATOR', + type: 'long', + nullable: true, + }) + public Numerator?: number; + + @Documentation('Denominator') + @Column({ + name: 'UOM_DENOMINATOR', + type: 'long', + nullable: true, + }) + public Denominator?: number; + + @Documentation('Rounding') + @Column({ + name: 'UOM_ROUNDING', + type: 'integer', + nullable: true, + }) + public Rounding?: number; + + @Documentation('Base') + @Column({ + name: 'UOM_BASE', + type: 'boolean', + nullable: true, + }) + public Base?: boolean; + +} + +(new UoMEntity()); diff --git a/codbex-uoms/gen/codbex-uoms/data/Settings/UoMRepository.ts b/codbex-uoms/gen/codbex-uoms/data/Settings/UoMRepository.ts new file mode 100644 index 0000000..f05d45e --- /dev/null +++ b/codbex-uoms/gen/codbex-uoms/data/Settings/UoMRepository.ts @@ -0,0 +1,25 @@ +import { Repository, EntityEvent, EntityConstructor } from '@aerokit/sdk/db' +import { Component } from '@aerokit/sdk/component' +import { Producer } from '@aerokit/sdk/messaging' +import { Extensions } from '@aerokit/sdk/extensions' +import { UoMEntity } from './UoMEntity' + +@Component('UoMRepository') +export class UoMRepository extends Repository { + + constructor() { + super((UoMEntity as EntityConstructor)); + } + + protected override async triggerEvent(data: EntityEvent): Promise { + const triggerExtensions = await Extensions.loadExtensionModules('codbex-uoms-Settings-UoM', ['trigger']); + triggerExtensions.forEach(triggerExtension => { + try { + triggerExtension.trigger(data); + } catch (error) { + console.error(error); + } + }); + Producer.topic('codbex-uoms-Settings-UoM').send(JSON.stringify(data)); + } +} diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/controller.js b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/controller.js index 44591e6..3bebf58 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/controller.js +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts'; }]) .controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); @@ -87,8 +87,11 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer let limit = $scope.dataLimit; let request; if (filter) { - filter.$offset = offset; - filter.$limit = limit; + if (!filter.$filter) { + filter.$filter = {}; + } + filter.$filter.offset = offset; + filter.$filter.limit = limit; request = EntityService.search(filter); } else { request = EntityService.list(offset, limit); diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/controller.js b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/controller.js index 044ea8b..0f7b711 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/controller.js +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/controller.js @@ -21,30 +21,23 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle let entity = $scope.entity; const filter = { $filter: { - equals: { - }, - notEquals: { - }, - contains: { - }, - greaterThan: { - }, - greaterThanOrEqual: { - }, - lessThan: { - }, - lessThanOrEqual: { - } - }, + conditions: [], + sorts: [], + limit: 20, + offset: 0 + } }; if (entity.Id !== undefined) { - filter.$filter.equals.Id = entity.Id; + const condition = { propertyName: 'Id', operator: 'EQ', value: entity.Id }; + filter.$filter.conditions.push(condition); } if (entity.Name) { - filter.$filter.contains.Name = entity.Name; + const condition = { propertyName: 'Name', operator: 'LIKE', value: `%${entity.Name}%` }; + filter.$filter.conditions.push(condition); } if (entity.SAP) { - filter.$filter.contains.SAP = entity.SAP; + const condition = { propertyName: 'SAP', operator: 'LIKE', value: `%${entity.SAP}%` }; + filter.$filter.conditions.push(condition); } Dialogs.postMessage({ topic: 'codbex-uoms.Settings.Dimension.entitySearch', data: { entity: entity, diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/index.html b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/index.html index 3aa7091..fad07a3 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/index.html +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-filter/index.html @@ -7,8 +7,7 @@ - - + diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/controller.js b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/controller.js index 1250741..8abf6bc 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/controller.js +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/index.html b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/index.html index 24d23d5..f38efa7 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/index.html +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/dialog-window/index.html @@ -7,9 +7,8 @@ - + - diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/index.html b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/index.html index 85ad68d..c79b4c3 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/index.html +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/Dimension/index.html @@ -7,9 +7,8 @@ - + - diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/controller.js b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/controller.js index 11c81a7..d5ab9a7 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/controller.js +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/UoMController.ts'; }]) .controller('PageController', ($scope, $http, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); @@ -87,8 +87,11 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer let limit = $scope.dataLimit; let request; if (filter) { - filter.$offset = offset; - filter.$limit = limit; + if (!filter.$filter) { + filter.$filter = {}; + } + filter.$filter.offset = offset; + filter.$filter.limit = limit; request = EntityService.search(filter); } else { request = EntityService.list(offset, limit); @@ -204,7 +207,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.optionsDimension = []; - $http.get('/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts').then((response) => { + $http.get('/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts').then((response) => { $scope.optionsDimension = response.data.map(e => ({ value: e.Id, text: e.Name diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/controller.js b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/controller.js index 1e02dea..6239e64 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/controller.js +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/controller.js @@ -22,48 +22,47 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle let entity = $scope.entity; const filter = { $filter: { - equals: { - }, - notEquals: { - }, - contains: { - }, - greaterThan: { - }, - greaterThanOrEqual: { - }, - lessThan: { - }, - lessThanOrEqual: { - } - }, + conditions: [], + sorts: [], + limit: 20, + offset: 0 + } }; if (entity.Id !== undefined) { - filter.$filter.equals.Id = entity.Id; + const condition = { propertyName: 'Id', operator: 'EQ', value: entity.Id }; + filter.$filter.conditions.push(condition); } if (entity.Name) { - filter.$filter.contains.Name = entity.Name; + const condition = { propertyName: 'Name', operator: 'LIKE', value: `%${entity.Name}%` }; + filter.$filter.conditions.push(condition); } if (entity.ISO) { - filter.$filter.contains.ISO = entity.ISO; + const condition = { propertyName: 'ISO', operator: 'LIKE', value: `%${entity.ISO}%` }; + filter.$filter.conditions.push(condition); } if (entity.Dimension !== undefined) { - filter.$filter.equals.Dimension = entity.Dimension; + const condition = { propertyName: 'Dimension', operator: 'EQ', value: entity.Dimension }; + filter.$filter.conditions.push(condition); } if (entity.SAP) { - filter.$filter.contains.SAP = entity.SAP; + const condition = { propertyName: 'SAP', operator: 'LIKE', value: `%${entity.SAP}%` }; + filter.$filter.conditions.push(condition); } if (entity.Numerator !== undefined) { - filter.$filter.equals.Numerator = entity.Numerator; + const condition = { propertyName: 'Numerator', operator: 'EQ', value: entity.Numerator }; + filter.$filter.conditions.push(condition); } if (entity.Denominator !== undefined) { - filter.$filter.equals.Denominator = entity.Denominator; + const condition = { propertyName: 'Denominator', operator: 'EQ', value: entity.Denominator }; + filter.$filter.conditions.push(condition); } if (entity.Rounding !== undefined) { - filter.$filter.equals.Rounding = entity.Rounding; + const condition = { propertyName: 'Rounding', operator: 'EQ', value: entity.Rounding }; + filter.$filter.conditions.push(condition); } if (entity.Base !== undefined && entity.isBaseIndeterminate === false) { - filter.$filter.equals.Base = entity.Base; + const condition = { propertyName: 'Base', operator: 'EQ', value: entity.Base }; + filter.$filter.conditions.push(condition); } Dialogs.postMessage({ topic: 'codbex-uoms.Settings.UoM.entitySearch', data: { entity: entity, diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/index.html b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/index.html index bb4ae91..caf841a 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/index.html +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-filter/index.html @@ -7,8 +7,7 @@ - - + diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/controller.js b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/controller.js index 806694c..0e5ef6a 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/controller.js +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/UoMService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/UoMController.ts'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); @@ -79,11 +79,11 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); }; - $scope.serviceDimension = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts'; + $scope.serviceDimension = '/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts'; $scope.optionsDimension = []; - $http.get('/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionService.ts').then((response) => { + $http.get('/services/ts/codbex-uoms/gen/codbex-uoms/api/Settings/DimensionController.ts').then((response) => { $scope.optionsDimension = response.data.map(e => ({ value: e.Id, text: e.Name diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/index.html b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/index.html index e2ab2a8..d84607c 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/index.html +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/dialog-window/index.html @@ -7,9 +7,8 @@ - + - diff --git a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/index.html b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/index.html index 2bbceb5..abb8ef8 100644 --- a/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/index.html +++ b/codbex-uoms/gen/codbex-uoms/ui/Settings/UoM/index.html @@ -7,9 +7,8 @@ - + -