@keltoi/hydra 2.0.7 → 2.0.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.
- package/index.js +7 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -71,6 +71,8 @@ class Entity{
|
|
|
71
71
|
get key(){ return this.#key }
|
|
72
72
|
get data(){ return this.#data }
|
|
73
73
|
|
|
74
|
+
set key(value = {}){ this.#key = value; }
|
|
75
|
+
|
|
74
76
|
get $(){
|
|
75
77
|
return { ...this.#key, ...this.#data }
|
|
76
78
|
}
|
|
@@ -461,9 +463,11 @@ let Repository$1 = class Repository{
|
|
|
461
463
|
create = (entity = new Entity())=>
|
|
462
464
|
this.myContext()
|
|
463
465
|
.insert(entity.data,Object.keys(entity.key))
|
|
464
|
-
.then(ids=>
|
|
465
|
-
|
|
466
|
-
|
|
466
|
+
.then(ids=>{
|
|
467
|
+
entity.key = ids[0];
|
|
468
|
+
|
|
469
|
+
return new Result({ data:entity.$ })
|
|
470
|
+
})
|
|
467
471
|
.catch(err=>Promise.reject( new Result({code:500,message:err}) ))
|
|
468
472
|
|
|
469
473
|
update = (entity = new Entity())=>
|