/** * * * @static * @param {any} topic * @returns * * @memberOf StorePattern */ static updateById(topic) { return { topic, cmd: 'updateById', collection: Joi.string().required(), data: Joi.object().required(), id: Joi.alternatives() .try(Joi.number(), Joi.string()) .required() } }
/** * * * @static * @param {any} topic * @returns * * @memberOf StorePattern */ static find(topic) { return { topic, cmd: 'find', collection: Joi.string().required(), query: Joi.object().required(), options: Joi.object() .keys({ fields: Joi.alternatives().try(Joi.object(), Joi.array()), orderBy: Joi.alternatives().try(Joi.object(), Joi.array(), Joi.string()), offset: Joi.number().integer(), limit: Joi.number().integer() }) .default({}) } }
/** * * * @static * @param {any} topic * @returns * * @memberOf StorePattern */ static removeById(topic) { return { topic, cmd: 'removeById', collection: Joi.string().required(), id: Joi.alternatives() .try(Joi.number(), Joi.string()) .required() } }
/** * * * @static * @param {any} topic * @returns * * @memberOf StorePattern */ static count(topic) { return { topic, cmd: 'count', collection: Joi.string().required(), query: Joi.alternatives() .try(Joi.object(), Joi.string()) .required() } }
schema = schema.try(singleValue) schema = schema.try(commentSchema()) schema = schema.try(array.items( Joi.alternatives().try(singleValue).try(commentSchema(false)) )) schema = schema.required()
/** * * * @static * @param {any} topic * @returns * * @memberOf StorePattern */ static replaceById(topic) { return { topic, cmd: 'replaceById', collection: Joi.string().required(), data: Joi.object().required(), id: Joi.alternatives() .try(Joi.number(), Joi.string()) .required() } }
/** * * * @static * @param {any} topic * @returns * * @memberOf StorePattern */ static findById(topic) { return { topic, cmd: 'findById', collection: Joi.string().required(), id: Joi.alternatives() .try(Joi.number(), Joi.string()) .required() } }