Skip to content

Commit 0737d7b

Browse files
committed
chore(deps): force latest version & audit fix
1 parent 7ac4589 commit 0737d7b

File tree

4 files changed

+109
-15
lines changed

4 files changed

+109
-15
lines changed

es/index.js

+54-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { COLLECTION_NAME_CASE, POPULATION_MAX_DEPTH, MODEL_NAME_CASE } from '@codetanzania/ewea-internals';
1+
import { COLLECTION_NAME_CASE, POPULATION_MAX_DEPTH, PREDEFINE_NAMESPACE_ADMINISTRATIVEAREA, PREDEFINE_NAMESPACE_PARTYGENDER, PREDEFINE_NAMESPACE_PARTYOCCUPATION, PREDEFINE_NAMESPACE_PARTYNATIONALITY, MODEL_NAME_CASE } from '@codetanzania/ewea-internals';
22
import { compact, mergeObjects, idOf, pkg } from '@lykmapipo/common';
33
import { getString, apiVersion as apiVersion$1 } from '@lykmapipo/env';
44
import { ObjectId, createSubSchema, model, createSchema, copyInstance, connect } from '@lykmapipo/mongoose-common';
@@ -12,6 +12,7 @@ import exportable from '@lykmapipo/mongoose-exportable';
1212
import moment from 'moment';
1313
import { Predefine } from '@lykmapipo/predefine';
1414
import { Event } from '@codetanzania/ewea-event';
15+
import { DEFAULT_SEEDS } from '@codetanzania/ewea-common';
1516
import 'mongoose-geojson-schemas';
1617
import { Party } from '@codetanzania/emis-stakeholder';
1718

@@ -565,6 +566,7 @@ const area = {
565566
order: 3,
566567
default: 'NA',
567568
},
569+
default: DEFAULT_SEEDS[PREDEFINE_NAMESPACE_ADMINISTRATIVEAREA],
568570
};
569571

570572
/**
@@ -618,7 +620,7 @@ const facility = {
618620
* @property {boolean} taggable - allow field use for tagging
619621
* @property {boolean} default - default value set when none provided
620622
*
621-
* @since 2.6.0
623+
* @since 0.1.0
622624
* @version 0.1.0
623625
* @instance
624626
* @example
@@ -642,7 +644,7 @@ const gender = {
642644
order: 2,
643645
default: 'NA',
644646
},
645-
default: undefined,
647+
default: DEFAULT_SEEDS[PREDEFINE_NAMESPACE_PARTYGENDER],
646648
};
647649

648650
/**
@@ -658,7 +660,7 @@ const gender = {
658660
* @property {boolean} taggable - allow field use for tagging
659661
* @property {boolean} default - default value set when none provided
660662
*
661-
* @since 2.6.0
663+
* @since 0.1.0
662664
* @version 0.1.0
663665
* @instance
664666
* @example
@@ -682,7 +684,47 @@ const occupation = {
682684
order: 2,
683685
default: 'NA',
684686
},
685-
default: undefined,
687+
default: DEFAULT_SEEDS[PREDEFINE_NAMESPACE_PARTYOCCUPATION],
688+
};
689+
690+
/**
691+
* @name nationality
692+
* @description Assignable or given nationality to a party.
693+
*
694+
* @type {object}
695+
* @property {object} type - schema(data) type
696+
* @property {string} ref - referenced collection
697+
* @property {boolean} index - ensure database index
698+
* @property {boolean} exists - ensure ref exists before save
699+
* @property {object} autopopulate - population options
700+
* @property {boolean} taggable - allow field use for tagging
701+
* @property {boolean} default - default value set when none provided
702+
*
703+
* @since 0.2.0
704+
* @version 0.1.0
705+
* @instance
706+
* @example
707+
* {
708+
* "name": { "en" : "Tanzanian" }
709+
* }
710+
*/
711+
const nationality = {
712+
type: ObjectId,
713+
ref: Predefine.MODEL_NAME,
714+
index: true,
715+
exists: true,
716+
aggregatable: { unwind: true },
717+
autopopulate: AUTOPOPULATE_OPTION_PREDEFINE,
718+
taggable: true,
719+
exportable: {
720+
header: 'Nationality',
721+
format: (v) => {
722+
return v && v.strings && compact([v.strings.name.en]).join(' - ');
723+
},
724+
order: 2,
725+
default: 'NA',
726+
},
727+
default: DEFAULT_SEEDS[PREDEFINE_NAMESPACE_PARTYNATIONALITY],
686728
};
687729

688730
/**
@@ -724,11 +766,13 @@ const nextOfKin = createSubSchema({
724766
* @property {object} gender - Gender of the victim
725767
* @property {number} age - Age of the victim
726768
* @property {number} weight - Weight of the victim
769+
* @property {object} occupation - Occupation of the victim
770+
* @property {object} nationality - Nationality of the victim
727771
* @property {string} address - Address of the victim
728772
*
729773
* @author lally elias <lallyelias87@gmail.com>
730774
* @since 0.1.0
731-
* @version 0.1.0
775+
* @version 0.2.0
732776
* @instance
733777
* @example
734778
* {
@@ -739,6 +783,8 @@ const nextOfKin = createSubSchema({
739783
* gender: { name: { en: "Female"} },
740784
* age: 23,
741785
* weight: 53,
786+
* occupation: { name: { en: "Businessman"} },
787+
* nationality: { name: { en: "Tanzanian"} },
742788
* address: "Tandale",
743789
* area: { name: { en: "Dar es Salaam"} },
744790
* nextOfKin: { name: "Halima Mdoe", mobile: "+255715463740" }
@@ -750,10 +796,11 @@ const victim = createSubSchema({
750796
name,
751797
mobile,
752798
gender,
753-
occupation,
754799
age,
755800
// dob
756801
weight,
802+
occupation,
803+
nationality,
757804
address,
758805
area,
759806
nextOfKin,

lib/index.js

+53-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const exportable = require('@lykmapipo/mongoose-exportable');
1414
const moment = require('moment');
1515
const predefine = require('@lykmapipo/predefine');
1616
const eweaEvent = require('@codetanzania/ewea-event');
17+
const eweaCommon = require('@codetanzania/ewea-common');
1718
require('mongoose-geojson-schemas');
1819
const emisStakeholder = require('@codetanzania/emis-stakeholder');
1920

@@ -567,6 +568,7 @@ const area = {
567568
order: 3,
568569
default: 'NA',
569570
},
571+
default: eweaCommon.DEFAULT_SEEDS[eweaInternals.PREDEFINE_NAMESPACE_ADMINISTRATIVEAREA],
570572
};
571573

572574
/**
@@ -620,7 +622,7 @@ const facility = {
620622
* @property {boolean} taggable - allow field use for tagging
621623
* @property {boolean} default - default value set when none provided
622624
*
623-
* @since 2.6.0
625+
* @since 0.1.0
624626
* @version 0.1.0
625627
* @instance
626628
* @example
@@ -644,7 +646,7 @@ const gender = {
644646
order: 2,
645647
default: 'NA',
646648
},
647-
default: undefined,
649+
default: eweaCommon.DEFAULT_SEEDS[eweaInternals.PREDEFINE_NAMESPACE_PARTYGENDER],
648650
};
649651

650652
/**
@@ -660,7 +662,7 @@ const gender = {
660662
* @property {boolean} taggable - allow field use for tagging
661663
* @property {boolean} default - default value set when none provided
662664
*
663-
* @since 2.6.0
665+
* @since 0.1.0
664666
* @version 0.1.0
665667
* @instance
666668
* @example
@@ -684,7 +686,47 @@ const occupation = {
684686
order: 2,
685687
default: 'NA',
686688
},
687-
default: undefined,
689+
default: eweaCommon.DEFAULT_SEEDS[eweaInternals.PREDEFINE_NAMESPACE_PARTYOCCUPATION],
690+
};
691+
692+
/**
693+
* @name nationality
694+
* @description Assignable or given nationality to a party.
695+
*
696+
* @type {object}
697+
* @property {object} type - schema(data) type
698+
* @property {string} ref - referenced collection
699+
* @property {boolean} index - ensure database index
700+
* @property {boolean} exists - ensure ref exists before save
701+
* @property {object} autopopulate - population options
702+
* @property {boolean} taggable - allow field use for tagging
703+
* @property {boolean} default - default value set when none provided
704+
*
705+
* @since 0.2.0
706+
* @version 0.1.0
707+
* @instance
708+
* @example
709+
* {
710+
* "name": { "en" : "Tanzanian" }
711+
* }
712+
*/
713+
const nationality = {
714+
type: mongooseCommon.ObjectId,
715+
ref: predefine.Predefine.MODEL_NAME,
716+
index: true,
717+
exists: true,
718+
aggregatable: { unwind: true },
719+
autopopulate: AUTOPOPULATE_OPTION_PREDEFINE,
720+
taggable: true,
721+
exportable: {
722+
header: 'Nationality',
723+
format: (v) => {
724+
return v && v.strings && common.compact([v.strings.name.en]).join(' - ');
725+
},
726+
order: 2,
727+
default: 'NA',
728+
},
729+
default: eweaCommon.DEFAULT_SEEDS[eweaInternals.PREDEFINE_NAMESPACE_PARTYNATIONALITY],
688730
};
689731

690732
/**
@@ -726,11 +768,13 @@ const nextOfKin = mongooseCommon.createSubSchema({
726768
* @property {object} gender - Gender of the victim
727769
* @property {number} age - Age of the victim
728770
* @property {number} weight - Weight of the victim
771+
* @property {object} occupation - Occupation of the victim
772+
* @property {object} nationality - Nationality of the victim
729773
* @property {string} address - Address of the victim
730774
*
731775
* @author lally elias <lallyelias87@gmail.com>
732776
* @since 0.1.0
733-
* @version 0.1.0
777+
* @version 0.2.0
734778
* @instance
735779
* @example
736780
* {
@@ -741,6 +785,8 @@ const nextOfKin = mongooseCommon.createSubSchema({
741785
* gender: { name: { en: "Female"} },
742786
* age: 23,
743787
* weight: 53,
788+
* occupation: { name: { en: "Businessman"} },
789+
* nationality: { name: { en: "Tanzanian"} },
744790
* address: "Tandale",
745791
* area: { name: { en: "Dar es Salaam"} },
746792
* nextOfKin: { name: "Halima Mdoe", mobile: "+255715463740" }
@@ -752,10 +798,11 @@ const victim = mongooseCommon.createSubSchema({
752798
name,
753799
mobile,
754800
gender,
755-
occupation,
756801
age,
757802
// dob
758803
weight,
804+
occupation,
805+
nationality,
759806
address,
760807
area,
761808
nextOfKin,

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.1.0",
3+
"version": "0.2.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)