xcally-nest-library 0.0.8 → 0.0.10

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.8",
3
+ "version": "0.0.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,8 +24,8 @@
24
24
  "test:cov": "jest --coverage",
25
25
  "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
26
26
  "test:e2e": "jest --config ./test/jest-e2e.json",
27
- "link:lib": "pnpm link --global",
28
- "unlink:lib": "pnpm unlink xcally-nest-libs"
27
+ "lib:link": "pnpm link --global",
28
+ "lib:unlink": "pnpm unlink xcally-nest-libs"
29
29
  },
30
30
  "dependencies": {
31
31
  "@nestjs/axios": "^3.0.2",
@@ -6,6 +6,7 @@ enum EnvironmentType {
6
6
  Prod = 'production',
7
7
  Test = 'test',
8
8
  Staging = 'staging',
9
+ E2E = 'e2e',
9
10
  }
10
11
 
11
12
  class EnvironmentVariables {
@@ -50,7 +50,7 @@ export class GenericRepository<E extends ObjectLiteral> {
50
50
  async update<T extends DeepPartial<E> & IId>(dto: T): Promise<E> {
51
51
  const entityUpdated = await this.repository.update(dto.id, dto as any);
52
52
  if (!entityUpdated.affected) {
53
- throw new Error('Entity not found');
53
+ return undefined;
54
54
  }
55
55
  return this.repository.findOneBy({ id: Equal(dto.id) } as unknown as FindOptionsWhere<E>);
56
56
  }
@@ -88,15 +88,10 @@ export class GenericRepository<E extends ObjectLiteral> {
88
88
  *
89
89
  * @param id - The ID of the entity to retrieve.
90
90
  * @returns A promise that resolves to the retrieved entity.
91
- * @throws Error if the entity is not found.
92
91
  */
93
92
  async findById(id: number): Promise<E> {
94
- const entity = await this.repository.findOneBy({
93
+ return await this.repository.findOneBy({
95
94
  id: Equal(id),
96
95
  } as unknown as FindOptionsWhere<E>);
97
- if (!entity) {
98
- throw new Error('Entity not found');
99
- }
100
- return entity;
101
96
  }
102
97
  }