Mailspring/packages/nylas-core/models/account/file.js

29 lines
651 B
JavaScript
Raw Normal View History

2016-06-29 02:32:15 +08:00
module.exports = (sequelize, Sequelize) => {
const File = sequelize.define('File', {
2016-06-29 04:55:00 +08:00
filename: Sequelize.STRING,
contentId: Sequelize.STRING,
contentType: Sequelize.STRING,
2016-06-29 02:32:15 +08:00
size: Sequelize.INTEGER,
}, {
classMethods: {
associate: ({Message}) => {
File.belongsTo(Message)
},
},
2016-06-29 04:55:00 +08:00
instanceMethods: {
toJSON: function toJSON() {
return {
id: this.id,
messageId: this.MessageId,
filename: this.filename,
contentId: this.contentId,
contentType: this.contentType,
size: this.size,
};
},
},
2016-06-29 02:32:15 +08:00
});
return File;
};