mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
WIP message-processor: building the message
This commit is contained in:
parent
b4e05fcb30
commit
2170ee4143
3 changed files with 14 additions and 10 deletions
|
@ -8,6 +8,7 @@ const STORAGE_DIR = path.join(__base, 'storage');
|
|||
if (!fs.existsSync(STORAGE_DIR)) {
|
||||
fs.mkdirSync(STORAGE_DIR);
|
||||
}
|
||||
Object.assign(Sequelize, require('./database-connection-types')(Sequelize))
|
||||
|
||||
class DatabaseConnectionFactory {
|
||||
constructor() {
|
||||
|
|
12
core/database-types.js
Normal file
12
core/database-types.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
module.exports = (Sequelize) => ({
|
||||
JSONTYPE: (fieldName) => ({
|
||||
type: Sequelize.STRING,
|
||||
defaultValue: '{}',
|
||||
get: function get() {
|
||||
return JSON.parse(this.getDataValue('syncState'))
|
||||
},
|
||||
set: function set(val) {
|
||||
this.setDataValue('syncState', JSON.stringify(val));
|
||||
},
|
||||
}),
|
||||
})
|
|
@ -2,16 +2,7 @@ module.exports = (sequelize, Sequelize) => {
|
|||
const Category = sequelize.define('Category', {
|
||||
name: Sequelize.STRING,
|
||||
role: Sequelize.STRING,
|
||||
syncState: {
|
||||
type: Sequelize.STRING,
|
||||
defaultValue: '{}',
|
||||
get: function get() {
|
||||
return JSON.parse(this.getDataValue('syncState'))
|
||||
},
|
||||
set: function set(val) {
|
||||
this.setDataValue('syncState', JSON.stringify(val));
|
||||
},
|
||||
},
|
||||
syncState: Sequelize.JSONTYPE('syncState'),
|
||||
}, {
|
||||
classMethods: {
|
||||
associate: ({Message}) => {
|
||||
|
|
Loading…
Reference in a new issue