@punks/backend-entity-manager 0.0.400 → 0.0.402

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/dist/cjs/index.js CHANGED
@@ -4050,6 +4050,19 @@ class TypeOrmRepository {
4050
4050
  this.logger.debug("Finding entities by condition", { condition });
4051
4051
  return await this.innerRepository.find(condition);
4052
4052
  }
4053
+ async findOne(condition) {
4054
+ this.logger.debug("Finding entity by condition", { condition });
4055
+ const items = await this.innerRepository.find(condition);
4056
+ return items[0];
4057
+ }
4058
+ async findOneOrFail(condition) {
4059
+ this.logger.debug("Finding entity by condition", { condition });
4060
+ const items = await this.innerRepository.find(condition);
4061
+ if (items.length === 0) {
4062
+ throw new Error("Entity not found");
4063
+ }
4064
+ return items[0];
4065
+ }
4053
4066
  async findById(id) {
4054
4067
  this.logger.debug("Finding entities by id", { id });
4055
4068
  return await this.innerRepository.findBy({