xcally-nest-library 0.0.5 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xcally-nest-library",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,12 +11,13 @@ interface IId {
11
11
  export class GenericRepository<E extends ObjectLiteral> {
12
12
  protected repository: Repository<E>;
13
13
  protected paginateConfig: PaginateConfig<E>;
14
+
14
15
  constructor(
15
- readonly entityManager: EntityManager,
16
+ private readonly entityManager: EntityManager,
16
17
  entity: EntityTarget<E>,
17
18
  paginateConfig: PaginateConfig<E>,
18
19
  ) {
19
- this.repository = entityManager.getRepository(entity);
20
+ this.repository = this.entityManager.getRepository(entity);
20
21
  this.paginateConfig = paginateConfig;
21
22
  }
22
23
  /**
@@ -83,4 +84,10 @@ export class GenericRepository<E extends ObjectLiteral> {
83
84
  countAll(): Promise<number> {
84
85
  return this.repository.count();
85
86
  }
87
+
88
+ findById(id: number): Promise<E> {
89
+ return this.repository.findOneBy({
90
+ id: Equal(id),
91
+ } as unknown as FindOptionsWhere<E>);
92
+ }
86
93
  }