gemcap-be-common 1.4.173 → 1.4.174

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.
@@ -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: 'draft' | 'final';
37
+ status: TSubmissionStatus;
34
38
  lockedAt: Date;
35
39
  finalResult?: string;
36
- resultSource?: 'SCORE' | 'RULE';
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: ['draft', 'final'],
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: ['SCORE', 'DECISION_RULE'],
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: 'draft' | 'final';
27
+ status: TSubmissionStatus;
13
28
  lockedAt: Date;
14
29
  finalResult?: string;
15
- resultSource?: 'SCORE' | 'RULE';
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: ['draft', 'final'],
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: ['SCORE', 'DECISION_RULE'],
99
+ enum: RESULT_SOURCES,
85
100
  required: false,
86
101
  },
87
102
  resultRuleKey: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.173",
3
+ "version": "1.4.174",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {