Skip to content

Commit b5e2c73

Browse files
committed
chore(deps): force latest version & audit fix
1 parent 50a657f commit b5e2c73

File tree

4 files changed

+182
-4
lines changed

4 files changed

+182
-4
lines changed

es/index.js

+90-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import actions from 'mongoose-rest-actions';
1111
import exportable from '@lykmapipo/mongoose-exportable';
1212
import moment from 'moment';
1313
import { Predefine } from '@lykmapipo/predefine';
14-
import { Event } from '@codetanzania/ewea-event';
1514
import { DEFAULT_SEEDS } from '@codetanzania/ewea-common';
15+
import { Event } from '@codetanzania/ewea-event';
1616
import 'mongoose-geojson-schemas';
1717
import { Party } from '@codetanzania/emis-stakeholder';
1818

@@ -195,6 +195,94 @@ const event = {
195195
default: undefined,
196196
};
197197

198+
/**
199+
* @name stage
200+
* @description Currently assigned stage of a case.
201+
*
202+
* @memberof Case
203+
*
204+
* @type {object}
205+
* @property {object} type - schema(data) type
206+
* @property {boolean} required - mark required
207+
* @property {boolean} index - ensure database index
208+
* @property {boolean} exists - ensure ref exists before save
209+
* @property {object} autopopulate - auto populate(eager loading) options
210+
* @property {boolean} taggable - allow field use for tagging
211+
* @property {boolean} exportable - allow field use for exporting
212+
* @property {boolean} aggregatable - allow field use for aggregation
213+
* @property {boolean} default - default value set when none provided
214+
* @property {object} fake - fake data generator options
215+
*
216+
* @author lally elias <lallyelias87@gmail.com>
217+
* @since 0.4.0
218+
* @version 0.1.0
219+
* @instance
220+
* @example
221+
* {
222+
* _id: '5dde6ca23631a92c2d616250',
223+
* strings: { name: { en: 'Confirmed' } },
224+
* }
225+
*/
226+
const stage = {
227+
type: ObjectId,
228+
ref: Predefine.MODEL_NAME,
229+
// required: true,
230+
index: true,
231+
exists: true,
232+
aggregatable: { unwind: true },
233+
autopopulate: AUTOPOPULATE_OPTION_PREDEFINE,
234+
taggable: true,
235+
exportable: {
236+
format: (v) => get(v, 'strings.name.en'),
237+
default: 'NA',
238+
},
239+
default: DEFAULT_SEEDS.CaseStage,
240+
};
241+
242+
/**
243+
* @name severity
244+
* @description Currently assigned severity of a case.
245+
*
246+
* @memberof Case
247+
*
248+
* @type {object}
249+
* @property {object} type - schema(data) type
250+
* @property {boolean} required - mark required
251+
* @property {boolean} index - ensure database index
252+
* @property {boolean} exists - ensure ref exists before save
253+
* @property {object} autopopulate - auto populate(eager loading) options
254+
* @property {boolean} taggable - allow field use for tagging
255+
* @property {boolean} exportable - allow field use for exporting
256+
* @property {boolean} aggregatable - allow field use for aggregation
257+
* @property {boolean} default - default value set when none provided
258+
* @property {object} fake - fake data generator options
259+
*
260+
* @author lally elias <lallyelias87@gmail.com>
261+
* @since 0.4.0
262+
* @version 0.1.0
263+
* @instance
264+
* @example
265+
* {
266+
* _id: '5dde6ca23631a92c2d616250',
267+
* strings: { name: { en: 'Extreme' } },
268+
* }
269+
*/
270+
const severity = {
271+
type: ObjectId,
272+
ref: Predefine.MODEL_NAME,
273+
// required: true,
274+
index: true,
275+
exists: true,
276+
aggregatable: { unwind: true },
277+
autopopulate: AUTOPOPULATE_OPTION_PREDEFINE,
278+
taggable: true,
279+
exportable: {
280+
format: (v) => get(v, 'strings.name.en'),
281+
default: 'NA',
282+
},
283+
default: DEFAULT_SEEDS.CaseSeverity,
284+
};
285+
198286
/**
199287
* @name number
200288
* @description Human readable, unique identifier of a case.
@@ -1131,6 +1219,7 @@ const followup = createSubSchema({
11311219

11321220
const SCHEMA = mergeObjects(
11331221
{ number },
1222+
{ stage, severity },
11341223
{ victim },
11351224
{ description },
11361225
{ reportedAt, reporter },

lib/index.js

+90-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const actions = require('mongoose-rest-actions');
1313
const exportable = require('@lykmapipo/mongoose-exportable');
1414
const moment = require('moment');
1515
const predefine = require('@lykmapipo/predefine');
16-
const eweaEvent = require('@codetanzania/ewea-event');
1716
const eweaCommon = require('@codetanzania/ewea-common');
17+
const eweaEvent = require('@codetanzania/ewea-event');
1818
require('mongoose-geojson-schemas');
1919
const emisStakeholder = require('@codetanzania/emis-stakeholder');
2020

@@ -197,6 +197,94 @@ const event = {
197197
default: undefined,
198198
};
199199

200+
/**
201+
* @name stage
202+
* @description Currently assigned stage of a case.
203+
*
204+
* @memberof Case
205+
*
206+
* @type {object}
207+
* @property {object} type - schema(data) type
208+
* @property {boolean} required - mark required
209+
* @property {boolean} index - ensure database index
210+
* @property {boolean} exists - ensure ref exists before save
211+
* @property {object} autopopulate - auto populate(eager loading) options
212+
* @property {boolean} taggable - allow field use for tagging
213+
* @property {boolean} exportable - allow field use for exporting
214+
* @property {boolean} aggregatable - allow field use for aggregation
215+
* @property {boolean} default - default value set when none provided
216+
* @property {object} fake - fake data generator options
217+
*
218+
* @author lally elias <lallyelias87@gmail.com>
219+
* @since 0.4.0
220+
* @version 0.1.0
221+
* @instance
222+
* @example
223+
* {
224+
* _id: '5dde6ca23631a92c2d616250',
225+
* strings: { name: { en: 'Confirmed' } },
226+
* }
227+
*/
228+
const stage = {
229+
type: mongooseCommon.ObjectId,
230+
ref: predefine.Predefine.MODEL_NAME,
231+
// required: true,
232+
index: true,
233+
exists: true,
234+
aggregatable: { unwind: true },
235+
autopopulate: AUTOPOPULATE_OPTION_PREDEFINE,
236+
taggable: true,
237+
exportable: {
238+
format: (v) => lodash.get(v, 'strings.name.en'),
239+
default: 'NA',
240+
},
241+
default: eweaCommon.DEFAULT_SEEDS.CaseStage,
242+
};
243+
244+
/**
245+
* @name severity
246+
* @description Currently assigned severity of a case.
247+
*
248+
* @memberof Case
249+
*
250+
* @type {object}
251+
* @property {object} type - schema(data) type
252+
* @property {boolean} required - mark required
253+
* @property {boolean} index - ensure database index
254+
* @property {boolean} exists - ensure ref exists before save
255+
* @property {object} autopopulate - auto populate(eager loading) options
256+
* @property {boolean} taggable - allow field use for tagging
257+
* @property {boolean} exportable - allow field use for exporting
258+
* @property {boolean} aggregatable - allow field use for aggregation
259+
* @property {boolean} default - default value set when none provided
260+
* @property {object} fake - fake data generator options
261+
*
262+
* @author lally elias <lallyelias87@gmail.com>
263+
* @since 0.4.0
264+
* @version 0.1.0
265+
* @instance
266+
* @example
267+
* {
268+
* _id: '5dde6ca23631a92c2d616250',
269+
* strings: { name: { en: 'Extreme' } },
270+
* }
271+
*/
272+
const severity = {
273+
type: mongooseCommon.ObjectId,
274+
ref: predefine.Predefine.MODEL_NAME,
275+
// required: true,
276+
index: true,
277+
exists: true,
278+
aggregatable: { unwind: true },
279+
autopopulate: AUTOPOPULATE_OPTION_PREDEFINE,
280+
taggable: true,
281+
exportable: {
282+
format: (v) => lodash.get(v, 'strings.name.en'),
283+
default: 'NA',
284+
},
285+
default: eweaCommon.DEFAULT_SEEDS.CaseSeverity,
286+
};
287+
200288
/**
201289
* @name number
202290
* @description Human readable, unique identifier of a case.
@@ -1133,6 +1221,7 @@ const followup = mongooseCommon.createSubSchema({
11331221

11341222
const SCHEMA = common.mergeObjects(
11351223
{ number },
1224+
{ stage, severity },
11361225
{ victim },
11371226
{ description },
11381227
{ reportedAt, reporter },

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codetanzania/ewea-case",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "A representation of an entity which define and track cases during an emergency event.",
55
"main": "lib/index.js",
66
"module": "es/index.js",

0 commit comments

Comments
 (0)