You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openNG/models/Node.js

17 lines
439 B
JavaScript

module.exports = function(bookshelf) {
return bookshelf.model("Node", {
tableName: "nodes",
idAttribute: "id",
relationIdAttribute: "perma_id",
type: function() {
return this.belongsTo("NodeType", "type_id");
},
tags: function() {
return this.belongsToMany("NodeTag").through("NodeTagAssociation");
},
attributes: function() {
return this.hasMany("Attribute", "node_id");
}
});
};