2017-12-03 11:34:43 +00:00
|
|
|
import bookshelf from '../bookshelf'
|
2016-04-14 04:01:51 +00:00
|
|
|
|
|
|
|
/* Preset model:
|
|
|
|
{
|
|
|
|
id,
|
|
|
|
graphic_id,
|
|
|
|
values,
|
|
|
|
sort,
|
|
|
|
is_deleted,
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
const Preset = bookshelf.createModel({
|
|
|
|
tableName: 'presets',
|
|
|
|
|
|
|
|
format(attributes) {
|
|
|
|
attributes.values = JSON.stringify(attributes.values)
|
|
|
|
return attributes
|
|
|
|
},
|
|
|
|
|
|
|
|
parse(attributes) {
|
|
|
|
if (attributes.values) {
|
|
|
|
attributes.values = JSON.parse(attributes.values)
|
|
|
|
}
|
|
|
|
return attributes
|
2018-06-26 18:35:12 +00:00
|
|
|
},
|
2016-04-14 04:01:51 +00:00
|
|
|
}, {
|
|
|
|
})
|
|
|
|
|
|
|
|
export default Preset
|