@twin.org/entity-storage-service 0.0.1-next.7 → 0.0.1-next.8

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.
@@ -376,14 +376,19 @@ class EntityStorageService {
376
376
  await this._entityStorage.remove(id);
377
377
  }
378
378
  else {
379
+ const schema = this._entityStorage.getSchema();
380
+ const primaryKey = entity.EntitySchemaHelper.getPrimaryKey(schema);
381
+ conditions.push({
382
+ property: primaryKey.property,
383
+ comparison: entity.ComparisonOperator.Equals,
384
+ value: id
385
+ });
379
386
  const results = await this._entityStorage.query({
380
387
  conditions,
381
388
  logicalOperator: entity.LogicalOperator.And
382
389
  }, undefined, undefined, undefined, 1);
383
390
  if (results.entities.length > 0) {
384
391
  const firstEntity = results.entities[0];
385
- const schema = this._entityStorage.getSchema();
386
- const primaryKey = entity.EntitySchemaHelper.getPrimaryKey(schema);
387
392
  await this._entityStorage.remove(firstEntity[primaryKey.property]);
388
393
  }
389
394
  else {
@@ -374,14 +374,19 @@ class EntityStorageService {
374
374
  await this._entityStorage.remove(id);
375
375
  }
376
376
  else {
377
+ const schema = this._entityStorage.getSchema();
378
+ const primaryKey = EntitySchemaHelper.getPrimaryKey(schema);
379
+ conditions.push({
380
+ property: primaryKey.property,
381
+ comparison: ComparisonOperator.Equals,
382
+ value: id
383
+ });
377
384
  const results = await this._entityStorage.query({
378
385
  conditions,
379
386
  logicalOperator: LogicalOperator.And
380
387
  }, undefined, undefined, undefined, 1);
381
388
  if (results.entities.length > 0) {
382
389
  const firstEntity = results.entities[0];
383
- const schema = this._entityStorage.getSchema();
384
- const primaryKey = EntitySchemaHelper.getPrimaryKey(schema);
385
390
  await this._entityStorage.remove(firstEntity[primaryKey.property]);
386
391
  }
387
392
  else {
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/entity-storage-service - Changelog
2
2
 
3
- ## v0.0.1-next.7
3
+ ## v0.0.1-next.8
4
4
 
5
5
  - Initial Release
@@ -133,7 +133,7 @@
133
133
  },
134
134
  {
135
135
  "name": "sortProperties",
136
- "description": "The sort property array as JSON serialization of {property,direction}[].",
136
+ "description": "The sort property array as JSON serialization of property,direction.",
137
137
  "in": "query",
138
138
  "required": false,
139
139
  "schema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-service",
3
- "version": "0.0.1-next.7",
3
+ "version": "0.0.1-next.8",
4
4
  "description": "Entity Storage contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "@twin.org/api-models": "next",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/entity": "next",
20
- "@twin.org/entity-storage-models": "0.0.1-next.7",
20
+ "@twin.org/entity-storage-models": "0.0.1-next.8",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/web": "next"
23
23
  },