anvilresearch / modinha Goto Github PK
View Code? Open in Web Editor NEWModinha is a toolkit for creating persisted models in Nodejs .
Modinha is a toolkit for creating persisted models in Nodejs .
var AccessToken = Modinha.define('accesstokens', {
// ...
})
AccessToken.mappings.exchange = {
'cid': 'client_id',
'uid': 'user_id',
'ei': 'max_age',
'scope': 'scope'
};
// THIS CAUSES AN ERROR
AccessToken.initialize({
client_id: null
}, {
mapping: 'exchange'
});
// TypeError: Cannot read property 'undefined' of null
We should have a trim
property on schema fields and possibly a global setting for all fields on the model.
The created attribute shouldn't be writable when timestamps:true (default case) is specified in a Model. This value should be set on creation and never modified.
When a Model is defined with timestamps:false, then 'created' and 'modified' should be writable, because they have no special meaning for the Model.
The 'validate' hooks are not being executed when updating a model.
If some bussiness rule is enforced on creation of a new model, almost surely they will need to be enforced on updating the model.
For example, for a User model, the salt and hash are generated from the password attribute. When updating a User, if the password is changed a new salt and hash should be generated. Also, if the password isn't present when updating, the validate hook could detect it.
Way to fix it:
Apply validate hooks on update.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.