init
This commit is contained in:
22
lib/factory/post.js
Normal file
22
lib/factory/post.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const Joi = require('joi')
|
||||
const validate = require('./validate')
|
||||
const postPartial = require('./postPartial')
|
||||
|
||||
//
|
||||
// Define the schema
|
||||
//
|
||||
const schema = {
|
||||
team: Joi.string(),
|
||||
channel: Joi.string(),
|
||||
...postPartial,
|
||||
}
|
||||
|
||||
//
|
||||
// Generate a valid object
|
||||
//
|
||||
module.exports = function (props) {
|
||||
return {
|
||||
type: 'post',
|
||||
post: validate(schema, props)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user