@simtlix/simfinity-js 2.3.1 → 2.3.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/package.json +1 -1
- package/src/index.js +8 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -659,10 +659,6 @@ const onUpdateSubject = async (Model, gqltype, controller, args, session, linkTo
|
|
|
659
659
|
const materializedModel = await materializeModel(args, gqltype, linkToParent, 'UPDATE', session);
|
|
660
660
|
const objectId = args.id;
|
|
661
661
|
|
|
662
|
-
if (materializedModel.collectionFields) {
|
|
663
|
-
await iterateonCollectionFields(materializedModel, gqltype, objectId, session, context);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
662
|
const currentObject = await Model.findById({ _id: objectId }).lean();
|
|
667
663
|
|
|
668
664
|
const argTypes = gqltype.getFields();
|
|
@@ -695,6 +691,10 @@ const onUpdateSubject = async (Model, gqltype, controller, args, session, linkTo
|
|
|
695
691
|
objectId, materializedModel.modelArgs, { new: true },
|
|
696
692
|
).session(session);
|
|
697
693
|
|
|
694
|
+
if (materializedModel.collectionFields) {
|
|
695
|
+
await iterateonCollectionFields(materializedModel, gqltype, objectId, session, context);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
698
|
if (controller && controller.onUpdated) {
|
|
699
699
|
await controller.onUpdated(result, session, context);
|
|
700
700
|
}
|
|
@@ -735,12 +735,14 @@ const onSaveObject = async (Model, gqltype, controller, args, session, linkToPar
|
|
|
735
735
|
await controller.onSaving(newObject, args, session, context);
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
+
let result = await newObject.save();
|
|
739
|
+
result = result.toObject();
|
|
740
|
+
|
|
738
741
|
if (materializedModel.collectionFields) {
|
|
739
742
|
await iterateonCollectionFields(materializedModel, gqltype, newObject._id, session, context);
|
|
740
743
|
}
|
|
741
744
|
|
|
742
|
-
|
|
743
|
-
result = result.toObject();
|
|
745
|
+
|
|
744
746
|
if (controller && controller.onSaved) {
|
|
745
747
|
await controller.onSaved(result, args, session, context);
|
|
746
748
|
}
|