xcally-nest-library 0.0.9 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xcally-nest-library",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
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 --global"
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 {
@@ -90,12 +90,18 @@ export class GenericRepository<E extends ObjectLiteral> {
90
90
  * @returns A promise that resolves to the retrieved entity.
91
91
  */
92
92
  async findById(id: number): Promise<E> {
93
- const entity = await this.repository.findOneBy({
93
+ return await this.repository.findOneBy({
94
94
  id: Equal(id),
95
95
  } as unknown as FindOptionsWhere<E>);
96
- if (!entity) {
97
- throw undefined;
98
- }
99
- return entity;
96
+ }
97
+
98
+ /**
99
+ * Removes an entity from the database based on its ID.
100
+ *
101
+ * @param id - The ID of the entity to remove.
102
+ * @returns A promise that resolves when the entity is successfully removed.
103
+ */
104
+ async remove(id: number): Promise<void> {
105
+ await this.repository.delete(id);
100
106
  }
101
107
  }