openchs-models 1.29.1 → 1.29.2
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/Schema.js +29 -1
- package/package.json +1 -1
package/dist/Schema.js
CHANGED
|
@@ -183,6 +183,8 @@ var _MenuItem = _interopRequireDefault(require("./application/MenuItem"));
|
|
|
183
183
|
|
|
184
184
|
var _UserSubjectAssignment = _interopRequireDefault(require("./assignment/UserSubjectAssignment"));
|
|
185
185
|
|
|
186
|
+
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
187
|
+
|
|
186
188
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
187
189
|
|
|
188
190
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -194,8 +196,10 @@ const entities = [_LocaleMapping.default, _Settings.default, _ConceptAnswer.defa
|
|
|
194
196
|
function createRealmConfig() {
|
|
195
197
|
return {
|
|
196
198
|
//order is important, should be arranged according to the dependency
|
|
197
|
-
schemaVersion:
|
|
199
|
+
schemaVersion: 173,
|
|
198
200
|
migration: function (oldDB, newDB) {
|
|
201
|
+
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
202
|
+
|
|
199
203
|
if (oldDB.schemaVersion < 10) {
|
|
200
204
|
const oldObjects = oldDB.objects("DecisionConfig");
|
|
201
205
|
oldObjects.forEach(decisionConfig => {
|
|
@@ -692,7 +696,31 @@ function createRealmConfig() {
|
|
|
692
696
|
}
|
|
693
697
|
}
|
|
694
698
|
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
if (oldDB.schemaVersion < 173) {
|
|
702
|
+
const entityApprovalStatuses = newDB.objects(_EntityApprovalStatus.default.schema.name);
|
|
703
|
+
entityApprovalStatuses.forEach(entityApprovalStatus => {
|
|
704
|
+
let schemaName;
|
|
705
|
+
|
|
706
|
+
switch (entityApprovalStatus.entityType) {
|
|
707
|
+
case _EntityApprovalStatus.default.entityType.Subject:
|
|
708
|
+
schemaName = _SchemaNames.default.Individual;
|
|
709
|
+
break;
|
|
695
710
|
|
|
711
|
+
default:
|
|
712
|
+
schemaName = entityApprovalStatus.entityType;
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const entities = newDB.objects(schemaName).filtered("uuid = $0", entityApprovalStatus.entityUUID);
|
|
717
|
+
|
|
718
|
+
if (entities.length === 1) {
|
|
719
|
+
const entity = entities[0];
|
|
720
|
+
entity.approvalStatuses.push(entityApprovalStatus);
|
|
721
|
+
entity.latestEntityApprovalStatus = _lodash.default.maxBy(entity.approvalStatuses, 'statusDateTime');
|
|
722
|
+
}
|
|
723
|
+
});
|
|
696
724
|
const entityApprovalStatusSyncStatus = newDB.objects(_EntitySyncStatus.default.schema.name).filtered("entityName = $0", "EntityApprovalStatus");
|
|
697
725
|
|
|
698
726
|
if (entityApprovalStatusSyncStatus[0]) {
|