paradigm-core
Version:
Paradigm Core Modules
42 lines (40 loc) • 989 B
JavaScript
const {createSchemaMiddleware} = require('structure-core')
const errorCodes = require('../../../lib/error-codes')
const {CategoryModel} = require('../../categories')
module.exports = createSchemaMiddleware(
{
"$async": true,
"properties": {
"sid": {
"type": "string",
"minLength": 3
},
"slug": {
"type": "string",
"pattern": "^[a-z0-9-]+$",
},
"title": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"type": "object"
}
},
"categoryIds": {
"type": "array",
"items": {
"type": "string",
"scopedId": {
"model": CategoryModel,
"scopeKey": 'applicationId'
},
},
},
},
// Delete items that are joined keys, or keys that are created on a join
"remove": ["categories", "featuredImage", "facebookImage", "twitterImage", "user"]
},
errorCodes
)