diff --git a/src/changelog.model.js b/src/changelog.model.js index 0b961f0..3ce8178 100644 --- a/src/changelog.model.js +++ b/src/changelog.model.js @@ -29,6 +29,8 @@ const SCHEMA = mergeObjects( { image, audio, video, document } ); +// TODO: all criteria use $in operator + /** * @module ChangeLog * @namespace ChangeLog diff --git a/src/event.model.js b/src/event.model.js index 6de54ce..55ef179 100644 --- a/src/event.model.js +++ b/src/event.model.js @@ -25,6 +25,10 @@ import { PREDEFINE_OPTION_AUTOPOPULATE, } from './internals'; +// TODO: send notification after create +// TODO: calculate expose(risk) after create +// TODO: send actions after create + /** * @module Event * @namespace Event diff --git a/src/schema/base.schema.js b/src/schema/base.schema.js index 4f05994..08e65a5 100644 --- a/src/schema/base.schema.js +++ b/src/schema/base.schema.js @@ -93,3 +93,95 @@ export const type = { aggregatable: { unwind: true }, default: undefined, }; + +/** + * @name function + * @alias fanction + * @description Group event response activities(i.e actions) + * + * @memberof Event + * @memberof ChangeLog + * + * @type {object} + * @property {object} type - schema(data) type + * @property {boolean} required - mark required + * @property {boolean} index - ensure database index + * @property {boolean} exists - ensure ref exists before save + * @property {object} autopopulate - auto populate(eager loading) options + * @property {boolean} taggable - allow field use for tagging + * @property {boolean} exportable - allow field use for exporting + * @property {boolean} aggregatable - allow field use for aggregation + * @property {boolean} default - default value set when none provided + * @property {object} fake - fake data generator options + * + * @author lally elias + * @since 0.1.0 + * @version 0.1.0 + * @instance + * @example + * { + * _id: '5dde6ca33631a92c2d616298', + * strings: { name: { en: 'Communication and Warning' } }, + * } + */ +export const fanction = { + type: ObjectId, + ref: Predefine.MODEL_NAME, + // required: true, + index: true, + exists: true, + autopopulate: PREDEFINE_OPTION_AUTOPOPULATE, + taggable: true, + exportable: { + format: v => get(v, 'strings.name.en'), + default: 'NA', + }, + aggregatable: { unwind: true }, + default: undefined, +}; + +/** + * @name action + * @alias action + * @description Define an event response activity. + * + * @memberof Event + * @memberof ChangeLog + * + * @type {object} + * @property {object} type - schema(data) type + * @property {boolean} required - mark required + * @property {boolean} index - ensure database index + * @property {boolean} exists - ensure ref exists before save + * @property {object} autopopulate - auto populate(eager loading) options + * @property {boolean} taggable - allow field use for tagging + * @property {boolean} exportable - allow field use for exporting + * @property {boolean} aggregatable - allow field use for aggregation + * @property {boolean} default - default value set when none provided + * @property {object} fake - fake data generator options + * + * @author lally elias + * @since 0.1.0 + * @version 0.1.0 + * @instance + * @example + * { + * _id: '5dde6ca33631a92c2d616298', + * strings: { name: { en: 'Disseminating warning information' } }, + * } + */ +export const action = { + type: ObjectId, + ref: Predefine.MODEL_NAME, + // required: true, + index: true, + exists: true, + autopopulate: PREDEFINE_OPTION_AUTOPOPULATE, + taggable: true, + exportable: { + format: v => get(v, 'strings.name.en'), + default: 'NA', + }, + aggregatable: { unwind: true }, + default: undefined, +};