openchs-models 1.32.55 → 1.32.57

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 CHANGED
@@ -85,11 +85,11 @@ class Concept extends _BaseEntity.default {
85
85
  }
86
86
 
87
87
  getImageMedia() {
88
- return this.media ? this.media.filter(m => m.isImage()) : [];
88
+ return this.media.filter(m => m.isImage());
89
89
  }
90
90
 
91
91
  getVideoMedia() {
92
- return this.media ? this.media.filter(m => m.isVideo()) : [];
92
+ return this.media.filter(m => m.isVideo());
93
93
  }
94
94
 
95
95
  hasImage() {
@@ -377,7 +377,7 @@ class Concept extends _BaseEntity.default {
377
377
  }
378
378
 
379
379
  hasMedia() {
380
- return this.media && this.media.length > 0 || this.hasAnswersWithMedia();
380
+ return this.media.length > 0 || this.hasAnswersWithMedia();
381
381
  }
382
382
 
383
383
  }
@@ -430,7 +430,8 @@ _defineProperty(Concept, "schema", {
430
430
  },
431
431
  media: {
432
432
  type: "list",
433
- objectType: "ConceptMedia"
433
+ objectType: "ConceptMedia",
434
+ default: []
434
435
  }
435
436
  }
436
437
  });
@@ -56,6 +56,7 @@ exports.default = ConceptMedia;
56
56
 
57
57
  _defineProperty(ConceptMedia, "schema", {
58
58
  name: "ConceptMedia",
59
+ embedded: true,
59
60
  primaryKey: "uuid",
60
61
  properties: {
61
62
  uuid: "string",
package/dist/Schema.js CHANGED
@@ -998,13 +998,6 @@ function createRealmConfig() {
998
998
  }
999
999
 
1000
1000
  if (oldDB.schemaVersion < 204) {
1001
- _lodash.default.forEach(newDB.objects(_Concept.default.schema.name), concept => {
1002
- if (!concept.media) {
1003
- concept.media = [];
1004
- }
1005
- }); // Reset EntitySyncStatus for Concept to refetch media URLs
1006
-
1007
-
1008
1001
  _lodash.default.forEach(newDB.objects(_EntitySyncStatus.default.schema.name), ess => {
1009
1002
  if (ess.entityName === 'Concept') {
1010
1003
  ess.loadedSince = _EntitySyncStatus.default.REALLY_OLD_DATE;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.32.55",
4
+ "version": "1.32.57",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",