6
6
} from '@codetanzania/ewea-internals' ;
7
7
import { DEFAULT_SEEDS } from '@codetanzania/ewea-common' ;
8
8
import { compact } from '@lykmapipo/common' ;
9
+ import { getString , getStrings } from '@lykmapipo/env' ;
9
10
import { Point } from 'mongoose-geojson-schemas' ;
10
11
import { ObjectId , Mixed , createSubSchema } from '@lykmapipo/mongoose-common' ;
11
12
import { Predefine } from '@lykmapipo/predefine' ;
@@ -19,6 +20,9 @@ import { follower } from './parties.schema';
19
20
import { followedAt } from './dates.schema' ;
20
21
import { outcome , remarks } from './base.schema' ;
21
22
23
+ const DEFAULT_LOCALE = getString ( 'DEFAULT_LOCALE' , 'en' ) ;
24
+ const LOCALES = getStrings ( 'LOCALES' , DEFAULT_LOCALE ) ;
25
+
22
26
/**
23
27
* @name properties
24
28
* @description A map of key value pairs to allow to associate
@@ -45,6 +49,40 @@ export const properties = {
45
49
fake : ( f ) => f . helpers . createTransaction ( ) ,
46
50
} ;
47
51
52
+ /**
53
+ * @name locale
54
+ * @description Defines the party's language, region and any
55
+ * special variant preferences.
56
+ *
57
+ * @see {@link https://en.wikipedia.org/wiki/Locale_(computer_software) }
58
+ *
59
+ * @type {object }
60
+ * @property {object } type - schema(data) type
61
+ * @property {boolean } trim - force trimming
62
+ * @property {boolean } enum - list of acceptable values
63
+ * @property {boolean } index - ensure database index
64
+ * @property {boolean } searchable - allow for searching
65
+ * @property {boolean } taggable - allow field use for tagging
66
+ * @property {boolean } default - default value set when none provided
67
+ * @property {object } fake - fake data generator options
68
+ *
69
+ * @since 0.1.0
70
+ * @version 0.1.0
71
+ * @instance
72
+ * @example
73
+ * en
74
+ */
75
+ export const locale = {
76
+ type : String ,
77
+ trim : true ,
78
+ enum : LOCALES ,
79
+ index : true ,
80
+ searchable : true ,
81
+ taggable : true ,
82
+ default : DEFAULT_LOCALE ,
83
+ fake : true ,
84
+ } ;
85
+
48
86
/**
49
87
* @name name
50
88
* @description Full name name of the party(i.e individual).
@@ -539,7 +577,8 @@ export const nationality = {
539
577
* @type {object }
540
578
* @property {string } name - Full name of the next of kin
541
579
* @property {string } mobile - Mobile phone number of the next of kin
542
- * @property {string } email - Email address of the victim
580
+ * @property {string } email - Email address of the next of kin
581
+ * @property {string } locale - Locale of the next of kin
543
582
*
544
583
* @author lally elias <lallyelias87@gmail.com>
545
584
* @since 0.1.0
@@ -550,12 +589,15 @@ export const nationality = {
550
589
* name: "Jane Doe",
551
590
* mobile: "+255715463739"
552
591
* email: "jane.doe@example .com"
592
+ * locale: "en"
553
593
* }
554
594
*/
555
595
export const nextOfKin = createSubSchema ( {
556
596
name,
557
597
mobile,
558
598
email,
599
+ locale,
600
+ // csids,
559
601
} ) ;
560
602
561
603
/**
@@ -574,6 +616,7 @@ export const nextOfKin = createSubSchema({
574
616
* @property {object } occupation - Occupation of the victim
575
617
* @property {object } nationality - Nationality of the victim
576
618
* @property {string } address - Address of the victim
619
+ * @property {string } locale - Locale of the victim
577
620
*
578
621
* @author lally elias <lallyelias87@gmail.com>
579
622
* @since 0.1.0
@@ -593,6 +636,7 @@ export const nextOfKin = createSubSchema({
593
636
* nationality: { name: { en: "Tanzanian"} },
594
637
* address: "Tandale",
595
638
* area: { name: { en: "Dar es Salaam"} },
639
+ * locale: "en",
596
640
* nextOfKin: { name: "Halima Mdoe", mobile: "+255715463740" }
597
641
* }
598
642
*/
@@ -610,7 +654,9 @@ export const victim = createSubSchema({
610
654
nationality,
611
655
address,
612
656
area,
657
+ locale,
613
658
nextOfKin,
659
+ // csids.
614
660
} ) ;
615
661
616
662
/**
0 commit comments