gemcap-be-common 1.4.173 → 1.4.175
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/models/ScorecardSubmission.model.d.ts +6 -2
- package/models/ScorecardSubmission.model.js +11 -3
- package/models/ScorecardSubmission.model.ts +19 -4
- package/models/ScorecardVersion.model.d.ts +3 -0
- package/models/ScorecardVersion.model.js +13 -3
- package/models/ScorecardVersion.model.ts +18 -3
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Model } from 'mongoose';
|
|
26
|
+
export declare const RESULT_SOURCES: readonly ["SCORE", "RULE"];
|
|
27
|
+
export type TResultSource = typeof RESULT_SOURCES[number];
|
|
28
|
+
export declare const SUBMISSION_STATUSES: readonly ["draft", "final"];
|
|
29
|
+
export type TSubmissionStatus = typeof SUBMISSION_STATUSES[number];
|
|
26
30
|
export interface IStorecardSubmission {
|
|
27
31
|
borrowerId: mongoose.Types.ObjectId;
|
|
28
32
|
scorecardId: mongoose.Types.ObjectId;
|
|
@@ -30,10 +34,10 @@ export interface IStorecardSubmission {
|
|
|
30
34
|
period: string;
|
|
31
35
|
totalScore?: number;
|
|
32
36
|
sectionScores?: Record<string, number>;
|
|
33
|
-
status:
|
|
37
|
+
status: TSubmissionStatus;
|
|
34
38
|
lockedAt: Date;
|
|
35
39
|
finalResult?: string;
|
|
36
|
-
resultSource?:
|
|
40
|
+
resultSource?: TResultSource;
|
|
37
41
|
resultRuleKey?: string;
|
|
38
42
|
}
|
|
39
43
|
export interface IStorecardSubmissionDoc extends IStorecardSubmission, Document {
|
|
@@ -3,9 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StorecardSubmission = exports.StorecardSubmissionSchema = void 0;
|
|
6
|
+
exports.StorecardSubmission = exports.StorecardSubmissionSchema = exports.SUBMISSION_STATUSES = exports.RESULT_SOURCES = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const _models_1 = require("./_models");
|
|
9
|
+
exports.RESULT_SOURCES = [
|
|
10
|
+
'SCORE',
|
|
11
|
+
'RULE',
|
|
12
|
+
];
|
|
13
|
+
exports.SUBMISSION_STATUSES = [
|
|
14
|
+
'draft',
|
|
15
|
+
'final',
|
|
16
|
+
];
|
|
9
17
|
exports.StorecardSubmissionSchema = new mongoose_1.default.Schema({
|
|
10
18
|
borrowerId: {
|
|
11
19
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -36,7 +44,7 @@ exports.StorecardSubmissionSchema = new mongoose_1.default.Schema({
|
|
|
36
44
|
},
|
|
37
45
|
status: {
|
|
38
46
|
type: String,
|
|
39
|
-
enum:
|
|
47
|
+
enum: exports.SUBMISSION_STATUSES,
|
|
40
48
|
required: true,
|
|
41
49
|
},
|
|
42
50
|
lockedAt: {
|
|
@@ -49,7 +57,7 @@ exports.StorecardSubmissionSchema = new mongoose_1.default.Schema({
|
|
|
49
57
|
},
|
|
50
58
|
resultSource: {
|
|
51
59
|
type: String,
|
|
52
|
-
enum:
|
|
60
|
+
enum: exports.RESULT_SOURCES,
|
|
53
61
|
required: false,
|
|
54
62
|
},
|
|
55
63
|
resultRuleKey: {
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import mongoose, { Model } from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { MODEL_NAMES } from './_models';
|
|
4
|
+
import { RISK_RATINGS } from './ScorecardVersion.model';
|
|
5
|
+
|
|
6
|
+
export const RESULT_SOURCES = [
|
|
7
|
+
'SCORE',
|
|
8
|
+
'RULE',
|
|
9
|
+
] as const;
|
|
10
|
+
|
|
11
|
+
export type TResultSource = typeof RESULT_SOURCES[number];
|
|
12
|
+
|
|
13
|
+
export const SUBMISSION_STATUSES = [
|
|
14
|
+
'draft',
|
|
15
|
+
'final',
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
export type TSubmissionStatus = typeof SUBMISSION_STATUSES[number];
|
|
4
19
|
|
|
5
20
|
export interface IStorecardSubmission {
|
|
6
21
|
borrowerId: mongoose.Types.ObjectId;
|
|
@@ -9,10 +24,10 @@ export interface IStorecardSubmission {
|
|
|
9
24
|
period: string;
|
|
10
25
|
totalScore?: number;
|
|
11
26
|
sectionScores?: Record<string, number>;
|
|
12
|
-
status:
|
|
27
|
+
status: TSubmissionStatus;
|
|
13
28
|
lockedAt: Date;
|
|
14
29
|
finalResult?: string;
|
|
15
|
-
resultSource?:
|
|
30
|
+
resultSource?: TResultSource;
|
|
16
31
|
resultRuleKey?: string;
|
|
17
32
|
}
|
|
18
33
|
|
|
@@ -68,7 +83,7 @@ export const StorecardSubmissionSchema = new mongoose.Schema<IStorecardSubmissio
|
|
|
68
83
|
},
|
|
69
84
|
status: {
|
|
70
85
|
type: String,
|
|
71
|
-
enum:
|
|
86
|
+
enum: SUBMISSION_STATUSES,
|
|
72
87
|
required: true,
|
|
73
88
|
},
|
|
74
89
|
lockedAt: {
|
|
@@ -81,7 +96,7 @@ export const StorecardSubmissionSchema = new mongoose.Schema<IStorecardSubmissio
|
|
|
81
96
|
},
|
|
82
97
|
resultSource: {
|
|
83
98
|
type: String,
|
|
84
|
-
enum:
|
|
99
|
+
enum: RESULT_SOURCES,
|
|
85
100
|
required: false,
|
|
86
101
|
},
|
|
87
102
|
resultRuleKey: {
|
|
@@ -70,17 +70,27 @@ const criterionSchema = joi_1.default.object({
|
|
|
70
70
|
}),
|
|
71
71
|
min: joi_1.default.when('type', {
|
|
72
72
|
is: joi_1.default.valid('number', 'range', 'rating'),
|
|
73
|
-
then: joi_1.default.number().
|
|
73
|
+
then: joi_1.default.number().optional(),
|
|
74
74
|
otherwise: joi_1.default.forbidden(),
|
|
75
75
|
}),
|
|
76
76
|
max: joi_1.default.when('type', {
|
|
77
77
|
is: joi_1.default.valid('number', 'range', 'rating'),
|
|
78
|
-
then: joi_1.default.number().
|
|
78
|
+
then: joi_1.default.number().optional(),
|
|
79
79
|
otherwise: joi_1.default.forbidden(),
|
|
80
80
|
}),
|
|
81
81
|
step: joi_1.default.when('type', {
|
|
82
82
|
is: joi_1.default.valid('number', 'range', 'rating'),
|
|
83
|
-
then: joi_1.default.number().
|
|
83
|
+
then: joi_1.default.number().optional(),
|
|
84
|
+
otherwise: joi_1.default.forbidden(),
|
|
85
|
+
}),
|
|
86
|
+
prefix: joi_1.default.when('type', {
|
|
87
|
+
is: joi_1.default.valid('number', 'range', 'rating'),
|
|
88
|
+
then: joi_1.default.string().optional(),
|
|
89
|
+
otherwise: joi_1.default.forbidden(),
|
|
90
|
+
}),
|
|
91
|
+
suffix: joi_1.default.when('type', {
|
|
92
|
+
is: joi_1.default.valid('number', 'range', 'rating'),
|
|
93
|
+
then: joi_1.default.string().optional(),
|
|
84
94
|
otherwise: joi_1.default.forbidden(),
|
|
85
95
|
}),
|
|
86
96
|
rules: joi_1.default.array()
|
|
@@ -44,6 +44,9 @@ export interface IScorecardDefinition {
|
|
|
44
44
|
options?: { value: string; label: string }[];
|
|
45
45
|
min?: number;
|
|
46
46
|
max?: number;
|
|
47
|
+
step?: number;
|
|
48
|
+
prefix?: string;
|
|
49
|
+
suffix?: string;
|
|
47
50
|
rules: IScoringRule[];
|
|
48
51
|
}[];
|
|
49
52
|
}[];
|
|
@@ -158,19 +161,31 @@ const criterionSchema = Joi.object({
|
|
|
158
161
|
|
|
159
162
|
min: Joi.when('type', {
|
|
160
163
|
is: Joi.valid('number', 'range', 'rating'),
|
|
161
|
-
then: Joi.number().
|
|
164
|
+
then: Joi.number().optional(),
|
|
162
165
|
otherwise: Joi.forbidden(),
|
|
163
166
|
}),
|
|
164
167
|
|
|
165
168
|
max: Joi.when('type', {
|
|
166
169
|
is: Joi.valid('number', 'range', 'rating'),
|
|
167
|
-
then: Joi.number().
|
|
170
|
+
then: Joi.number().optional(),
|
|
168
171
|
otherwise: Joi.forbidden(),
|
|
169
172
|
}),
|
|
170
173
|
|
|
171
174
|
step: Joi.when('type', {
|
|
172
175
|
is: Joi.valid('number', 'range', 'rating'),
|
|
173
|
-
then: Joi.number().
|
|
176
|
+
then: Joi.number().optional(),
|
|
177
|
+
otherwise: Joi.forbidden(),
|
|
178
|
+
}),
|
|
179
|
+
|
|
180
|
+
prefix: Joi.when('type', {
|
|
181
|
+
is: Joi.valid('number', 'range', 'rating'),
|
|
182
|
+
then: Joi.string().optional(),
|
|
183
|
+
otherwise: Joi.forbidden(),
|
|
184
|
+
}),
|
|
185
|
+
|
|
186
|
+
suffix: Joi.when('type', {
|
|
187
|
+
is: Joi.valid('number', 'range', 'rating'),
|
|
188
|
+
then: Joi.string().optional(),
|
|
174
189
|
otherwise: Joi.forbidden(),
|
|
175
190
|
}),
|
|
176
191
|
|