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.
21 lines
502 B
JavaScript
21 lines
502 B
JavaScript
var bookshelf = require('../bookshelf');
|
|
bookshelf.plugin('registry');
|
|
var Topic = require('./topic');
|
|
var Archives = require('./archive');
|
|
var User = require('./user')
|
|
|
|
var Article = bookshelf.Model.extend({
|
|
tableName: 'articles',
|
|
topic: function() {
|
|
return this.belongsTo('Topic','topic_id');
|
|
},
|
|
user: function() {
|
|
return this.belongsTo('User','user_id');
|
|
},
|
|
archives: function(){
|
|
return this.hasMany('Archives');
|
|
}
|
|
});
|
|
|
|
module.exports = bookshelf.model('Article',Article);
|