@cheetah.js/orm 0.1.122 → 0.1.126

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.
@@ -138,9 +138,10 @@ class BaseEntity {
138
138
  serializeWithEntity(entity) {
139
139
  const data = {};
140
140
  const allProperties = new Set(Object.keys(entity.properties));
141
+ const allRelations = new Set((entity.relations || []).map((relation) => relation.propertyKey));
141
142
  const hidePropertiesSet = new Set(entity.hideProperties);
142
143
  for (const key in this) {
143
- if (this.shouldSkipProperty(key, allProperties, hidePropertiesSet)) {
144
+ if (this.shouldSkipProperty(key, allProperties, allRelations, hidePropertiesSet)) {
144
145
  continue;
145
146
  }
146
147
  data[key] = this[key];
@@ -159,11 +160,11 @@ class BaseEntity {
159
160
  }
160
161
  return data;
161
162
  }
162
- shouldSkipProperty(key, allProperties, hideProperties) {
163
+ shouldSkipProperty(key, allProperties, allRelations, hideProperties) {
163
164
  if (this.isInternalProperty(key)) {
164
165
  return true;
165
166
  }
166
- if (!allProperties.has(key)) {
167
+ if (!allProperties.has(key) && !allRelations.has(key)) {
167
168
  return true;
168
169
  }
169
170
  return hideProperties.has(key);
@@ -159,6 +159,7 @@ class Repository {
159
159
  async count(where) {
160
160
  return this.createQueryBuilder()
161
161
  .count()
162
+ .setStrategy('joined')
162
163
  .where(where || {})
163
164
  .executeCount();
164
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cheetah.js/orm",
3
- "version": "0.1.122",
3
+ "version": "0.1.126",
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": "d3f748547f20d75d4102b13139a0554a3db953c8"
58
+ "gitHead": "21e45a0718c8f4c55b7f03d5dad285481a382527"
59
59
  }