xcally-nest-library 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ interface IId {
4
4
  id: number;
5
5
  }
6
6
  export declare class GenericRepository<E extends ObjectLiteral> {
7
- readonly entityManager: EntityManager;
7
+ private readonly entityManager;
8
8
  protected repository: Repository<E>;
9
9
  protected paginateConfig: PaginateConfig<E>;
10
10
  constructor(entityManager: EntityManager, entity: EntityTarget<E>, paginateConfig: PaginateConfig<E>);
@@ -14,5 +14,6 @@ export declare class GenericRepository<E extends ObjectLiteral> {
14
14
  count(options: FindOptionsWhere<E>): Promise<number>;
15
15
  findAll(): Promise<E[]>;
16
16
  countAll(): Promise<number>;
17
+ findById(id: number): Promise<E>;
17
18
  }
18
19
  export {};
@@ -6,7 +6,7 @@ const nestjs_paginate_1 = require("nestjs-paginate");
6
6
  class GenericRepository {
7
7
  constructor(entityManager, entity, paginateConfig) {
8
8
  this.entityManager = entityManager;
9
- this.repository = entityManager.getRepository(entity);
9
+ this.repository = this.entityManager.getRepository(entity);
10
10
  this.paginateConfig = paginateConfig;
11
11
  }
12
12
  getMany(query) {
@@ -34,6 +34,11 @@ class GenericRepository {
34
34
  countAll() {
35
35
  return this.repository.count();
36
36
  }
37
+ findById(id) {
38
+ return this.repository.findOneBy({
39
+ id: (0, typeorm_1.Equal)(id),
40
+ });
41
+ }
37
42
  }
38
43
  exports.GenericRepository = GenericRepository;
39
44
  //# sourceMappingURL=generic.repository.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generic.repository.js","sourceRoot":"","sources":["../../../../src/db/typeorm/generic.repository.ts"],"names":[],"mappings":";;;AAAA,qCAAuH;AACvH,qDAAqF;AASrF,MAAa,iBAAiB;IAG5B,YACW,aAA4B,EACrC,MAAuB,EACvB,cAAiC;QAFxB,kBAAa,GAAb,aAAa,CAAe;QAIrC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,cAAc,GAA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