Skip to content

Commit 5637f7a

Browse files
committed
chore(deps): force latest version & audit fix
1 parent bd47174 commit 5637f7a

File tree

4 files changed

+191
-45
lines changed

4 files changed

+191
-45
lines changed

es/index.js

+95-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { COLLECTION_NAME_CASE, POPULATION_MAX_DEPTH, PREDEFINE_NAMESPACE_CASESTAGE, PREDEFINE_NAMESPACE_CASESEVERITY, PREDEFINE_NAMESPACE_ADMINISTRATIVEAREA, PREDEFINE_NAMESPACE_PARTYGENDER, PREDEFINE_NAMESPACE_PARTYOCCUPATION, PREDEFINE_NAMESPACE_PARTYNATIONALITY, MODEL_NAME_CASE, DEFAULT_SEEDS as DEFAULT_SEEDS$1 } from '@codetanzania/ewea-internals';
22
import { compact, mergeObjects, idOf, pkg } from '@lykmapipo/common';
3-
import { getString, apiVersion as apiVersion$1 } from '@lykmapipo/env';
3+
import { getString, getStrings, apiVersion as apiVersion$1 } from '@lykmapipo/env';
44
import { ObjectId, createSubSchema, Mixed, model, createSchema, copyInstance, connect } from '@lykmapipo/mongoose-common';
55
import { mount } from '@lykmapipo/express-common';
66
import { Router, getFor, schemaFor, downloadFor, postFor, getByIdFor, patchFor, putFor, deleteFor, start as start$1 } from '@lykmapipo/express-rest-actions';
@@ -669,6 +669,9 @@ const followedAt = {
669669
},
670670
};
671671

672+
const DEFAULT_LOCALE = getString('DEFAULT_LOCALE', 'en');
673+
const LOCALES = getStrings('LOCALES', DEFAULT_LOCALE);
674+
672675
/**
673676
* @name properties
674677
* @description A map of key value pairs to allow to associate
@@ -695,13 +698,48 @@ const properties = {
695698
fake: (f) => f.helpers.createTransaction(),
696699
};
697700

701+
/**
702+
* @name locale
703+
* @description Defines the party's language, region and any
704+
* special variant preferences.
705+
*
706+
* @see {@link https://en.wikipedia.org/wiki/Locale_(computer_software)}
707+
*
708+
* @type {object}
709+
* @property {object} type - schema(data) type
710+
* @property {boolean} trim - force trimming
711+
* @property {boolean} enum - list of acceptable values
712+
* @property {boolean} index - ensure database index
713+
* @property {boolean} searchable - allow for searching
714+
* @property {boolean} taggable - allow field use for tagging
715+
* @property {boolean} default - default value set when none provided
716+
* @property {object} fake - fake data generator options
717+
*
718+
* @since 0.1.0
719+
* @version 0.1.0
720+
* @instance
721+
* @example
722+
* en
723+
*/
724+
const locale = {
725+
type: String,
726+
trim: true,
727+
enum: LOCALES,
728+
index: true,
729+
searchable: true,
730+
taggable: true,
731+
default: DEFAULT_LOCALE,
732+
fake: true,
733+
};
734+
698735
/**
699736
* @name name
700737
* @description Full name name of the party(i.e individual).
701738
*
702739
*
703740
* @property {object} type - schema(data) type
704741
* @property {boolean} trim - force trimming
742+
* @property {boolean} startcase - ensure start case(or title case)
705743
* @property {boolean} index - ensure database index
706744
* @property {boolean} searchable - allow for searching
707745
* @property {boolean} taggable - allow field use for tagging
@@ -718,6 +756,7 @@ const properties = {
718756
const name = {
719757
type: String,
720758
trim: true,
759+
startcase: true,
721760
index: true,
722761
searchable: true,
723762
taggable: true,
@@ -802,7 +841,7 @@ const score = {
802841
};
803842

804843
/**
805-
* @name phone
844+
* @name mobile
806845
* @description A mobile phone number of the party(i.e individual).
807846
*
808847
* @property {object} type - schema(data) type
@@ -827,7 +866,39 @@ const mobile = {
827866
searchable: true,
828867
taggable: true,
829868
exportable: true,
830-
fake: (faker) => faker.helpers.replaceSymbolWithNumber('255714######'),
869+
fake: (f) => f.helpers.replaceSymbolWithNumber('255714######'),
870+
};
871+
872+
/**
873+
* @name email
874+
* @description Email address of the party(i.e individual).
875+
*
876+
* @type {object}
877+
* @property {object} type - schema(data) type
878+
* @property {boolean} trim - force trimming
879+
* @property {boolean} lowercase - force lower-casing
880+
* @property {boolean} email - force to be a valid email address
881+
* @property {boolean} index - ensure database index
882+
* @property {boolean} searchable - allow for searching
883+
* @property {boolean} taggable - allow field use for tagging
884+
* @property {object} fake - fake data generator options
885+
*
886+
* @since 0.1.0
887+
* @version 0.1.0
888+
* @instance
889+
* @example
890+
* jane.doe@example.com
891+
*/
892+
const email = {
893+
type: String,
894+
trim: true,
895+
lowercase: true,
896+
email: true,
897+
index: true,
898+
searchable: true,
899+
taggable: true,
900+
exportable: true,
901+
fake: (f) => f.internet.email(),
831902
};
832903

