mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-11-08 07:21:18 +08:00
Use defaultValue as a template, fix critical sync issue
This commit is contained in:
parent
549ced6128
commit
f9f78968b1
1 changed files with 7 additions and 3 deletions
|
|
@ -5,18 +5,22 @@ module.exports = {
|
|||
type: Sequelize.TEXT,
|
||||
get: function get() {
|
||||
const val = this.getDataValue(fieldName);
|
||||
if (!val) { return defaultValue }
|
||||
if (!val) {
|
||||
return defaultValue ? Object.assign({}, defaultValue) : null;
|
||||
}
|
||||
return JSON.parse(val);
|
||||
},
|
||||
set: function set(val) {
|
||||
this.setDataValue(fieldName, JSON.stringify(val));
|
||||
},
|
||||
}),
|
||||
JSONARRAYType: (fieldName, {defaultValue = []} = {}) => ({
|
||||
JSONARRAYType: (fieldName) => ({
|
||||
type: Sequelize.TEXT,
|
||||
get: function get() {
|
||||
const val = this.getDataValue(fieldName);
|
||||
if (!val) { return defaultValue }
|
||||
if (!val) {
|
||||
return [];
|
||||
}
|
||||
return JSON.parse(val);
|
||||
},
|
||||
set: function set(val) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue