@koalarx/nest 3.1.8 → 3.1.9

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.
@@ -289,30 +289,22 @@ class RepositoryBase {
289
289
  return this.createEntity(enrichedEntity);
290
290
  }
291
291
  async findFirst(where) {
292
- return this.context()
293
- .findFirst({
294
- include: this.getInclude(),
292
+ const entity = await this.context().findFirst({
295
293
  where,
296
- })
297
- .then((response) => {
298
- if (response) {
299
- return this.createEntity(response);
300
- }
301
- return null;
302
294
  });
295
+ if (!entity)
296
+ return null;
297
+ const enrichedEntity = await this.enrichEntityWithRelations(entity);
298
+ return this.createEntity(enrichedEntity);
303
299
  }
304
300
  async findUnique(where) {
305
- return this.context()
306
- .findUnique({
307
- include: this.getInclude(),
301
+ const entity = await this.context().findUnique({
308
302
  where,
309
- })
310
- .then((response) => {
311
- if (response) {
312
- return this.createEntity(response);
313
- }
314
- return null;
315
303
  });
304
+ if (!entity)
305
+ return null;
306
+ const enrichedEntity = await this.enrichEntityWithRelations(entity);
307
+ return this.createEntity(enrichedEntity);
316
308
  }
317
309
  async findMany(where, pagination) {
318
310
  return this.context()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "3.1.8",
3
+ "version": "3.1.9",
4
4
  "description": "",
5
5
  "author": "Igor D. Rangel",
6
6
  "license": "MIT",