I'm starting with koa and waterline ORM. I have a problem when I try to use "testFucntion" method from this waterline model from my controller:
"use strict";
//https://github.com/balderdashy/waterline-docs
var Waterline = require('waterline');
var bcrypt = require('bcrypt');
var User = Waterline.Collection.extend({
identity: 'user',
connection: 'default',
attributes: {
username: {
type: 'string',
required: true,
},
password: {
type: 'string',
minLength: 6,
maxLength: 21
}
},
//test function
testFucntion: function *(params) {
...
console.log('inside');
}
});
The code I'm using to execute the method is :
function *(){
var params= this.request.body
var userModel = this.models.user;
var result = yield userModel.testFucntion(params)
}
I dont know if this kind of functions are public and how can I use it from outside...