Update BookReference model

Add locale; change sources to object with keys = source and value = id
This commit is contained in:
Robbie Antenesse 2020-02-06 09:31:47 -07:00
parent 03a939b643
commit 0189a5cab0
1 changed files with 11 additions and 2 deletions

View File

@ -18,8 +18,8 @@ module.exports = sequelize => sequelize.define('BookReference', {
sources: {
type: Sequelize.JSON,
allowNull: false,
defaultValue: [],
comment: 'A JSON array with each element being an object with named source <STRING> and source id <STRING>',
defaultValue: {},
comment: 'A JSON object with each key a source name and value a source id',
},
covers: {
type: Sequelize.JSON,
@ -27,6 +27,12 @@ module.exports = sequelize => sequelize.define('BookReference', {
defaultValue: [],
comment: 'A JSON array with each element being an object with image url <STRING> and source id <STRING>',
},
locale: {
type: Sequelize.STRING,
allowNull: false,
defaultValue: 'en',
comment: 'A basic locale string',
},
}, {
timestamps: false,
indexes: [
@ -40,5 +46,8 @@ module.exports = sequelize => sequelize.define('BookReference', {
{
fields: ['description'],
},
{
fields: ['locale'],
},
],
});