@keltoi/hydra 2.0.6 → 2.0.7
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 +8 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -470,14 +470,20 @@ let Repository$1 = class Repository{
|
|
|
470
470
|
this.myContext()
|
|
471
471
|
.where(entity.key)
|
|
472
472
|
.update(entity.data)
|
|
473
|
-
.then(affected=>
|
|
473
|
+
.then(affected=> affected > 0
|
|
474
|
+
? new Result({ code:200,message:`${this.#name} updated` })
|
|
475
|
+
: new Result({ code:404,message:'Not found' })
|
|
476
|
+
)
|
|
474
477
|
.catch(err=>Promise.reject( new Result({code:500,message:err}) ))
|
|
475
478
|
|
|
476
479
|
delete = (entity = new Entity())=>
|
|
477
480
|
this.myContext()
|
|
478
481
|
.where(entity.key)
|
|
479
482
|
.del()
|
|
480
|
-
.then(affected=>
|
|
483
|
+
.then(affected=> affected > 0
|
|
484
|
+
? new Result({ code:200,message:`${this.#name} deleted` })
|
|
485
|
+
: new Result({ code:404,message:'Not found' })
|
|
486
|
+
)
|
|
481
487
|
.catch(err=>Promise.reject( new Result({code:500,message:err}) ))
|
|
482
488
|
|
|
483
489
|
get = (entity = new Entity())=>
|