openchs-models 1.32.39 → 1.32.41
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/Concept.js +53 -2
- package/dist/Schema.js +7 -0
- package/dist/application/Form.js +0 -17
- package/package.json +1 -1
package/dist/Concept.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.MediaType = exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
9
|
|
|
@@ -84,6 +84,22 @@ class Concept extends _BaseEntity.default {
|
|
|
84
84
|
this.that.unit = x;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
get mediaUrl() {
|
|
88
|
+
return this.that.mediaUrl;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
set mediaUrl(x) {
|
|
92
|
+
this.that.mediaUrl = x;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get mediaType() {
|
|
96
|
+
return this.that.mediaType;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
set mediaType(x) {
|
|
100
|
+
this.that.mediaType = x;
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
get name() {
|
|
88
104
|
return this.that.name;
|
|
89
105
|
}
|
|
@@ -129,6 +145,8 @@ class Concept extends _BaseEntity.default {
|
|
|
129
145
|
concept.voided = conceptResource.voided || false; //This change should be independently deployable irrespective of server
|
|
130
146
|
|
|
131
147
|
concept.keyValues = _lodash.default.map(conceptResource.keyValues, _KeyValue.default.fromResource);
|
|
148
|
+
concept.mediaUrl = conceptResource.mediaUrl;
|
|
149
|
+
concept.mediaType = conceptResource.mediaType;
|
|
132
150
|
return concept;
|
|
133
151
|
}
|
|
134
152
|
|
|
@@ -333,6 +351,26 @@ class Concept extends _BaseEntity.default {
|
|
|
333
351
|
return keyValue === _KeyValue.default.ContactYesValue;
|
|
334
352
|
}
|
|
335
353
|
|
|
354
|
+
isMediaTypeImage() {
|
|
355
|
+
return this.mediaType === MediaType.Image;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
hasMediaType() {
|
|
359
|
+
return !_lodash.default.isNil(this.mediaType);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
hasMediaUrl() {
|
|
363
|
+
return !_lodash.default.isNil(this.mediaUrl) && this.mediaUrl !== '';
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
hasAnswersWithMedia() {
|
|
367
|
+
return _lodash.default.some(this.answers, answer => answer.concept.hasMediaUrl() || answer.concept.hasMediaType());
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
hasMedia() {
|
|
371
|
+
return this.hasMediaUrl() || this.hasMediaType() || this.hasAnswersWithMedia();
|
|
372
|
+
}
|
|
373
|
+
|
|
336
374
|
}
|
|
337
375
|
|
|
338
376
|
exports.default = Concept;
|
|
@@ -380,6 +418,14 @@ _defineProperty(Concept, "schema", {
|
|
|
380
418
|
voided: {
|
|
381
419
|
type: "bool",
|
|
382
420
|
default: false
|
|
421
|
+
},
|
|
422
|
+
mediaUrl: {
|
|
423
|
+
type: "string",
|
|
424
|
+
optional: true
|
|
425
|
+
},
|
|
426
|
+
mediaType: {
|
|
427
|
+
type: "string",
|
|
428
|
+
optional: true
|
|
383
429
|
}
|
|
384
430
|
}
|
|
385
431
|
});
|
|
@@ -428,4 +474,9 @@ _defineProperty(Concept, "dataType", {
|
|
|
428
474
|
|
|
429
475
|
});
|
|
430
476
|
|
|
431
|
-
_defineProperty(Concept, "merge", () => _BaseEntity.default.mergeOn("answers"));
|
|
477
|
+
_defineProperty(Concept, "merge", () => _BaseEntity.default.mergeOn("answers"));
|
|
478
|
+
|
|
479
|
+
const MediaType = {
|
|
480
|
+
Image: "Image"
|
|
481
|
+
};
|
|
482
|
+
exports.MediaType = MediaType;
|
package/dist/Schema.js
CHANGED
|
@@ -971,6 +971,13 @@ function createRealmConfig() {
|
|
|
971
971
|
program.showGrowthChart = _lodash.default.toLower(program.name) === "child";
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
|
+
|
|
975
|
+
if (oldDB.schemaVersion < 200) {
|
|
976
|
+
_lodash.default.forEach(newDB.objects("Concept"), concept => {
|
|
977
|
+
concept.mediaType = null;
|
|
978
|
+
concept.mediaUrl = null;
|
|
979
|
+
});
|
|
980
|
+
}
|
|
974
981
|
}
|
|
975
982
|
};
|
|
976
983
|
}
|
package/dist/application/Form.js
CHANGED
|
@@ -120,26 +120,9 @@ class Form extends _BaseEntity.default {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
static fromResource(resource, entityService) {
|
|
123
|
-
const formSyncStatus = entityService.findByCriteria(`entityName = 'Form'`, _EntitySyncStatus.default.schema.name);
|
|
124
|
-
|
|
125
|
-
if (resource.formType === this.formTypes.IndividualProfile && formSyncStatus && (0, _moment.default)(formSyncStatus.loadedSince).isBefore((0, _moment.default)(resource.lastModifiedDateTime))) {
|
|
126
|
-
this.deleteOutOfSyncDrafts(entityService, resource.uuid);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
123
|
return _General.default.assignFields(resource, new Form(), ["uuid", "name", "formType", "decisionRule", "editFormRule", "visitScheduleRule", "taskScheduleRule", "validationRule", "checklistsRule", "taskScheduleRule"]);
|
|
130
124
|
}
|
|
131
125
|
|
|
132
|
-
static deleteOutOfSyncDrafts(entityService, formUUID) {
|
|
133
|
-
const formMappings = entityService.findAllByCriteria(`form.uuid = '${formUUID}'`, _FormMapping.default.schema.name);
|
|
134
|
-
|
|
135
|
-
_lodash.default.forEach(formMappings, ({
|
|
136
|
-
subjectType
|
|
137
|
-
}) => {
|
|
138
|
-
const outOfSyncDrafts = entityService.findAll("DraftSubject").filtered(`subjectType.uuid = $0`, subjectType.uuid);
|
|
139
|
-
entityService.deleteEntities(outOfSyncDrafts);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
126
|
static associateChild(child, childEntityClass, childResource, entityService) {
|
|
144
127
|
let form = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, "formUUID", Form.schema.name);
|
|
145
128
|
|