openchs-models 1.12.2 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Family.js +2 -2
- package/dist/Individual.js +22 -3
- package/dist/MediaQueue.js +4 -1
- package/dist/Schema.js +11 -1
- package/dist/SubjectType.js +14 -0
- package/dist/draft/DraftSubject.js +6 -0
- package/package.json +1 -1
package/dist/Family.js
CHANGED
|
@@ -50,7 +50,7 @@ class Family extends _BaseEntity.default {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
get toResource() {
|
|
53
|
-
const resource = _lodash.default.pick(this, ["uuid", "firstName", "lastName", "dateOfBirthVerified"]);
|
|
53
|
+
const resource = _lodash.default.pick(this, ["uuid", "firstName", "lastName", "profilePicture", "dateOfBirthVerified"]);
|
|
54
54
|
|
|
55
55
|
resource.dateOfBirth = (0, _moment.default)(this.dateOfBirth).format("YYYY-MM-DD");
|
|
56
56
|
resource.registrationDate = (0, _moment.default)(this.registrationDate).format("YYYY-MM-DD");
|
|
@@ -67,7 +67,7 @@ class Family extends _BaseEntity.default {
|
|
|
67
67
|
const addressLevel = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(individualResource, "addressUUID"), _AddressLevel.default.schema.name);
|
|
68
68
|
const gender = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(individualResource, "genderUUID"), _Gender.default.schema.name);
|
|
69
69
|
|
|
70
|
-
const individual = _General.default.assignFields(individualResource, new _Individual.default(), ["uuid", "firstName", "lastName", "dateOfBirthVerified"], ["dateOfBirth", "registrationDate"], ["observations"], entityService);
|
|
70
|
+
const individual = _General.default.assignFields(individualResource, new _Individual.default(), ["uuid", "firstName", "lastName", "profilePicture", "dateOfBirthVerified"], ["dateOfBirth", "registrationDate"], ["observations"], entityService);
|
|
71
71
|
|
|
72
72
|
individual.gender = gender;
|
|
73
73
|
individual.lowestAddressLevel = addressLevel;
|
package/dist/Individual.js
CHANGED
|
@@ -85,6 +85,8 @@ class Individual extends _BaseEntity.default {
|
|
|
85
85
|
|
|
86
86
|
_defineProperty(this, "lastName", void 0);
|
|
87
87
|
|
|
88
|
+
_defineProperty(this, "profilePicture", void 0);
|
|
89
|
+
|
|
88
90
|
_defineProperty(this, "dateOfBirthVerified", void 0);
|
|
89
91
|
|
|
90
92
|
_defineProperty(this, "latestEntityApprovalStatus", void 0);
|
|
@@ -127,7 +129,7 @@ class Individual extends _BaseEntity.default {
|
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
get toResource() {
|
|
130
|
-
const resource = _lodash.default.pick(this, ["uuid", "firstName", "lastName", "dateOfBirthVerified", "voided"]);
|
|
132
|
+
const resource = _lodash.default.pick(this, ["uuid", "firstName", "lastName", "profilePicture", "dateOfBirthVerified", "voided"]);
|
|
131
133
|
|
|
132
134
|
resource.dateOfBirth = this.dateOfBirth ? (0, _moment.default)(this.dateOfBirth).format("YYYY-MM-DD") : null;
|
|
133
135
|
resource.registrationDate = (0, _moment.default)(this.registrationDate).format("YYYY-MM-DD");
|
|
@@ -154,11 +156,12 @@ class Individual extends _BaseEntity.default {
|
|
|
154
156
|
return this.nonVoidedEnrolments().find(enrolment => enrolment.findLatestObservationInEntireEnrolment(conceptNameOrUuid) !== undefined);
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
static newInstance(uuid, firstName, lastName, dateOfBirth, dateOfBirthVerified, gender, lowestAddressLevel, subjectType) {
|
|
159
|
+
static newInstance(uuid, firstName, lastName, dateOfBirth, dateOfBirthVerified, gender, lowestAddressLevel, subjectType, profilePicture) {
|
|
158
160
|
const individual = new Individual();
|
|
159
161
|
individual.uuid = uuid;
|
|
160
162
|
individual.firstName = firstName;
|
|
161
163
|
individual.lastName = lastName;
|
|
164
|
+
individual.profilePicture = profilePicture;
|
|
162
165
|
individual.subjectType = subjectType;
|
|
163
166
|
individual.name = individual.nameString;
|
|
164
167
|
individual.dateOfBirth = dateOfBirth;
|
|
@@ -173,7 +176,7 @@ class Individual extends _BaseEntity.default {
|
|
|
173
176
|
const gender = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(individualResource, "genderUUID"), _Gender.default.schema.name);
|
|
174
177
|
const subjectType = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(individualResource, "subjectTypeUUID"), _SubjectType.default.schema.name);
|
|
175
178
|
|
|
176
|
-
const individual = _General.default.assignFields(individualResource, new Individual(), ["uuid", "firstName", "lastName", "dateOfBirthVerified", "voided"], ["dateOfBirth", "registrationDate"], ["observations"], entityService);
|
|
179
|
+
const individual = _General.default.assignFields(individualResource, new Individual(), ["uuid", "firstName", "lastName", "profilePicture", "dateOfBirthVerified", "voided"], ["dateOfBirth", "registrationDate"], ["observations"], entityService);
|
|
177
180
|
|
|
178
181
|
individual.gender = gender;
|
|
179
182
|
individual.lowestAddressLevel = addressLevel;
|
|
@@ -460,6 +463,7 @@ class Individual extends _BaseEntity.default {
|
|
|
460
463
|
individual.name = this.name;
|
|
461
464
|
individual.firstName = this.firstName;
|
|
462
465
|
individual.lastName = this.lastName;
|
|
466
|
+
individual.profilePicture = this.profilePicture;
|
|
463
467
|
individual.dateOfBirth = this.dateOfBirth;
|
|
464
468
|
individual.registrationDate = this.registrationDate;
|
|
465
469
|
individual.dateOfBirthVerified = this.dateOfBirthVerified;
|
|
@@ -485,6 +489,7 @@ class Individual extends _BaseEntity.default {
|
|
|
485
489
|
individual.name = this.name;
|
|
486
490
|
individual.firstName = this.firstName;
|
|
487
491
|
individual.lastName = this.lastName;
|
|
492
|
+
individual.profilePicture = this.profilePicture;
|
|
488
493
|
individual.dateOfBirth = this.dateOfBirth;
|
|
489
494
|
individual.gender = _lodash.default.isNil(this.gender) ? null : this.gender.clone();
|
|
490
495
|
return individual;
|
|
@@ -600,6 +605,14 @@ class Individual extends _BaseEntity.default {
|
|
|
600
605
|
return _lodash.default.sortBy(this.nonVoidedEnrolments(), enrolment => enrolment.encounterDateTime);
|
|
601
606
|
}
|
|
602
607
|
|
|
608
|
+
getProfilePicture() {
|
|
609
|
+
return this.profilePicture;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
updateProfilePicture(newValue) {
|
|
613
|
+
this.profilePicture = newValue;
|
|
614
|
+
}
|
|
615
|
+
|
|
603
616
|
findMediaObservations() {
|
|
604
617
|
return (0, _Media.findMediaObservations)(this.observations);
|
|
605
618
|
}
|
|
@@ -784,6 +797,7 @@ class Individual extends _BaseEntity.default {
|
|
|
784
797
|
uuid: this.uuid,
|
|
785
798
|
firstName: this.firstName,
|
|
786
799
|
lastName: this.lastName,
|
|
800
|
+
profilePicture: this.profilePicture,
|
|
787
801
|
enrolments: this.enrolments,
|
|
788
802
|
dateOfBirth: this.dateOfBirth,
|
|
789
803
|
gender: this.gender,
|
|
@@ -816,6 +830,10 @@ _defineProperty(Individual, "schema", {
|
|
|
816
830
|
type: "string",
|
|
817
831
|
optional: true
|
|
818
832
|
},
|
|
833
|
+
profilePicture: {
|
|
834
|
+
type: "string",
|
|
835
|
+
optional: true
|
|
836
|
+
},
|
|
819
837
|
dateOfBirth: {
|
|
820
838
|
type: "date",
|
|
821
839
|
optional: true
|
|
@@ -878,6 +896,7 @@ _defineProperty(Individual, "validationKeys", {
|
|
|
878
896
|
GENDER: "GENDER",
|
|
879
897
|
FIRST_NAME: "FIRST_NAME",
|
|
880
898
|
LAST_NAME: "LAST_NAME",
|
|
899
|
+
PROFILE_PICTURE: "PROFILE_PICTURE",
|
|
881
900
|
REGISTRATION_DATE: "REGISTRATION_DATE",
|
|
882
901
|
LOWEST_ADDRESS_LEVEL: "LOWEST_ADDRESS_LEVEL",
|
|
883
902
|
REGISTRATION_LOCATION: "REGISTRATION_LOCATION",
|
package/dist/MediaQueue.js
CHANGED
|
@@ -12,11 +12,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
13
|
|
|
14
14
|
class MediaQueue {
|
|
15
|
-
static create(entityUUID, entityName, fileName, type, uuid = _General.default.randomUUID()) {
|
|
15
|
+
static create(entityUUID, entityName, fileName, type, entityTargetField, uuid = _General.default.randomUUID()) {
|
|
16
16
|
var mediaQueue = new MediaQueue();
|
|
17
17
|
mediaQueue.entityUUID = entityUUID;
|
|
18
18
|
mediaQueue.uuid = uuid;
|
|
19
19
|
mediaQueue.entityName = entityName;
|
|
20
|
+
mediaQueue.entityTargetField = entityTargetField;
|
|
20
21
|
mediaQueue.fileName = fileName;
|
|
21
22
|
mediaQueue.type = type;
|
|
22
23
|
return mediaQueue;
|
|
@@ -27,6 +28,7 @@ class MediaQueue {
|
|
|
27
28
|
mediaQueueItem.uuid = this.uuid;
|
|
28
29
|
mediaQueueItem.entityUUID = this.entityUUID;
|
|
29
30
|
mediaQueueItem.entityName = this.entityName;
|
|
31
|
+
mediaQueueItem.entityTargetField = this.entityTargetField;
|
|
30
32
|
mediaQueueItem.fileName = this.fileName;
|
|
31
33
|
mediaQueueItem.type = this.type;
|
|
32
34
|
return mediaQueueItem;
|
|
@@ -41,6 +43,7 @@ _defineProperty(MediaQueue, "schema", {
|
|
|
41
43
|
uuid: "string",
|
|
42
44
|
entityUUID: "string",
|
|
43
45
|
entityName: "string",
|
|
46
|
+
entityTargetField: "string",
|
|
44
47
|
fileName: "string",
|
|
45
48
|
type: "string"
|
|
46
49
|
}
|
package/dist/Schema.js
CHANGED
|
@@ -168,7 +168,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
168
168
|
var _default = {
|
|
169
169
|
//order is important, should be arranged according to the dependency
|
|
170
170
|
schema: [_LocaleMapping.default, _Settings.default, _Concept.ConceptAnswer, _Concept.default, _EncounterType.default, _Gender.default, _UserDefinedIndividualProperty.default, _AddressLevel.LocationMapping, _AddressLevel.default, _KeyValue.default, _Form.default, _FormMapping.default, _FormElementGroup.default, _FormElement.default, _SubjectType.default, _Individual.default, _ProgramOutcome.default, _Program.default, _ProgramEnrolment.default, _Observation.default, _ProgramEncounter.default, _Encounter.default, _EntitySyncStatus.default, _EntityQueue.default, _ConfigFile.default, _Checklist.default, _ChecklistItem.default, _Format.default, _UserInfo.default, _StringKeyNumericValue.default, _VisitScheduleInterval.default, _VisitScheduleConfig.default, _ProgramConfig.default, _Family.default, _IndividualRelation.default, _IndividualRelationGenderMapping.default, _IndividualRelationshipType.default, _IndividualRelationship.default, _RuleDependency.default, _Rule.default, _ChecklistItemStatus.default, _ChecklistDetail.default, _ChecklistItemDetail.default, _VideoTelemetric.default, _Video.default, _MediaQueue.default, _Point.default, _SyncTelemetry.default, _IdentifierSource.default, _IdentifierAssignment.default, _RuleFailureTelemetry.default, _BeneficiaryModePin.default, _OrganisationConfig.default, _PlatformTranslation.default, _Translation.default, _Groups.default, _MyGroups.default, _GroupPrivileges.default, _Privilege.default, _GroupRole.default, _GroupSubject.default, _DashboardCache.default, _LocationHierarchy.default, _ReportCard.default, _Dashboard.default, _DashboardSectionCardMapping.default, _DraftSubject.default, _StandardReportCardType.default, _ApprovalStatus.default, _EntityApprovalStatus.default, _GroupDashboard.default, _DashboardSection.default, _News.default, _Comment.default, _CommentThread.default, _Extension.default, _SubjectMigration.default],
|
|
171
|
-
schemaVersion:
|
|
171
|
+
schemaVersion: 152,
|
|
172
172
|
migration: function (oldDB, newDB) {
|
|
173
173
|
if (oldDB.schemaVersion < 10) {
|
|
174
174
|
var oldObjects = oldDB.objects("DecisionConfig");
|
|
@@ -612,6 +612,16 @@ var _default = {
|
|
|
612
612
|
individual.groups = groups;
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
|
+
|
|
616
|
+
if (oldDB.schemaVersion < 152) {
|
|
617
|
+
_lodash.default.forEach(newDB.objects(_MediaQueue.default.schema.name), mediaQueueItem => {
|
|
618
|
+
mediaQueueItem.entityTargetField = "observations";
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
_lodash.default.forEach(newDB.objects(_SubjectType.default.schema.name), sub => {
|
|
622
|
+
sub.allowProfilePicture = false;
|
|
623
|
+
});
|
|
624
|
+
}
|
|
615
625
|
}
|
|
616
626
|
};
|
|
617
627
|
exports.default = _default;
|
package/dist/SubjectType.js
CHANGED
|
@@ -29,6 +29,8 @@ class SubjectType extends _ReferenceEntity.default {
|
|
|
29
29
|
|
|
30
30
|
_defineProperty(this, "allowEmptyLocation", void 0);
|
|
31
31
|
|
|
32
|
+
_defineProperty(this, "allowProfilePicture", void 0);
|
|
33
|
+
|
|
32
34
|
_defineProperty(this, "uniqueName", void 0);
|
|
33
35
|
|
|
34
36
|
_defineProperty(this, "validFirstNameFormat", void 0);
|
|
@@ -58,11 +60,13 @@ class SubjectType extends _ReferenceEntity.default {
|
|
|
58
60
|
subjectType.type = operationalSubjectType.type;
|
|
59
61
|
subjectType.subjectSummaryRule = operationalSubjectType.subjectSummaryRule;
|
|
60
62
|
subjectType.uniqueName = operationalSubjectType.uniqueName;
|
|
63
|
+
subjectType.allowProfilePicture = operationalSubjectType.allowProfilePicture;
|
|
61
64
|
subjectType.validFirstNameFormat = _Format.default.fromResource(operationalSubjectType["validFirstNameFormat"]);
|
|
62
65
|
subjectType.validLastNameFormat = _Format.default.fromResource(operationalSubjectType["validLastNameFormat"]);
|
|
63
66
|
subjectType.iconFileS3Key = operationalSubjectType.iconFileS3Key;
|
|
64
67
|
subjectType.syncRegistrationConcept1 = _ResourceUtil.default.getUUIDFor(operationalSubjectType, 'syncRegistrationConcept1');
|
|
65
68
|
subjectType.syncRegistrationConcept2 = _ResourceUtil.default.getUUIDFor(operationalSubjectType, 'syncRegistrationConcept2');
|
|
69
|
+
subjectType.nameHelpText = _ResourceUtil.default.getUUIDFor(operationalSubjectType, 'nameHelpText');
|
|
66
70
|
return subjectType;
|
|
67
71
|
}
|
|
68
72
|
|
|
@@ -77,12 +81,14 @@ class SubjectType extends _ReferenceEntity.default {
|
|
|
77
81
|
cloned.type = this.type;
|
|
78
82
|
cloned.subjectSummaryRule = this.subjectSummaryRule;
|
|
79
83
|
cloned.allowEmptyLocation = this.allowEmptyLocation;
|
|
84
|
+
cloned.allowProfilePicture = this.allowProfilePicture;
|
|
80
85
|
cloned.uniqueName = this.uniqueName;
|
|
81
86
|
cloned.validFirstNameFormat = this.validFirstNameFormat;
|
|
82
87
|
cloned.validLastNameFormat = this.validLastNameFormat;
|
|
83
88
|
cloned.iconFileS3Key = this.iconFileS3Key;
|
|
84
89
|
cloned.syncRegistrationConcept1 = this.syncRegistrationConcept1;
|
|
85
90
|
cloned.syncRegistrationConcept2 = this.syncRegistrationConcept2;
|
|
91
|
+
cloned.nameHelpText = this.nameHelpText;
|
|
86
92
|
return cloned;
|
|
87
93
|
}
|
|
88
94
|
|
|
@@ -162,6 +168,14 @@ _defineProperty(SubjectType, "schema", {
|
|
|
162
168
|
syncRegistrationConcept2: {
|
|
163
169
|
type: "string",
|
|
164
170
|
optional: true
|
|
171
|
+
},
|
|
172
|
+
allowProfilePicture: {
|
|
173
|
+
type: 'bool',
|
|
174
|
+
default: false
|
|
175
|
+
},
|
|
176
|
+
nameHelpText: {
|
|
177
|
+
type: "string",
|
|
178
|
+
optional: true
|
|
165
179
|
}
|
|
166
180
|
}
|
|
167
181
|
});
|
|
@@ -20,6 +20,7 @@ class DraftSubject {
|
|
|
20
20
|
draftSubject.subjectType = subject.subjectType;
|
|
21
21
|
draftSubject.firstName = subject.firstName;
|
|
22
22
|
draftSubject.lastName = subject.lastName;
|
|
23
|
+
draftSubject.profilePicture = subject.profilePicture;
|
|
23
24
|
draftSubject.dateOfBirth = subject.dateOfBirth;
|
|
24
25
|
draftSubject.registrationDate = subject.registrationDate;
|
|
25
26
|
draftSubject.dateOfBirthVerified = subject.dateOfBirthVerified;
|
|
@@ -38,6 +39,7 @@ class DraftSubject {
|
|
|
38
39
|
individual.subjectType = this.subjectType.clone();
|
|
39
40
|
individual.firstName = this.firstName;
|
|
40
41
|
individual.lastName = this.lastName;
|
|
42
|
+
individual.profilePicture = this.profilePicture;
|
|
41
43
|
individual.dateOfBirth = this.dateOfBirth;
|
|
42
44
|
individual.registrationDate = this.registrationDate;
|
|
43
45
|
individual.dateOfBirthVerified = this.dateOfBirthVerified;
|
|
@@ -66,6 +68,10 @@ _defineProperty(DraftSubject, "schema", {
|
|
|
66
68
|
type: "string",
|
|
67
69
|
optional: true
|
|
68
70
|
},
|
|
71
|
+
profilePicture: {
|
|
72
|
+
type: "string",
|
|
73
|
+
optional: true
|
|
74
|
+
},
|
|
69
75
|
dateOfBirth: {
|
|
70
76
|
type: "date",
|
|
71
77
|
optional: true
|