@travetto/model 3.3.4 → 3.3.5
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
CHANGED
package/src/registry/model.ts
CHANGED
|
@@ -75,16 +75,13 @@ class $ModelRegistry extends MetadataRegistry<ModelOptions<ModelType>> {
|
|
|
75
75
|
if (schema.subTypeField in view && this.getBaseModel(cls) !== cls) {
|
|
76
76
|
config.subType = !!schema.subTypeName; // Copy from schema
|
|
77
77
|
delete view[schema.subTypeField].required; // Allow type to be optional
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
from = parent;
|
|
86
|
-
parent = this.getParentClass(from);
|
|
87
|
-
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const parent = this.getParentClass(cls);
|
|
81
|
+
if (parent && parent !== cls) {
|
|
82
|
+
const pCfg = this.get(parent) ?? this.pending.get(MetadataRegistry.id(parent));
|
|
83
|
+
config.prePersist = [...pCfg.prePersist ?? [], ...config.prePersist ?? []];
|
|
84
|
+
config.postLoad = [...pCfg.postLoad ?? [], ...config.postLoad ?? []];
|
|
88
85
|
}
|
|
89
86
|
return config;
|
|
90
87
|
}
|
|
@@ -91,6 +91,7 @@ export abstract class ModelPolymorphismSuite extends BaseModelSuite<ModelCrudSup
|
|
|
91
91
|
const [doc, fire, eng] = await Promise.all(people.map(p => service.create(Worker, p)));
|
|
92
92
|
|
|
93
93
|
assert(doc instanceof Doctor);
|
|
94
|
+
assert(doc.updatedDate !== undefined);
|
|
94
95
|
|
|
95
96
|
await assert.rejects(
|
|
96
97
|
() => service.get(Engineer, doc.id),
|