2017-07-23 03:56:46 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Document schema
|
|
|
|
*/
|
|
|
|
module.exports = (sequelize, DataTypes) => {
|
|
|
|
let documentSchema = sequelize.define('setting', {
|
|
|
|
path: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
allowNull: false
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
allowNull: false,
|
|
|
|
validate: {
|
|
|
|
len: [2, 255]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
subtitle: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
allowNull: true,
|
|
|
|
defaultValue: ''
|
|
|
|
},
|
|
|
|
parentPath: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
allowNull: true,
|
|
|
|
defaultValue: ''
|
|
|
|
},
|
|
|
|
parentTitle: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
allowNull: true,
|
|
|
|
defaultValue: ''
|
|
|
|
},
|
|
|
|
isDirectory: {
|
|
|
|
type: DataTypes.BOOLEAN,
|
|
|
|
allowNull: false,
|
|
|
|
defaultValue: false
|
|
|
|
},
|
|
|
|
isEntry: {
|
|
|
|
type: DataTypes.BOOLEAN,
|
|
|
|
allowNull: false,
|
|
|
|
defaultValue: false
|
2017-07-29 04:11:22 +00:00
|
|
|
},
|
2017-08-20 02:51:25 +00:00
|
|
|
isDraft: {
|
|
|
|
type: DataTypes.BOOLEAN,
|
|
|
|
allowNull: false,
|
|
|
|
defaultValue: false
|
|
|
|
},
|
2017-07-29 04:11:22 +00:00
|
|
|
searchContent: {
|
|
|
|
type: DataTypes.TEXT,
|
|
|
|
allowNull: true,
|
|
|
|
defaultValue: ''
|
2017-07-23 03:56:46 +00:00
|
|
|
}
|
|
|
|
}, {
|
|
|
|
timestamps: true,
|
|
|
|
version: true,
|
|
|
|
indexes: [
|
|
|
|
{
|
|
|
|
unique: true,
|
|
|
|
fields: ['path']
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
return documentSchema
|
|
|
|
}
|