xcally-nest-library 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/.nvmrc +1 -1
- package/dist/src/config/env.validation.d.ts +2 -1
- package/dist/src/config/env.validation.js +1 -0
- package/dist/src/config/env.validation.js.map +1 -1
- package/dist/src/db/typeorm/generic.repository.js +2 -6
- package/dist/src/db/typeorm/generic.repository.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/config/env.validation.ts +1 -0
- package/src/db/typeorm/generic.repository.ts +2 -7
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "xcally-nest-library",
|
3
|
-
"version": "0.0.
|
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
|
28
|
-
"unlink
|
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",
|
@@ -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
|
-
|
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
|
-
|
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
|
}
|