感觉model层写的很混乱,求一个example
module.exports = app => {
const { DATE, INTEGER, STRING } = app.Sequelize;
return app.model.define('Post', {
title: STRING,
user_id: INTEGER,
created_at: DATE,
updated_at: DATE,
}, {
classMethods: {
associate() {
app.model.Post.belongsTo(app.model.User, { as: 'user' });
},
},
});
};
这种写法,真是写不下去 能否有办法变成类似于这样
Class Post extends Sequelize {
static ...
}