gemcap-be-common 1.4.121 → 1.4.123

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.
@@ -51,6 +51,7 @@ export declare const AccountSchema: {
51
51
  accountId1: {
52
52
  type: typeof Schema.Types.Mixed;
53
53
  required: false;
54
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
54
55
  validate: {
55
56
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
56
57
  message: (props: any) => string;
@@ -59,6 +60,7 @@ export declare const AccountSchema: {
59
60
  accountId2: {
60
61
  type: typeof Schema.Types.Mixed;
61
62
  required: false;
63
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
62
64
  validate: {
63
65
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
64
66
  message: (props: any) => string;
@@ -68,6 +70,7 @@ export declare const AccountSchema: {
68
70
  accountId1: {
69
71
  type: typeof Schema.Types.Mixed;
70
72
  required: false;
73
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
71
74
  validate: {
72
75
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
73
76
  message: (props: any) => string;
@@ -76,6 +79,7 @@ export declare const AccountSchema: {
76
79
  accountId2: {
77
80
  type: typeof Schema.Types.Mixed;
78
81
  required: false;
82
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
79
83
  validate: {
80
84
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
81
85
  message: (props: any) => string;
@@ -85,6 +89,7 @@ export declare const AccountSchema: {
85
89
  accountId1: {
86
90
  type: typeof Schema.Types.Mixed;
87
91
  required: false;
92
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
88
93
  validate: {
89
94
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
90
95
  message: (props: any) => string;
@@ -93,6 +98,7 @@ export declare const AccountSchema: {
93
98
  accountId2: {
94
99
  type: typeof Schema.Types.Mixed;
95
100
  required: false;
101
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
96
102
  validate: {
97
103
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
98
104
  message: (props: any) => string;
@@ -26,12 +26,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.CashAllocationProduct = exports.CashAllocationProductSchema = exports.AccountSchema = void 0;
27
27
  const mongoose_1 = __importStar(require("mongoose"));
28
28
  const _models_1 = require("./_models");
29
+ const normalizeAccountValue = (value) => {
30
+ if (value === null || value === undefined || value === '') {
31
+ return null;
32
+ }
33
+ if (value === 'BANK') {
34
+ return 'BANK';
35
+ }
36
+ if (typeof value === 'string' && mongoose_1.default.isValidObjectId(value)) {
37
+ return new mongoose_1.default.Types.ObjectId(value);
38
+ }
39
+ if (value instanceof mongoose_1.default.Types.ObjectId) {
40
+ return value;
41
+ }
42
+ return null;
43
+ };
29
44
  exports.AccountSchema = {
30
45
  type: Map,
31
46
  of: new mongoose_1.Schema({
32
47
  accountId1: {
33
48
  type: mongoose_1.Schema.Types.Mixed,
34
49
  required: false,
50
+ set: normalizeAccountValue,
35
51
  validate: {
36
52
  validator: function (value) {
37
53
  return (value === null ||
@@ -44,6 +60,7 @@ exports.AccountSchema = {
44
60
  accountId2: {
45
61
  type: mongoose_1.Schema.Types.Mixed,
46
62
  required: false,
63
+ set: normalizeAccountValue,
47
64
  validate: {
48
65
  validator: function (value) {
49
66
  return (value === null ||
@@ -62,18 +62,33 @@ export interface IFinancialSpreadingParams {
62
62
  financialSpreadingType: EFinancialSpreadingType;
63
63
  }
64
64
  export interface IFinancialSpreading {
65
- _id?: mongoose.Types.ObjectId;
66
65
  borrowerId: mongoose.Types.ObjectId;
67
66
  year: number;
68
67
  month: number;
69
68
  sheetId: mongoose.Types.ObjectId;
70
69
  amount: number;
71
70
  }
71
+ export interface IFinancialSpreadingDoc extends IFinancialSpreading, Document {
72
+ _id: mongoose.Types.ObjectId;
73
+ createdAt: Date;
74
+ updatedAt: Date;
75
+ }
76
+ export interface IFinancialSpreadingLean extends IFinancialSpreading {
77
+ _id: mongoose.Types.ObjectId;
78
+ createdAt: Date;
79
+ updatedAt: Date;
80
+ }
81
+ export interface IFinancialSpreadingPlain extends Omit<IFinancialSpreading, 'borrowerId' | 'sheetId'> {
82
+ _id: string;
83
+ borrowerId: string;
84
+ sheetId: string;
85
+ createdAt: Date;
86
+ updatedAt: Date;
87
+ }
72
88
  export declare const financialSpreadingViewValidationSchema: Joi.ObjectSchema<IFinancialSpreadingView>;
73
89
  export declare const financialSpreadingParamsValidationSchema: Joi.ObjectSchema<IFinancialSpreadingParams>;
74
- type IFinancialSpreadingModel = Model<IFinancialSpreading, object, object>;
75
- export declare const FinancialSpreadingSchema: mongoose.Schema<IFinancialSpreading, IFinancialSpreadingModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IFinancialSpreading, mongoose.Document<unknown, {}, mongoose.FlatRecord<IFinancialSpreading>> & mongoose.FlatRecord<IFinancialSpreading> & Required<{
90
+ export type IFinancialSpreadingModel = Model<IFinancialSpreading, object, object>;
91
+ export declare const FinancialSpreadingSchema: mongoose.Schema<IFinancialSpreading, IFinancialSpreadingModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IFinancialSpreading, mongoose.Document<unknown, {}, mongoose.FlatRecord<IFinancialSpreading>> & mongoose.FlatRecord<IFinancialSpreading> & {
76
92
  _id: mongoose.Types.ObjectId;
77
- }>>;
93
+ }>;
78
94
  export declare const FinancialSpreading: IFinancialSpreadingModel;
79
- export {};
@@ -46,7 +46,6 @@ export interface IFinancialSpreadingParams {
46
46
  }
47
47
 
48
48
  export interface IFinancialSpreading {
49
- _id?: mongoose.Types.ObjectId;
50
49
  borrowerId: mongoose.Types.ObjectId;
51
50
  year: number;
52
51
  month: number;
@@ -54,6 +53,26 @@ export interface IFinancialSpreading {
54
53
  amount: number;
55
54
  }
56
55
 
56
+ export interface IFinancialSpreadingDoc extends IFinancialSpreading, Document {
57
+ _id: mongoose.Types.ObjectId;
58
+ createdAt: Date;
59
+ updatedAt: Date;
60
+ }
61
+
62
+ export interface IFinancialSpreadingLean extends IFinancialSpreading {
63
+ _id: mongoose.Types.ObjectId;
64
+ createdAt: Date;
65
+ updatedAt: Date;
66
+ }
67
+
68
+ export interface IFinancialSpreadingPlain extends Omit<IFinancialSpreading, 'borrowerId' | 'sheetId'> {
69
+ _id: string;
70
+ borrowerId: string;
71
+ sheetId: string;
72
+ createdAt: Date;
73
+ updatedAt: Date;
74
+ }
75
+
57
76
  export const financialSpreadingViewValidationSchema = Joi.object<IFinancialSpreadingView>({
58
77
  _id: Joi.string().required(),
59
78
  borrowerId: Joi.string().required(),
@@ -75,7 +94,7 @@ export const financialSpreadingParamsValidationSchema = Joi.object<IFinancialSpr
75
94
  financialSpreadingType: Joi.string().valid(...Object.values(EFinancialSpreadingType)),
76
95
  });
77
96
 
78
- type IFinancialSpreadingModel = Model<IFinancialSpreading, object, object>;
97
+ export type IFinancialSpreadingModel = Model<IFinancialSpreading, object, object>;
79
98
 
80
99
  export const FinancialSpreadingSchema = new mongoose.Schema<IFinancialSpreading, IFinancialSpreadingModel>(
81
100
  {
@@ -31,10 +31,10 @@ export declare const allSchemas: {
31
31
  createdAt: NativeDate;
32
32
  updatedAt: NativeDate;
33
33
  } & {
34
- order: number;
34
+ amount: number;
35
35
  bbcSheetId: import("mongoose").Types.ObjectId;
36
+ order: number;
36
37
  apDate: Date;
37
- amount: number;
38
38
  __v?: number;
39
39
  poNumber?: string;
40
40
  customerName?: string;
@@ -45,10 +45,10 @@ export declare const allSchemas: {
45
45
  createdAt: NativeDate;
46
46
  updatedAt: NativeDate;
47
47
  } & {
48
- order: number;
48
+ amount: number;
49
49
  bbcSheetId: import("mongoose").Types.ObjectId;
50
+ order: number;
50
51
  apDate: Date;
51
- amount: number;
52
52
  __v?: number;
53
53
  poNumber?: string;
54
54
  customerName?: string;
@@ -59,10 +59,10 @@ export declare const allSchemas: {
59
59
  createdAt: NativeDate;
60
60
  updatedAt: NativeDate;
61
61
  } & {
62
- order: number;
62
+ amount: number;
63
63
  bbcSheetId: import("mongoose").Types.ObjectId;
64
+ order: number;
64
65
  apDate: Date;
65
- amount: number;
66
66
  __v?: number;
67
67
  poNumber?: string;
68
68
  customerName?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.121",
3
+ "version": "1.4.123",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -84,10 +84,10 @@ export declare class BorrowerService {
84
84
  getBorrowerCodesMap(): Promise<Map<string, string>>;
85
85
  getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
86
86
  [x: string]: {
87
+ LAST_MONTH?: boolean;
88
+ CURRENT_MONTH?: boolean;
87
89
  ENTIRE_LOAN?: boolean;
88
90
  SELECTED_PERIOD?: boolean;
89
- CURRENT_MONTH?: boolean;
90
- LAST_MONTH?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;