@dirayaah/assessment-module 1.0.4 → 1.0.5
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/dist/src/repositories/base.repository.d.ts +1 -1
- package/dist/src/repositories/base.repository.js +1 -1
- package/dist/src/repositories/base.repository.js.map +1 -1
- package/dist/src/services/predefined-assessment.service.d.ts +3 -3
- package/dist/src/services/predefined-assessment.service.js +4 -1
- package/dist/src/services/predefined-assessment.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -12
- package/src/repositories/base.repository.ts +9 -4
- package/src/services/predefined-assessment.service.ts +4 -2
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.5",
|
|
7
7
|
"description": "A reusable module for handling assessments in nestjs applications",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"type": "commonjs",
|
|
@@ -32,22 +32,24 @@
|
|
|
32
32
|
"author": "MD-LABS",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nestjs/common": "
|
|
36
|
-
"@nestjs/core": "
|
|
37
|
-
"@nestjs/platform-express": "
|
|
38
|
-
"@nestjs/swagger": "4.
|
|
39
|
-
"@nestjs/typeorm": "
|
|
35
|
+
"@nestjs/common": "^10.4.20",
|
|
36
|
+
"@nestjs/core": "^10.4.20",
|
|
37
|
+
"@nestjs/platform-express": "^10.4.20",
|
|
38
|
+
"@nestjs/swagger": "^7.4.2",
|
|
39
|
+
"@nestjs/typeorm": "^10.0.2",
|
|
40
|
+
"class-transformer": "^0.5.1",
|
|
41
|
+
"class-validator": "^0.14.3",
|
|
40
42
|
"dayjs": "1.11.13",
|
|
41
43
|
"dayjs-plugin-utc": "0.1.2",
|
|
42
|
-
"typeorm": "0.
|
|
44
|
+
"typeorm": "^0.3.28"
|
|
43
45
|
},
|
|
44
46
|
"devDependencies": {
|
|
45
|
-
"@nestjs/testing": "^
|
|
47
|
+
"@nestjs/testing": "^10.4.16",
|
|
46
48
|
"@types/express": "^4.17.21",
|
|
47
|
-
"@types/jest": "
|
|
49
|
+
"@types/jest": "29.5.11",
|
|
48
50
|
"@types/node": "^20.14.0",
|
|
49
|
-
"jest": "
|
|
50
|
-
"ts-jest": "
|
|
51
|
-
"typescript": "
|
|
51
|
+
"jest": "29.7.0",
|
|
52
|
+
"ts-jest": "29.1.1",
|
|
53
|
+
"typescript": "5.3.3"
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
FindManyOptions,
|
|
3
|
+
FindOneOptions,
|
|
4
|
+
Repository,
|
|
5
|
+
Equal,
|
|
6
|
+
FindOptionsWhere,
|
|
7
|
+
} from 'typeorm/index.js';
|
|
3
8
|
import { BaseEntity } from '../entities/base.entity';
|
|
4
9
|
import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity';
|
|
5
10
|
import { DeepPartial } from 'typeorm/browser';
|
|
@@ -7,8 +12,8 @@ import { DeepPartial } from 'typeorm/browser';
|
|
|
7
12
|
export abstract class BaseRepository<
|
|
8
13
|
T extends BaseEntity,
|
|
9
14
|
> extends Repository<T> {
|
|
10
|
-
async findById(id: string): Promise<T |
|
|
11
|
-
return this.findOne({ where: { id
|
|
15
|
+
async findById(id: string): Promise<T | null> {
|
|
16
|
+
return this.findOne({ where: { id: Equal(id) } as FindOptionsWhere<T> });
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
async findWithOptions(options: FindManyOptions<T>): Promise<[T[], number]> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Inject, Injectable, NotFoundException } from '@nestjs/common';
|
|
2
2
|
import { ASSESSMENTS_OPTIONS } from '../constants/assessments-options';
|
|
3
3
|
import { AssessmentModuleOptions } from '../interfaces/assessments-options.interface';
|
|
4
|
-
import { FindManyOptions, Repository } from 'typeorm
|
|
4
|
+
import { Equal, FindManyOptions, Repository } from 'typeorm';
|
|
5
5
|
import { PageRequest } from '../entities/pagination';
|
|
6
6
|
import { PredefinedAssessmentEntity } from '../entities/predefined-assessment.entity';
|
|
7
7
|
import { PredefinedAssessmentDto } from '../dto/predefined-assessment.dto';
|
|
@@ -103,7 +103,9 @@ export class PredefinedAssessmentService {
|
|
|
103
103
|
|
|
104
104
|
async update(updateAssessmentDto: PredefinedAssessmentDto, tenantId: string) {
|
|
105
105
|
const repository = await this.getRepository(tenantId);
|
|
106
|
-
const existingAssessment = await repository.
|
|
106
|
+
const existingAssessment = await repository.findOneBy({
|
|
107
|
+
id: Equal(updateAssessmentDto.id),
|
|
108
|
+
});
|
|
107
109
|
if (!existingAssessment) {
|
|
108
110
|
throw new NotFoundException('ASSESSMENT_DOES_NOT_EXIST');
|
|
109
111
|
}
|