833904
/**
@@ -1131,12 +1202,10 @@ const nationality = {
11311202
* @description A party who closest to a victim.
11321203
*
11331204
* @type {object}
1134-
* @property {string} name - Full name of the nextOfKin
1135-
* @property {string} mobile - Mobile phone number of the nextOfKin
1136-
* @property {object} facility - Facility of the nextOfKin
1137-
* @property {object} area - Administrative area of the nextOfKin
1138-
* @property {object} location - Geo-point of the nextOfKin
1139-
* @property {string} address - Address of the nextOfKin
1205+
* @property {string} name - Full name of the next of kin
1206+
* @property {string} mobile - Mobile phone number of the next of kin
1207+
* @property {string} email - Email address of the next of kin
1208+
* @property {string} locale - Locale of the next of kin
11401209
*
11411210
* @author lally elias <lallyelias87@gmail.com>
11421211
* @since 0.1.0
@@ -1146,11 +1215,16 @@ const nationality = {
11461215
* {
11471216
* name: "Jane Doe",
11481217
* mobile: "+255715463739"
1218+
* email: "jane.doe@example.com"
1219+
* locale: "en"
11491220
* }
11501221
*/
11511222
const nextOfKin = createSubSchema({
11521223
name,
11531224
mobile,
1225+
email,
1226+
locale,
1227+
// csids,
11541228
});
11551229

11561230
/**
@@ -1162,12 +1236,14 @@ const nextOfKin = createSubSchema({
11621236
* @property {string} pcr - Valid patient care number
11631237
* @property {string} name - Full name of the victim
11641238
* @property {string} mobile - Mobile phone number of the victim
1239+
* @property {string} email - Email address of the victim
11651240
* @property {object} gender - Gender of the victim
11661241
* @property {number} age - Age of the victim
11671242
* @property {number} weight - Weight of the victim
11681243
* @property {object} occupation - Occupation of the victim
11691244
* @property {object} nationality - Nationality of the victim
11701245
* @property {string} address - Address of the victim
1246+
* @property {string} locale - Locale of the victim
11711247
*
11721248
* @author lally elias <lallyelias87@gmail.com>
11731249
* @since 0.1.0
@@ -1179,13 +1255,15 @@ const nextOfKin = createSubSchema({
11791255
* pcr: "PTN-8687",
11801256
* name: "Jane Doe",
11811257
* mobile: "+255715463739",
1258+
* email: "jane.doe@example.com",
11821259
* gender: { name: { en: "Female"} },
11831260
* age: 23,
11841261
* weight: 53,
11851262
* occupation: { name: { en: "Businessman"} },
11861263
* nationality: { name: { en: "Tanzanian"} },
11871264
* address: "Tandale",
11881265
* area: { name: { en: "Dar es Salaam"} },
1266+
* locale: "en",
11891267
* nextOfKin: { name: "Halima Mdoe", mobile: "+255715463740" }
11901268
* }
11911269
*/
@@ -1194,6 +1272,7 @@ const victim = createSubSchema({
11941272
pcr,
11951273
name,
11961274
mobile,
1275+
email,
11971276
gender,
11981277
age,
11991278
// dob
@@ -1202,24 +1281,18 @@ const victim = createSubSchema({
12021281
nationality,
12031282
address,
12041283
area,
1284+
locale,
12051285
nextOfKin,
1286+
// csids.
12061287
});
12071288

12081289
/**
1209-
* @name victim
1210-
* @description A party(i.e patient or victim) whom a case is for.
1290+
* @name followup
1291+
* @description A party(i.e doctor or nurse) who followed case victim.
12111292
*
12121293
* @type {object}
1213-
* @property {string} referral - Valid referral number
1214-
* @property {string} pcr - Valid patient care number
1215-
* @property {string} name - Full name of the victim
1216-
* @property {string} mobile - Mobile phone number of the victim
1217-
* @property {object} gender - Gender of the victim
1218-
* @property {number} age - Age of the victim
1219-
* @property {number} weight - Weight of the victim
1220-
* @property {object} occupation - Occupation of the victim
1221-
* @property {object} nationality - Nationality of the victim
1222-
* @property {string} address - Address of the victim
1294+
* @property {object} follower - Following party
1295+
* @property {Date} followedAt - Latest date followed
12231296
*
12241297
* @author lally elias <lallyelias87@gmail.com>
12251298
* @since 0.1.0
@@ -1238,7 +1311,7 @@ const followup = createSubSchema({
12381311
follower,
12391312
followedAt,
12401313
symptoms: properties,
1241-
score,
1314+
score, // TODO: systemScore vs followerScore
12421315
outcome,
12431316
remarks,
12441317
});

0 commit comments

Comments
 (0)