@keltoi/hydra 2.2.0 → 2.2.2

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.
Files changed (2) hide show
  1. package/index.js +7 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -112,6 +112,7 @@ class Linking{
112
112
  #AbscissaEntity=Entity
113
113
  #OrdinateEntity=Entity
114
114
 
115
+ static get name(){ return null }
115
116
 
116
117
  get Abscissa(){
117
118
  return this.#AbscissaEntity
@@ -149,7 +150,7 @@ class Linking{
149
150
  ordinate=Entity,
150
151
  schema=(t)=>{}
151
152
  ){
152
- const tableName = `${abscissa.name}${ordinate.name}`;
153
+ const tableName = this.name ?? `${abscissa.name}${ordinate.name}`;
153
154
 
154
155
  return runWhenFalse(
155
156
  db.schema.hasTable(tableName),
@@ -700,7 +701,11 @@ class DbLinked {
700
701
  this.myContext()
701
702
  .where(linked.key)
702
703
  .del()
703
- .then(affected=>new Result({data:affected}))
704
+ .then(affected=>
705
+ affected > 0
706
+ ?new Result({data:affected})
707
+ :new Result({code:404,message:'Not found'})
708
+ )
704
709
  .catch(err=>Promise.reject(new Result({code:500,message:err})))
705
710
 
706
711
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keltoi/hydra",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Boilerplate to start your API from zero using Repository Pattern",
5
5
  "main": "index.js",
6
6
  "module": "index.js",