ismx-nexo-node-app 0.4.70 → 0.4.72

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.
@@ -249,7 +249,10 @@ class ServiceRestFormalTemplate {
249
249
  }
250
250
  serveDel(request) {
251
251
  return __awaiter(this, void 0, void 0, function* () {
252
- return Service_1.HttpResponse.ok("not implemented yet");
252
+ let entity = (yield this.serveGet(request)).content;
253
+ if (entity)
254
+ yield this.database.delete(this.tableName, entity[this.indexer]);
255
+ return Service_1.HttpResponse.ok(entity);
253
256
  });
254
257
  }
255
258
  unwrap(request) {
@@ -34,8 +34,7 @@ class BusinessState {
34
34
  }
35
35
  notify(data) {
36
36
  var _a, _b;
37
- if (data)
38
- this.data = data;
37
+ this.data = Object.assign({}, (data !== null && data !== void 0 ? data : this.data));
39
38
  for (let l in this.listeners)
40
39
  try {
41
40
  (_b = (_a = this.listeners)[l]) === null || _b === void 0 ? void 0 : _b.call(_a, this.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.70",
3
+ "version": "0.4.72",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -240,7 +240,9 @@ export default class ServiceRestFormalTemplate<Model=any>
240
240
  }
241
241
 
242
242
  protected async serveDel(request: HttpRequest): Promise<HttpResponse<Model>> {
243
- return HttpResponse.ok("not implemented yet");
243
+ let entity = (await this.serveGet(request)).content;
244
+ if (entity) await this.database.delete(this.tableName, entity[this.indexer as keyof Model] as unknown as string);
245
+ return HttpResponse.ok(entity);
244
246
  }
245
247
 
246
248
  protected async unwrap<Res>(request: Promise<HttpResponse<Wrapper<Res>>>): Promise<Res | undefined> {
@@ -23,7 +23,7 @@ export default class BusinessState<Model>
23
23
  }
24
24
 
25
25
  protected notify(data?: Model): void {
26
- if (data) this.data = data;
26
+ this.data = { ...(data ?? this.data) };
27
27
  for (let l in this.listeners)
28
28
  try { this.listeners[l]?.(this.data); } catch (error) {}
29
29
  }