drapi 1.8.49 → 1.8.51
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/.vscode-upload.json +21 -0
- package/api/basecontrollers/restcontroller.js +8 -1
- package/lib/models.js +3 -5
- package/lib/router.js +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[{
|
|
2
|
+
"name":"",
|
|
3
|
+
"host": "",
|
|
4
|
+
"port": 22,
|
|
5
|
+
"username": "",
|
|
6
|
+
"password": "",
|
|
7
|
+
"remotePath": "",
|
|
8
|
+
"localPath": "",
|
|
9
|
+
"disable": false,
|
|
10
|
+
"private_key": "~/.ssh/id_rsa"
|
|
11
|
+
},{
|
|
12
|
+
"name":"",
|
|
13
|
+
"host": "",
|
|
14
|
+
"port": 22,
|
|
15
|
+
"username": "",
|
|
16
|
+
"password": "",
|
|
17
|
+
"remotePath": "",
|
|
18
|
+
"localPath": "",
|
|
19
|
+
"disable": false,
|
|
20
|
+
"private_key": "~/.ssh/id_rsa"
|
|
21
|
+
}]
|
|
@@ -35,6 +35,13 @@ class RestController extends BaseController {
|
|
|
35
35
|
return ctx.body;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
async search(ctx) {
|
|
39
|
+
let query = this.ctx.request.body;
|
|
40
|
+
ctx.query = query;
|
|
41
|
+
|
|
42
|
+
return await this.list(ctx);
|
|
43
|
+
}
|
|
44
|
+
|
|
38
45
|
async detail(ctx) {
|
|
39
46
|
await this.init(ctx);
|
|
40
47
|
|
|
@@ -212,7 +219,7 @@ class RestController extends BaseController {
|
|
|
212
219
|
registerRouter_() {
|
|
213
220
|
this.router_.get('/', (ctx) => this.list(ctx));
|
|
214
221
|
this.router_.get('/:id', (ctx) => this.detail(ctx));
|
|
215
|
-
this.router_.
|
|
222
|
+
this.router_.post('/search', (ctx) => this.search(ctx));
|
|
216
223
|
this.router_.post('/', (ctx) => this.create(ctx));
|
|
217
224
|
this.router_.patch('/:id', (ctx) => this.upd(ctx));
|
|
218
225
|
this.router_.put('/:id', (ctx) => this.upd(ctx));
|
package/lib/models.js
CHANGED
|
@@ -27,7 +27,7 @@ let connectionschema = {};
|
|
|
27
27
|
|
|
28
28
|
let getConnection = function(dbname){
|
|
29
29
|
connectionschema[dbname] = connectionschema[dbname] || {};
|
|
30
|
-
let connection = db.getDatabaseConnection(dbname);
|
|
30
|
+
let connection = db.getDatabaseConnection(dbname);
|
|
31
31
|
return connection;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -49,7 +49,6 @@ let models = {
|
|
|
49
49
|
*/
|
|
50
50
|
getModelSchemaInstance: function(dbname, model, schema){
|
|
51
51
|
let connection = getConnection(dbname);
|
|
52
|
-
console.log("tamaño de la connection db antes de instancia model: ", dbname, model, sizeof(connection));
|
|
53
52
|
|
|
54
53
|
//Verify if the schema is allready initialized or if its atributos have changed
|
|
55
54
|
if(!connectionschema[dbname][model] || hasStructureChanged(connectionschema[dbname][model].obj, schema.attributes)){
|
|
@@ -68,9 +67,8 @@ let models = {
|
|
|
68
67
|
connectionschema[dbname][model] = modelSchema;
|
|
69
68
|
console.log("tamaño de schemas almacenados en memoria: ", sizeof(connectionschema));
|
|
70
69
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return Model;
|
|
70
|
+
|
|
71
|
+
return connection.model(model, connectionschema[dbname][model]);
|
|
74
72
|
},
|
|
75
73
|
/**
|
|
76
74
|
* Function incharge of initializing and returning dynamicaly a mongoose model
|
package/lib/router.js
CHANGED