mevn-orm 2.2.3 → 2.2.4
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/lib/model.js +3 -3
- package/package.json +1 -1
- package/test/model.test.js +3 -1
package/lib/model.js
CHANGED
|
@@ -19,7 +19,7 @@ default:
|
|
|
19
19
|
const DB = knex(config)
|
|
20
20
|
class Model {
|
|
21
21
|
#private
|
|
22
|
-
static
|
|
22
|
+
static currentTable = pluralize(this.name.toLowerCase())
|
|
23
23
|
static currentQuery
|
|
24
24
|
constructor(properties) {
|
|
25
25
|
for (const key in properties) {
|
|
@@ -27,9 +27,9 @@ class Model {
|
|
|
27
27
|
}
|
|
28
28
|
this.fillable = []
|
|
29
29
|
this.hidden = []
|
|
30
|
-
this.#private = ['fillable', 'hidden'
|
|
30
|
+
this.#private = ['fillable', 'hidden']
|
|
31
31
|
this.modelName = this.constructor.name.toLowerCase()
|
|
32
|
-
this.table = pluralize(this.
|
|
32
|
+
this.table = pluralize(this.constructor.name.toLowerCase())
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
package/package.json
CHANGED
package/test/model.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
-
const { Model } = require('../index')
|
|
2
|
+
const { Model, DB } = require('../index')
|
|
3
3
|
const faker = require('faker')
|
|
4
4
|
const { expect } = require('chai')
|
|
5
5
|
class Profile extends Model {
|
|
@@ -14,6 +14,8 @@ class Farmer extends Model {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
DB(Farmer)
|
|
18
|
+
|
|
17
19
|
describe('#Model tests', () => {
|
|
18
20
|
it('#Model instance', async () => {
|
|
19
21
|
const farmer = new Farmer({
|