diff --git a/codbex-methods/codbex-methods.gen b/codbex-methods/codbex-methods.gen index ed5b85e..7708630 100644 --- a/codbex-methods/codbex-methods.gen +++ b/codbex-methods/codbex-methods.gen @@ -2,28 +2,15 @@ "tablePrefix": "CODBEX_", "brand": "codbex", "brandUrl": "https://www.codbex.com/", - "title": "Methods Managing module", - "description": "Module for managing methods", - "dataSource": "DefaultDB", - "fileName": "codbex-methods", - "genFolderName": "codbex-methods", - "roles": [ - { - "entityName": "PaymentMethod", - "roleRead": "codbex-methods.PaymentMethod.PaymentMethodReadOnly", - "roleWrite": "codbex-methods.PaymentMethod.PaymentMethodFullAccess" - }, - { - "entityName": "SentMethod", - "roleRead": "codbex-methods.SentMethod.SentMethodReadOnly", - "roleWrite": "codbex-methods.SentMethod.SentMethodFullAccess" - } - ], - "tprefix": "codbex-methods-model", + "title": "Methods management module", + "description": "Managing methods data", "projectName": "codbex-methods", "workspaceName": "workspace", "filePath": "codbex-methods.model", - "templateId": "template-application-angular/template/template.js", + "templateId": "template-application-angular-v2/template/template.js", + "fileName": "codbex-methods", + "genFolderName": "codbex-methods", + "dataSource": "DefaultDB", "perspectives": { "Settings": { "views": [ @@ -39,6 +26,19 @@ "role": "" } }, + "roles": [ + { + "entityName": "PaymentMethod", + "roleRead": "codbex-methods.PaymentMethod.PaymentMethodReadOnly", + "roleWrite": "codbex-methods.PaymentMethod.PaymentMethodFullAccess" + }, + { + "entityName": "SentMethod", + "roleRead": "codbex-methods.SentMethod.SentMethodReadOnly", + "roleWrite": "codbex-methods.SentMethod.SentMethodFullAccess" + } + ], + "tprefix": "codbex-methods-model", "models": [ { "properties": [ diff --git a/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts b/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts new file mode 100644 index 0000000..d43b7c1 --- /dev/null +++ b/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts @@ -0,0 +1,175 @@ +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 { PaymentMethodRepository } from '../../data/Settings/PaymentMethodRepository' +import { PaymentMethodEntity } from '../../data/Settings/PaymentMethodEntity' + +const validationModules = await Extensions.loadExtensionModules('codbex-methods-Settings-PaymentMethod', ['validate']); + +@Controller +@Documentation('codbex-methods - PaymentMethod Controller') +@Injected() +class PaymentMethodController { + + @Inject('PaymentMethodRepository') + private readonly repository!: PaymentMethodRepository; + + @Get('/') + @Documentation('Get All PaymentMethod') + public getAll(_: any, ctx: any): PaymentMethodEntity[] { + 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 PaymentMethod') + public create(entity: PaymentMethodEntity): PaymentMethodEntity { + try { + this.checkPermissions('write'); + this.validateEntity(entity); + entity.Id = this.repository.create(entity) as any; + response.setHeader('Content-Location', '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts/' + entity.Id); + response.setStatus(response.CREATED); + return entity; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/count') + @Documentation('Count PaymentMethod') + 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 PaymentMethod 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 PaymentMethod') + public search(filter: any): PaymentMethodEntity[] { + try { + this.checkPermissions('read'); + return this.repository.findAll(filter); + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/:id') + @Documentation('Get PaymentMethod by id') + public getById(_: any, ctx: any): PaymentMethodEntity { + 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('PaymentMethod not found'); + } + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Put('/:id') + @Documentation('Update PaymentMethod by id') + public update(entity: PaymentMethodEntity, ctx: any): PaymentMethodEntity { + 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 PaymentMethod 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('PaymentMethod 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-methods.PaymentMethod.PaymentMethodReadOnly') || user.isInRole('codbex-methods.PaymentMethod.PaymentMethodFullAccess'))) { + throw new ForbiddenError(); + } + if (operationType === 'write' && !user.isInRole('codbex-methods.PaymentMethod.PaymentMethodFullAccess')) { + throw new ForbiddenError(); + } + } + + private validateEntity(entity: any): void { + if (entity.Name?.length > 20) { + throw new ValidationError(`The 'Name' exceeds the maximum length of [20] characters`); + } + for (const next of validationModules) { + next.validate(entity); + } + } + +} diff --git a/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts b/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts deleted file mode 100644 index a1bc966..0000000 --- a/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { Controller, Get, Post, Put, Delete, request, response } from "@aerokit/sdk/http" -import { Extensions } from "@aerokit/sdk/extensions" -import { PaymentMethodRepository, PaymentMethodEntityOptions } from "../../dao/Settings/PaymentMethodRepository"; -import { user } from "@aerokit/sdk/security" -import { ForbiddenError } from "../utils/ForbiddenError"; -import { ValidationError } from "../utils/ValidationError"; -import { HttpUtils } from "../utils/HttpUtils"; - -const validationModules = await Extensions.loadExtensionModules("codbex-methods-Settings-PaymentMethod", ["validate"]); - -@Controller -class PaymentMethodService { - - private readonly repository = new PaymentMethodRepository(); - - @Get("/") - public getAll(_: any, ctx: any) { - try { - this.checkPermissions("read"); - const options: PaymentMethodEntityOptions = { - $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-methods/gen/codbex-methods/api/Settings/PaymentMethodService.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: PaymentMethodEntityOptions = { - $language: request.getLocale().slice(0, 2) - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound("PaymentMethod 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("PaymentMethod 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-methods.PaymentMethod.PaymentMethodReadOnly") || user.isInRole("codbex-methods.PaymentMethod.PaymentMethodFullAccess"))) { - throw new ForbiddenError(); - } - if (operationType === "write" && !user.isInRole("codbex-methods.PaymentMethod.PaymentMethodFullAccess")) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.Name?.length > 20) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-methods/gen/codbex-methods/api/Settings/SentMethodController.ts b/codbex-methods/gen/codbex-methods/api/Settings/SentMethodController.ts new file mode 100644 index 0000000..5134981 --- /dev/null +++ b/codbex-methods/gen/codbex-methods/api/Settings/SentMethodController.ts @@ -0,0 +1,175 @@ +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 { SentMethodRepository } from '../../data/Settings/SentMethodRepository' +import { SentMethodEntity } from '../../data/Settings/SentMethodEntity' + +const validationModules = await Extensions.loadExtensionModules('codbex-methods-Settings-SentMethod', ['validate']); + +@Controller +@Documentation('codbex-methods - SentMethod Controller') +@Injected() +class SentMethodController { + + @Inject('SentMethodRepository') + private readonly repository!: SentMethodRepository; + + @Get('/') + @Documentation('Get All SentMethod') + public getAll(_: any, ctx: any): SentMethodEntity[] { + 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 SentMethod') + public create(entity: SentMethodEntity): SentMethodEntity { + try { + this.checkPermissions('write'); + this.validateEntity(entity); + entity.Id = this.repository.create(entity) as any; + response.setHeader('Content-Location', '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/SentMethodService.ts/' + entity.Id); + response.setStatus(response.CREATED); + return entity; + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/count') + @Documentation('Count SentMethod') + 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 SentMethod 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 SentMethod') + public search(filter: any): SentMethodEntity[] { + try { + this.checkPermissions('read'); + return this.repository.findAll(filter); + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Get('/:id') + @Documentation('Get SentMethod by id') + public getById(_: any, ctx: any): SentMethodEntity { + 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('SentMethod not found'); + } + } catch (error: any) { + this.handleError(error); + } + return undefined as any; + } + + @Put('/:id') + @Documentation('Update SentMethod by id') + public update(entity: SentMethodEntity, ctx: any): SentMethodEntity { + 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 SentMethod 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('SentMethod 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-methods.SentMethod.SentMethodReadOnly') || user.isInRole('codbex-methods.SentMethod.SentMethodFullAccess'))) { + throw new ForbiddenError(); + } + if (operationType === 'write' && !user.isInRole('codbex-methods.SentMethod.SentMethodFullAccess')) { + throw new ForbiddenError(); + } + } + + private validateEntity(entity: any): void { + if (entity.Name?.length > 20) { + throw new ValidationError(`The 'Name' exceeds the maximum length of [20] characters`); + } + for (const next of validationModules) { + next.validate(entity); + } + } + +} diff --git a/codbex-methods/gen/codbex-methods/api/Settings/SentMethodService.ts b/codbex-methods/gen/codbex-methods/api/Settings/SentMethodService.ts deleted file mode 100644 index 96e480f..0000000 --- a/codbex-methods/gen/codbex-methods/api/Settings/SentMethodService.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { Controller, Get, Post, Put, Delete, request, response } from "@aerokit/sdk/http" -import { Extensions } from "@aerokit/sdk/extensions" -import { SentMethodRepository, SentMethodEntityOptions } from "../../dao/Settings/SentMethodRepository"; -import { user } from "@aerokit/sdk/security" -import { ForbiddenError } from "../utils/ForbiddenError"; -import { ValidationError } from "../utils/ValidationError"; -import { HttpUtils } from "../utils/HttpUtils"; - -const validationModules = await Extensions.loadExtensionModules("codbex-methods-Settings-SentMethod", ["validate"]); - -@Controller -class SentMethodService { - - private readonly repository = new SentMethodRepository(); - - @Get("/") - public getAll(_: any, ctx: any) { - try { - this.checkPermissions("read"); - const options: SentMethodEntityOptions = { - $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-methods/gen/codbex-methods/api/Settings/SentMethodService.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: SentMethodEntityOptions = { - $language: request.getLocale().slice(0, 2) - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound("SentMethod 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("SentMethod 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-methods.SentMethod.SentMethodReadOnly") || user.isInRole("codbex-methods.SentMethod.SentMethodFullAccess"))) { - throw new ForbiddenError(); - } - if (operationType === "write" && !user.isInRole("codbex-methods.SentMethod.SentMethodFullAccess")) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.Name?.length > 20) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-methods/gen/codbex-methods/api/utils/ForbiddenError.ts b/codbex-methods/gen/codbex-methods/api/utils/ForbiddenError.ts deleted file mode 100644 index 775ae84..0000000 --- a/codbex-methods/gen/codbex-methods/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-methods/gen/codbex-methods/api/utils/HttpUtils.ts b/codbex-methods/gen/codbex-methods/api/utils/HttpUtils.ts deleted file mode 100644 index 08fbd20..0000000 --- a/codbex-methods/gen/codbex-methods/api/utils/HttpUtils.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { response } from "@aerokit/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)); - } - } -} diff --git a/codbex-methods/gen/codbex-methods/api/utils/ValidationError.ts b/codbex-methods/gen/codbex-methods/api/utils/ValidationError.ts deleted file mode 100644 index 9b894fa..0000000 --- a/codbex-methods/gen/codbex-methods/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-methods/gen/codbex-methods/codbex-methods.openapi b/codbex-methods/gen/codbex-methods/codbex-methods.openapi deleted file mode 100644 index caffabd..0000000 --- a/codbex-methods/gen/codbex-methods/codbex-methods.openapi +++ /dev/null @@ -1,1077 +0,0 @@ -openapi: 3.0.3 -info: - title: Methods Managing module - OpenAPI 3.0 - version: 1.0.0 - description: Module for managing methods -externalDocs: - description: Find out more about Eclipse Dirigible - url: https://dirigible.io -servers: - - url: /services/ts -tags: - - name: Settings - - name: Settings -paths: - /codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts: - get: - summary: List PaymentMethod - 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/PaymentMethod' - 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 PaymentMethod - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PaymentMethod' - required: true - responses: - 201: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/PaymentMethod' - 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-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts/{id}: - get: - summary: Get PaymentMethod 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/PaymentMethod' - 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 PaymentMethod 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/PaymentMethod' - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/PaymentMethod' - 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 PaymentMethod 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-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts/count: - get: - summary: Count the number of PaymentMethod - 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 PaymentMethod by PaymentMethodFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PaymentMethodFilterOptions' - examples: - countWithMultipleCriteria: - summary: Count with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "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" - 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-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts/search: - post: - summary: Search PaymentMethod by PaymentMethodFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PaymentMethodFilterOptions' - examples: - searchWithMultipleCriteria: - summary: Search with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "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" - 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/PaymentMethod' - 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-methods/gen/codbex-methods/api/Settings/SentMethodService.ts: - get: - summary: List SentMethod - 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/SentMethod' - 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 SentMethod - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/SentMethod' - required: true - responses: - 201: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/SentMethod' - 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-methods/gen/codbex-methods/api/Settings/SentMethodService.ts/{id}: - get: - summary: Get SentMethod 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/SentMethod' - 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 SentMethod 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/SentMethod' - required: true - responses: - 200: - description: Successful Request - content: - application/json: - schema: - $ref: '#/components/schemas/SentMethod' - 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 SentMethod 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-methods/gen/codbex-methods/api/Settings/SentMethodService.ts/count: - get: - summary: Count the number of SentMethod - 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 SentMethod by SentMethodFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/SentMethodFilterOptions' - examples: - countWithMultipleCriteria: - summary: Count with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "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" - 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-methods/gen/codbex-methods/api/Settings/SentMethodService.ts/search: - post: - summary: Search SentMethod by SentMethodFilterOptions - tags: - - Settings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/SentMethodFilterOptions' - examples: - searchWithMultipleCriteria: - summary: Search with multiple criteria - value: - $filter: - notEquals: - Id: 33 - contains: - Name: "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" - 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/SentMethod' - 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: - PaymentMethod: - type: object - required: - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - PaymentMethodFilterOptions: - 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: 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: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - contains: - type: object - properties: - Id: - Name: - type: string - minLength: 0 - maxLength: 20 - greaterThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - greaterThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - lessThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - lessThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - $select: - type: array - example: ["Id", "Name"] - items: - type: string - $sort: - - type: string - example: "Id,Name" - $order: - type: string - enum: ["asc", "desc"] - example: "asc" - $offset: - type: integer - example: 0 - $limit: - type: integer - example: 10 - SentMethod: - type: object - required: - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - SentMethodFilterOptions: - 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: 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: 20 - - type: array - items: - type: string - format: double - minLength: 0 - maxLength: 20 - contains: - type: object - properties: - Id: - Name: - type: string - minLength: 0 - maxLength: 20 - greaterThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - greaterThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - lessThan: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - lessThanOrEqual: - type: object - properties: - Id: - type: integer - format: int32 - Name: - type: string - minLength: 0 - maxLength: 20 - $select: - type: array - example: ["Id", "Name"] - items: - type: string - $sort: - - type: string - example: "Id,Name" - $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-methods/gen/codbex-methods/data/Settings/PaymentMethod.extensionpoint b/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethod.extensionpoint new file mode 100644 index 0000000..f89539b --- /dev/null +++ b/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethod.extensionpoint @@ -0,0 +1,4 @@ +{ + "name": "codbex-methods-Settings-PaymentMethod", + "description": "Extension Point for the codbex-methods-Settings-PaymentMethod entity" +} \ No newline at end of file diff --git a/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethodEntity.ts b/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethodEntity.ts new file mode 100644 index 0000000..d495907 --- /dev/null +++ b/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethodEntity.ts @@ -0,0 +1,28 @@ +import { Entity, Table, Id, Generated, Column, Documentation } from '@aerokit/sdk/db' + +@Entity('PaymentMethodEntity') +@Table('CODBEX_PAYMENTMETHOD') +@Documentation('PaymentMethod entity mapping') +export class PaymentMethodEntity { + + @Id() + @Generated('sequence') + @Documentation('Id') + @Column({ + name: 'PAYMENTMETHOD_ID', + type: 'integer', + }) + public Id?: number; + + @Documentation('Name') + @Column({ + name: 'PAYMENTMETHOD_NAME', + type: 'string', + length: 20, + nullable: true, + }) + public Name?: string; + +} + +(new PaymentMethodEntity()); diff --git a/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethodRepository.ts b/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethodRepository.ts new file mode 100644 index 0000000..0586d83 --- /dev/null +++ b/codbex-methods/gen/codbex-methods/data/Settings/PaymentMethodRepository.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 { PaymentMethodEntity } from './PaymentMethodEntity' + +@Component('PaymentMethodRepository') +export class PaymentMethodRepository extends Repository { + + constructor() { + super((PaymentMethodEntity as EntityConstructor)); + } + + protected override async triggerEvent(data: EntityEvent): Promise { + const triggerExtensions = await Extensions.loadExtensionModules('codbex-methods-Settings-PaymentMethod', ['trigger']); + triggerExtensions.forEach(triggerExtension => { + try { + triggerExtension.trigger(data); + } catch (error) { + console.error(error); + } + }); + Producer.topic('codbex-methods-Settings-PaymentMethod').send(JSON.stringify(data)); + } +} diff --git a/codbex-methods/gen/codbex-methods/data/Settings/SentMethod.extensionpoint b/codbex-methods/gen/codbex-methods/data/Settings/SentMethod.extensionpoint new file mode 100644 index 0000000..2fa0b47 --- /dev/null +++ b/codbex-methods/gen/codbex-methods/data/Settings/SentMethod.extensionpoint @@ -0,0 +1,4 @@ +{ + "name": "codbex-methods-Settings-SentMethod", + "description": "Extension Point for the codbex-methods-Settings-SentMethod entity" +} \ No newline at end of file diff --git a/codbex-methods/gen/codbex-methods/data/Settings/SentMethodEntity.ts b/codbex-methods/gen/codbex-methods/data/Settings/SentMethodEntity.ts new file mode 100644 index 0000000..57127e2 --- /dev/null +++ b/codbex-methods/gen/codbex-methods/data/Settings/SentMethodEntity.ts @@ -0,0 +1,28 @@ +import { Entity, Table, Id, Generated, Column, Documentation } from '@aerokit/sdk/db' + +@Entity('SentMethodEntity') +@Table('CODBEX_SENTMETHOD') +@Documentation('SentMethod entity mapping') +export class SentMethodEntity { + + @Id() + @Generated('sequence') + @Documentation('Id') + @Column({ + name: 'SENTMETHOD_ID', + type: 'integer', + }) + public Id?: number; + + @Documentation('Name') + @Column({ + name: 'SENTMETHOD_NAME', + type: 'string', + length: 20, + nullable: true, + }) + public Name?: string; + +} + +(new SentMethodEntity()); diff --git a/codbex-methods/gen/codbex-methods/data/Settings/SentMethodRepository.ts b/codbex-methods/gen/codbex-methods/data/Settings/SentMethodRepository.ts new file mode 100644 index 0000000..fbd15be --- /dev/null +++ b/codbex-methods/gen/codbex-methods/data/Settings/SentMethodRepository.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 { SentMethodEntity } from './SentMethodEntity' + +@Component('SentMethodRepository') +export class SentMethodRepository extends Repository { + + constructor() { + super((SentMethodEntity as EntityConstructor)); + } + + protected override async triggerEvent(data: EntityEvent): Promise { + const triggerExtensions = await Extensions.loadExtensionModules('codbex-methods-Settings-SentMethod', ['trigger']); + triggerExtensions.forEach(triggerExtension => { + try { + triggerExtension.trigger(data); + } catch (error) { + console.error(error); + } + }); + Producer.topic('codbex-methods-Settings-SentMethod').send(JSON.stringify(data)); + } +} diff --git a/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/controller.js b/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/controller.js index 7ed0cf1..50e4915 100644 --- a/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/controller.js +++ b/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.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-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-filter/controller.js b/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-filter/controller.js index 84a4c2f..106d888 100644 --- a/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-filter/controller.js +++ b/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-filter/controller.js @@ -21,27 +21,19 @@ 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); } Dialogs.postMessage({ topic: 'codbex-methods.Settings.PaymentMethod.entitySearch', data: { entity: entity, diff --git a/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-window/controller.js b/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-window/controller.js index d5272d4..89e1f64 100644 --- a/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-window/controller.js +++ b/codbex-methods/gen/codbex-methods/ui/Settings/PaymentMethod/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); diff --git a/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/controller.js b/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/controller.js index c4c6aae..3524409 100644 --- a/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/controller.js +++ b/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/SentMethodService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/SentMethodController.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-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-filter/controller.js b/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-filter/controller.js index af79c75..d22f0de 100644 --- a/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-filter/controller.js +++ b/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-filter/controller.js @@ -21,27 +21,19 @@ 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); } Dialogs.postMessage({ topic: 'codbex-methods.Settings.SentMethod.entitySearch', data: { entity: entity, diff --git a/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-window/controller.js b/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-window/controller.js index df1bc4a..1ec958b 100644 --- a/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-window/controller.js +++ b/codbex-methods/gen/codbex-methods/ui/Settings/SentMethod/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/SentMethodService.ts'; + EntityServiceProvider.baseUrl = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/SentMethodController.ts'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub();