ismx-nexo-node-app 0.4.10 → 0.4.12

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.
@@ -97,8 +97,7 @@ class ServiceRestFormalTemplate {
97
97
  }
98
98
  servePost(request) {
99
99
  return __awaiter(this, void 0, void 0, function* () {
100
- let entity = this.database.add(this.tableName, request.body);
101
- return Service_1.HttpResponse.ok(entity);
100
+ return Service_1.HttpResponse.ok(yield this.database.add(this.tableName, request.body));
102
101
  });
103
102
  }
104
103
  servePostList(request) {
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class ArrayUtils {
4
+ static equals(first, second) {
5
+ if (first.length !== second.length)
6
+ return false;
7
+ return first.every((value, index) => value === second[index]);
8
+ }
9
+ }
10
+ exports.default = ArrayUtils;
@@ -23,6 +23,12 @@ class DateUtils {
23
23
  let seconds = date.getSeconds().toString().padStart(2, "0");
24
24
  return `${hours}:${minutes}:${seconds}`;
25
25
  }
26
+ static toIsoDate(date) {
27
+ let year = date.getFullYear().toString();
28
+ let month = (date.getMonth() + 1).toString().padStart(2, "0");
29
+ let day = date.getDate().toString().padStart(2, "0");
30
+ return `${year}-${month}-${day}`;
31
+ }
26
32
  static sum(date, value, component) {
27
33
  let year = date.getFullYear();
28
34
  let month = date.getMonth();
package/dist/js/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RestUtils = exports.QueryUtils = exports.RepositoryRestFormalTemplate = exports.RepositoryRestFormal = exports.RepositoryRest = exports.RepositoryDatabasePostgres = exports.RepositoryDatabase = exports.Repository = exports.StringUtils = exports.NumberUtils = exports.CryptoUtils = exports.DateUtils = exports.BusinessLogger = exports.FormalError = exports.BusinessErrors = exports.BusinessThread = exports.BusinessServer = exports.BusinessProxy = exports.BusinessState = exports.Business = exports.ColorUtils = exports.ServiceRestFormalTemplate = exports.ServiceRestFormal = exports.ServiceRest = exports.HttpResponse = exports.Service = void 0;
29
+ exports.RestUtils = exports.QueryUtils = exports.RepositoryRestFormalTemplate = exports.RepositoryRestFormal = exports.RepositoryRest = exports.RepositoryDatabasePostgres = exports.RepositoryDatabase = exports.Repository = exports.ArrayUtils = exports.StringUtils = exports.NumberUtils = exports.CryptoUtils = exports.DateUtils = exports.BusinessLogger = exports.FormalError = exports.BusinessErrors = exports.BusinessThread = exports.BusinessServer = exports.BusinessProxy = exports.BusinessState = exports.Business = exports.ColorUtils = exports.ServiceRestFormalTemplate = exports.ServiceRestFormal = exports.ServiceRest = exports.HttpResponse = exports.Service = void 0;
30
30
  const Service_1 = __importStar(require("./api/Service"));
31
31
  class Service extends Service_1.default {
32
32
  }
@@ -98,6 +98,10 @@ const StringUtils_1 = __importDefault(require("./business/utils/StringUtils"));
98
98
  class StringUtils extends StringUtils_1.default {
99
99
  }
100
100
  exports.StringUtils = StringUtils;
101
+ const ArrayUtils_1 = __importDefault(require("./business/utils/ArrayUtils"));
102
+ class ArrayUtils extends ArrayUtils_1.default {
103
+ }
104
+ exports.ArrayUtils = ArrayUtils;
101
105
  /**************************************************************/
102
106
  const Repository_1 = __importDefault(require("./repository/Repository"));
103
107
  class Repository extends Repository_1.default {
@@ -0,0 +1,3 @@
1
+ export default abstract class ArrayUtils {
2
+ static equals(first: any[], second: any[]): boolean;
3
+ }
@@ -11,5 +11,6 @@ export default abstract class DateUtils {
11
11
  static getStartOfWeek(year: number, week: number): Date;
12
12
  static getEndOfWeek(year: number, week: number): Date;
13
13
  static toIsoTime(date: Date): string;
14
+ static toIsoDate(date: Date): string;
14
15
  static sum(date: Date, value: number, component: number): Date;
15
16
  }
@@ -59,6 +59,9 @@ export declare abstract class NumberUtils extends _NumberUtils {
59
59
  import _StringUtils from "./business/utils/StringUtils";
60
60
  export declare abstract class StringUtils extends _StringUtils {
61
61
  }
62
+ import _ArrayUtils from "./business/utils/ArrayUtils";
63
+ export declare abstract class ArrayUtils extends _ArrayUtils {
64
+ }
62
65
  /**************************************************************/
63
66
  import BaseRepository, { Pagination as _Pagination } from "./repository/Repository";
64
67
  export declare class Repository extends BaseRepository {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -104,8 +104,7 @@ export default class ServiceRestFormalTemplate<Model=any>
104
104
  }
105
105
 
106
106
  protected async servePost(request: HttpRequest<Model>): Promise<HttpResponse<Model>> {
107
- let entity = this.database.add<Model>(this.tableName, request.body);
108
- return HttpResponse.ok(entity);
107
+ return HttpResponse.ok(await this.database.add<Model>(this.tableName, request.body));
109
108
  }
110
109
 
111
110
  protected async servePostList(request: HttpRequest<Model[]>): Promise<HttpResponse<Model[]>> {
@@ -0,0 +1,7 @@
1
+ export default abstract class ArrayUtils {
2
+
3
+ static equals(first: any[], second: any[]): boolean {
4
+ if (first.length !== second.length) return false;
5
+ return first.every((value, index) => value === second[index]);
6
+ }
7
+ }
@@ -36,6 +36,13 @@ export default abstract class DateUtils {
36
36
  return `${hours}:${minutes}:${seconds}`;
37
37
  }
38
38
 
39
+ static toIsoDate(date: Date) {
40
+ let year = date.getFullYear().toString();
41
+ let month = (date.getMonth()+1).toString().padStart(2, "0");
42
+ let day = date.getDate().toString().padStart(2, "0");
43
+ return `${year}-${month}-${day}`;
44
+ }
45
+
39
46
  static sum(date:Date, value:number, component: number) {
40
47
  let year = date.getFullYear();
41
48
  let month = date.getMonth();
@@ -54,6 +54,9 @@ export abstract class NumberUtils extends _NumberUtils {}
54
54
  import _StringUtils from "./business/utils/StringUtils";
55
55
  export abstract class StringUtils extends _StringUtils {}
56
56
 
57
+ import _ArrayUtils from "./business/utils/ArrayUtils";
58
+ export abstract class ArrayUtils extends _ArrayUtils {}
59
+
57
60
  /**************************************************************/
58
61
 
59
62
  import BaseRepository, { Pagination as _Pagination } from "./repository/Repository";