@cheetah.js/orm 0.1.75 → 0.1.76
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.
|
@@ -76,11 +76,17 @@ class ModelTransformer {
|
|
|
76
76
|
entity[key] = value;
|
|
77
77
|
}
|
|
78
78
|
findPropertyByColumnName(columnName, options) {
|
|
79
|
+
// First, try to find in regular properties
|
|
79
80
|
const entry = Object.entries(options.properties).find(([_, prop]) => prop.options.columnName === columnName);
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
81
|
+
if (entry) {
|
|
82
|
+
return { key: entry[0], property: entry[1] };
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
// If not found, try to find in relations (many-to-one)
|
|
85
|
+
const relation = options.relations?.find((rel) => rel.columnName === columnName && rel.relation === 'many-to-one');
|
|
86
|
+
if (relation) {
|
|
87
|
+
return { key: relation.propertyKey, property: relation };
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
84
90
|
}
|
|
85
91
|
isValueObjectType(type) {
|
|
86
92
|
return (0, utils_1.extendsFrom)(value_object_1.ValueObject, type?.prototype);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cheetah.js/orm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.76",
|
|
4
4
|
"description": "A simple ORM for Cheetah.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"bun",
|
|
56
56
|
"value-object"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "253d62e2b6a0d63016b730b3d72bb982c6e64825"
|
|
59
59
|
}
|