@veloceapps/api 7.0.2-53 → 7.0.2-54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import * as i0 from '@angular/core';
4
4
  import { Injectable, NgModule } from '@angular/core';
5
5
  import * as i1 from '@veloceapps/core';
6
6
  import { uiDefinitionFromDTO, isLegacyUIDefinition, ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, Operator, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { noop, throwError, of, zip, forkJoin, map as map$1, catchError as catchError$1, switchMap as switchMap$1, delay } from 'rxjs';
7
+ import { noop, throwError, of, zip, forkJoin, map as map$1, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
8
8
  import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
9
9
  import * as i2 from 'primeng/api';
10
10
  import { CurrencyPipe } from '@angular/common';
@@ -2491,96 +2491,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2491
2491
  type: Injectable
2492
2492
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2493
2493
 
2494
- const categories = [
2495
- { id: '1', name: 'Category 1' },
2496
- { id: '2', name: 'Category 2', parentId: '1' },
2497
- { id: '3', name: 'Category 3', parentId: '1' },
2498
- { id: '4', name: 'Category 4' },
2499
- { id: '5', name: 'Category 5', parentId: '4' },
2500
- { id: '6', name: 'Category 6', parentId: '2' },
2501
- ];
2502
- const objects = [
2503
- {
2504
- id: '1',
2505
- name: 'Loyality_Data',
2506
- label: 'Loyality Data',
2507
- categoryId: '1',
2508
- columns: [
2509
- { name: 'Account', label: 'Account', type: 'OBJECT', objectName: 'Account' },
2510
- { name: 'Boolean', label: 'Boolean', type: 'BOOLEAN' },
2511
- { name: 'Date', label: 'Date', type: 'DATE' },
2512
- { name: 'Integer', label: 'Integer', type: 'INTEGER' },
2513
- { name: 'Discount', label: 'Discount, %', type: 'DECIMAL' },
2514
- { name: 'Level', label: 'Level', type: 'STRING' },
2515
- ],
2516
- data: [
2517
- {
2518
- id: '1',
2519
- Account: '001DH00000uEMFaYAO',
2520
- Boolean: true,
2521
- Integer: 1,
2522
- Date: '2023-06-30',
2523
- Discount: 33.5,
2524
- Level: 'Premium',
2525
- },
2526
- {
2527
- id: '2',
2528
- Account: '001DH00000uOdfjYAC',
2529
- Boolean: false,
2530
- Integer: 2,
2531
- Date: '2023-07-01',
2532
- Discount: 20.1,
2533
- Level: 'Advanced',
2534
- },
2535
- ],
2536
- },
2537
- {
2538
- id: '2',
2539
- name: 'New_object',
2540
- label: 'New object',
2541
- columns: [
2542
- { name: 'Account', label: 'Account', type: 'OBJECT', objectName: 'Account' },
2543
- { name: 'Boolean', label: 'Boolean', type: 'BOOLEAN' },
2544
- { name: 'Date', label: 'Date', type: 'DATE' },
2545
- { name: 'Integer', label: 'Integer', type: 'INTEGER' },
2546
- { name: 'Discount', label: 'Discount, %', type: 'DECIMAL' },
2547
- { name: 'Level', label: 'Level', type: 'STRING' },
2548
- ],
2549
- data: [
2550
- {
2551
- id: '1',
2552
- Account: '001DH00000uEMFaYAO',
2553
- Boolean: true,
2554
- Integer: 1,
2555
- Date: '2023-06-30',
2556
- Discount: 33.5,
2557
- Level: 'Premium',
2558
- },
2559
- {
2560
- id: '2',
2561
- Account: '001DH00000uEMRuYAO',
2562
- Boolean: false,
2563
- Integer: 2,
2564
- Date: '2023-07-01',
2565
- Discount: 20.1,
2566
- Level: 'Advanced',
2567
- },
2568
- ],
2569
- },
2570
- ];
2571
2494
  class VeloceObjectsApiService {
2572
- getCategories() {
2573
- return of(categories).pipe(delay(1000));
2495
+ constructor(baseHttpService) {
2496
+ this.baseHttpService = baseHttpService;
2497
+ this.serviceUrl = '/veloceobjects';
2498
+ this.updateCategory$ = (category) => {
2499
+ return this.baseHttpService.api({
2500
+ method: 'put',
2501
+ url: `${this.serviceUrl}/categories/${category.id}`,
2502
+ body: category,
2503
+ });
2504
+ };
2505
+ this.deleteCategory$ = (id) => {
2506
+ return this.baseHttpService.api({
2507
+ method: 'delete',
2508
+ url: `${this.serviceUrl}/categories/${id}`,
2509
+ });
2510
+ };
2511
+ this.searchObjects$ = (searchParams, expression) => {
2512
+ const params = new HttpParams({ fromObject: { ...searchParams } });
2513
+ return this.baseHttpService.api({
2514
+ method: 'post',
2515
+ url: `${this.serviceUrl}/search`,
2516
+ params,
2517
+ body: expression || {},
2518
+ });
2519
+ };
2520
+ this.deleteObject$ = (id) => {
2521
+ return this.baseHttpService.api({
2522
+ method: 'delete',
2523
+ url: `${this.serviceUrl}/${id}`,
2524
+ });
2525
+ };
2526
+ this.restoreObject$ = (id) => {
2527
+ return this.baseHttpService.api({
2528
+ method: 'patch',
2529
+ url: `${this.serviceUrl}/${id}/restore`,
2530
+ });
2531
+ };
2532
+ }
2533
+ fetchCategories$() {
2534
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/categories` });
2535
+ }
2536
+ createCategory$(category) {
2537
+ return this.baseHttpService.api({
2538
+ method: 'post',
2539
+ url: `${this.serviceUrl}/categories`,
2540
+ body: category,
2541
+ });
2574
2542
  }
2575
- getObjects() {
2576
- return of(objects).pipe(delay(1000));
2543
+ fetchObjects$() {
2544
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2545
+ }
2546
+ fetchObject$(id) {
2547
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2548
+ }
2549
+ createObject$(object) {
2550
+ return this.baseHttpService.api({
2551
+ method: 'post',
2552
+ url: `${this.serviceUrl}`,
2553
+ body: object,
2554
+ });
2555
+ }
2556
+ updateObject$(object) {
2557
+ return this.baseHttpService.api({
2558
+ method: 'put',
2559
+ url: `${this.serviceUrl}/${object.id}`,
2560
+ body: object,
2561
+ });
2577
2562
  }
2578
2563
  }
2579
- VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2564
+ VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2580
2565
  VeloceObjectsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService });
2581
2566
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, decorators: [{
2582
2567
  type: Injectable
2583
- }] });
2568
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2584
2569
 
2585
2570
  class ApiModule {
2586
2571
  }