-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0a80ab8
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Nothing to see here, yet. | ||
|
||
`sequenice` will be a wrapper for `sequelize` which will result in a nicer | ||
code structure for models. I'm aiming for something like this: | ||
|
||
```js | ||
// user.js | ||
function User(s) { | ||
/** | ||
* Field definitions | ||
*/ | ||
this.field("name", s.STRING); | ||
this.field("password", s.STRING); | ||
this.field("isAdmin", s.BOOLEAN, { defaultValue: false }); | ||
|
||
/** | ||
* Associations | ||
*/ | ||
this.hasMany("Project", { joinTableModel: "UserProjects" }); | ||
|
||
/** | ||
* Hooks | ||
*/ | ||
this.beforeCreate("myBeforeCreateMethod"); | ||
|
||
/** | ||
* Getters | ||
*/ | ||
this.get("myVariableName"); | ||
|
||
/** | ||
* Setters | ||
*/ | ||
this.set("myVariableName"); | ||
} | ||
|
||
User.prototype.getMyVariableName = function () { | ||
return this._myVariableName; | ||
} | ||
|
||
User.prototype.setMyVariableName = function (value) { | ||
this._myVariableName = value; | ||
} | ||
|
||
User.prototype.someInstanceMethod = function () { | ||
|
||
} | ||
|
||
User.someClassMethod = function () { | ||
|
||
} | ||
``` |