UNPKG

paradigm-core

Version:
39 lines (37 loc) 966 B
const {createSchemaMiddleware} = require('structure-core') const errorCodes = require('../../../lib/error-codes') const {CategoryModel} = require('../../categories') module.exports = createSchemaMiddleware( { "$async": true, "properties": { "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"], "required": ["slug", "title", "categoryIds"] }, errorCodes )