2017-12-03 11:34:43 +00:00
|
|
|
import bookshelf from '../bookshelf'
|
2016-04-14 04:01:51 +00:00
|
|
|
|
|
|
|
/* Graphic model:
|
|
|
|
{
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
engine,
|
|
|
|
settings,
|
|
|
|
is_deleted,
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
const Graphic = bookshelf.createModel({
|
|
|
|
tableName: 'graphics',
|
|
|
|
|
|
|
|
format(attributes) {
|
|
|
|
attributes.settings = JSON.stringify(attributes.settings)
|
|
|
|
return attributes
|
|
|
|
},
|
|
|
|
|
|
|
|
parse(attributes) {
|
|
|
|
if (attributes.settings) {
|
|
|
|
attributes.settings = JSON.parse(attributes.settings)
|
|
|
|
}
|
|
|
|
return attributes
|
2018-07-15 04:00:42 +00:00
|
|
|
},
|
2016-04-14 04:01:51 +00:00
|
|
|
}, {
|
|
|
|
})
|
|
|
|
|
|
|
|
export default Graphic
|