gemcap-be-common 1.4.202 → 1.4.205

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.
@@ -29,7 +29,7 @@ export declare enum ELoanTransactionTypes {
29
29
  COLLECTION = "COLLECTION",
30
30
  DISBURSEMENT = "DISBURSEMENT",
31
31
  ADJUSTMENT = "ADJUSTMENT",
32
- FEE = "FEE"
32
+ CHARGE = "CHARGE"
33
33
  }
34
34
  export declare const LOAN_TRANSACTION_DOWNLOAD_FIELDS: string[];
35
35
  export declare const LOAN_TRANSACTION_FIELDS: string[];
@@ -48,6 +48,7 @@ export interface ILoanTransaction {
48
48
  date: Date;
49
49
  effectiveDate: Date;
50
50
  productId: mongoose.Types.ObjectId;
51
+ chargeId?: mongoose.Types.ObjectId;
51
52
  amount: number;
52
53
  description: string;
53
54
  reference: string;
@@ -80,11 +81,12 @@ export interface ILoanTransactionLean extends ILoanTransaction {
80
81
  createdAt: Date;
81
82
  updatedAt: Date;
82
83
  }
83
- export interface ILoanTransactionPlain extends Omit<ILoanTransaction, 'productId' | 'bankId' | 'loanPaymentId'> {
84
+ export interface ILoanTransactionPlain extends Omit<ILoanTransaction, 'productId' | 'bankId' | 'loanPaymentId' | 'chargeId'> {
84
85
  _id: string;
85
86
  productId: string;
86
87
  bankId: string;
87
88
  loanPaymentId: string;
89
+ chargeId: string;
88
90
  }
89
91
  export type TLoanTransactionModel = mongoose.Model<ILoanTransaction>;
90
92
  export interface ILoanTransactionModel extends mongoose.Model<ILoanTransaction> {
@@ -14,7 +14,7 @@ var ELoanTransactionTypes;
14
14
  ELoanTransactionTypes["COLLECTION"] = "COLLECTION";
15
15
  ELoanTransactionTypes["DISBURSEMENT"] = "DISBURSEMENT";
16
16
  ELoanTransactionTypes["ADJUSTMENT"] = "ADJUSTMENT";
17
- ELoanTransactionTypes["FEE"] = "FEE";
17
+ ELoanTransactionTypes["CHARGE"] = "CHARGE";
18
18
  })(ELoanTransactionTypes || (exports.ELoanTransactionTypes = ELoanTransactionTypes = {}));
19
19
  exports.LOAN_TRANSACTION_DOWNLOAD_FIELDS = [
20
20
  'date',
@@ -29,6 +29,7 @@ exports.LOAN_TRANSACTION_FIELDS = [
29
29
  'date',
30
30
  'effectiveDate',
31
31
  'productId',
32
+ 'chargeId',
32
33
  'amount',
33
34
  'description',
34
35
  'reference',
@@ -63,6 +64,11 @@ exports.LoanTransactionSchema = new mongoose_1.default.Schema({
63
64
  ref: _models_1.MODEL_NAMES.loanProducts,
64
65
  required: true,
65
66
  },
67
+ chargeId: {
68
+ type: mongoose_1.default.Schema.Types.ObjectId,
69
+ ref: _models_1.MODEL_NAMES.loanCharges,
70
+ required: false,
71
+ },
66
72
  amount: {
67
73
  type: Number,
68
74
  required: true,
@@ -11,7 +11,7 @@ export enum ELoanTransactionTypes {
11
11
  COLLECTION = 'COLLECTION',
12
12
  DISBURSEMENT = 'DISBURSEMENT',
13
13
  ADJUSTMENT = 'ADJUSTMENT',
14
- FEE = 'FEE',
14
+ CHARGE = 'CHARGE',
15
15
  }
16
16
 
17
17
  export const LOAN_TRANSACTION_DOWNLOAD_FIELDS = [
@@ -28,6 +28,7 @@ export const LOAN_TRANSACTION_FIELDS = [
28
28
  'date',
29
29
  'effectiveDate',
30
30
  'productId',
31
+ 'chargeId',
31
32
  'amount',
32
33
  'description',
33
34
  'reference',
@@ -56,6 +57,7 @@ export interface ILoanTransaction {
56
57
  date: Date;
57
58
  effectiveDate: Date,
58
59
  productId: mongoose.Types.ObjectId;
60
+ chargeId?: mongoose.Types.ObjectId;
59
61
  amount: number;
60
62
  description: string;
61
63
  reference: string;
@@ -93,11 +95,12 @@ export interface ILoanTransactionLean extends ILoanTransaction {
93
95
  updatedAt: Date;
94
96
  }
95
97
 
96
- export interface ILoanTransactionPlain extends Omit<ILoanTransaction, 'productId' | 'bankId' | 'loanPaymentId'> {
98
+ export interface ILoanTransactionPlain extends Omit<ILoanTransaction, 'productId' | 'bankId' | 'loanPaymentId' | 'chargeId'> {
97
99
  _id: string;
98
100
  productId: string;
99
101
  bankId: string;
100
102
  loanPaymentId: string;
103
+ chargeId: string;
101
104
  }
102
105
 
103
106
  export type TLoanTransactionModel = mongoose.Model<ILoanTransaction>;
@@ -139,6 +142,11 @@ export const LoanTransactionSchema = new mongoose.Schema<ILoanTransactionDoc, IL
139
142
  ref: MODEL_NAMES.loanProducts,
140
143
  required: true,
141
144
  },
145
+ chargeId: {
146
+ type: mongoose.Schema.Types.ObjectId,
147
+ ref: MODEL_NAMES.loanCharges,
148
+ required: false,
149
+ },
142
150
  amount: {
143
151
  type: Number,
144
152
  required: true,
@@ -23,7 +23,7 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import Joi from 'joi';
26
- import mongoose, { Model } from 'mongoose';
26
+ import mongoose from 'mongoose';
27
27
  import { ISelectedMonth } from '../helpers/date.helper';
28
28
  export declare const yieldParamsValidationSchema: Joi.ObjectSchema<IYieldParams>;
29
29
  export declare enum ETotalType {
@@ -79,7 +79,6 @@ export interface IYieldParams {
79
79
  ignoreOldData?: boolean;
80
80
  }
81
81
  export interface IYieldData {
82
- _id?: mongoose.Types.ObjectId;
83
82
  productId?: mongoose.Types.ObjectId;
84
83
  chargeId?: mongoose.Types.ObjectId;
85
84
  totalType: string;
@@ -88,9 +87,23 @@ export interface IYieldData {
88
87
  value?: number;
89
88
  valuePercent?: number;
90
89
  }
91
- type IYieldDataModel = Model<IYieldData, {}, {}>;
92
- export declare const YieldDataSchema: mongoose.Schema<IYieldData, IYieldDataModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IYieldData, mongoose.Document<unknown, {}, mongoose.FlatRecord<IYieldData>> & mongoose.FlatRecord<IYieldData> & Required<{
90
+ export interface IYieldDataDoc extends IYieldData, mongoose.Document {
93
91
  _id: mongoose.Types.ObjectId;
94
- }>>;
95
- export declare const YieldData: IYieldDataModel;
96
- export {};
92
+ createdAt: Date;
93
+ updatedAt: Date;
94
+ }
95
+ export interface IYieldDataLean extends IYieldData {
96
+ _id: mongoose.Types.ObjectId;
97
+ createdAt: Date;
98
+ updatedAt: Date;
99
+ }
100
+ export interface IYieldDataPlain extends Omit<IYieldData, 'productId' | 'chargeId'> {
101
+ _id: string;
102
+ productId: string;
103
+ chargeId: string;
104
+ }
105
+ export type TYieldDataModel = mongoose.Model<IYieldData>;
106
+ export declare const YieldDataSchema: mongoose.Schema<IYieldData, TYieldDataModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IYieldData, mongoose.Document<unknown, {}, mongoose.FlatRecord<IYieldData>> & mongoose.FlatRecord<IYieldData> & {
107
+ _id: mongoose.Types.ObjectId;
108
+ }>;
109
+ export declare const YieldData: TYieldDataModel;
@@ -1,5 +1,5 @@
1
1
  import Joi from 'joi';
2
- import mongoose, { Model } from 'mongoose';
2
+ import mongoose from 'mongoose';
3
3
 
4
4
  import { ISelectedMonth } from '../helpers/date.helper';
5
5
  import { MODEL_NAMES } from './_models';
@@ -45,7 +45,6 @@ export interface IYieldParams {
45
45
  }
46
46
 
47
47
  export interface IYieldData {
48
- _id?: mongoose.Types.ObjectId;
49
48
  productId?: mongoose.Types.ObjectId;
50
49
  chargeId?: mongoose.Types.ObjectId;
51
50
  totalType: string;
@@ -55,9 +54,27 @@ export interface IYieldData {
55
54
  valuePercent?: number;
56
55
  }
57
56
 
58
- type IYieldDataModel = Model<IYieldData, {}, {}>;
57
+ export interface IYieldDataDoc extends IYieldData, mongoose.Document {
58
+ _id: mongoose.Types.ObjectId;
59
+ createdAt: Date;
60
+ updatedAt: Date;
61
+ }
62
+
63
+ export interface IYieldDataLean extends IYieldData {
64
+ _id: mongoose.Types.ObjectId;
65
+ createdAt: Date;
66
+ updatedAt: Date;
67
+ }
68
+
69
+ export interface IYieldDataPlain extends Omit<IYieldData, 'productId' | 'chargeId'> {
70
+ _id: string;
71
+ productId: string;
72
+ chargeId: string;
73
+ }
74
+
75
+ export type TYieldDataModel = mongoose.Model<IYieldData>;
59
76
 
60
- export const YieldDataSchema = new mongoose.Schema<IYieldData, IYieldDataModel>(
77
+ export const YieldDataSchema = new mongoose.Schema<IYieldData, TYieldDataModel>(
61
78
  {
62
79
  productId: {
63
80
  type: mongoose.Schema.Types.ObjectId,
@@ -92,4 +109,4 @@ export const YieldDataSchema = new mongoose.Schema<IYieldData, IYieldDataModel>(
92
109
  },
93
110
  );
94
111
 
95
- export const YieldData = mongoose.model<IYieldData, IYieldDataModel>(MODEL_NAMES.yieldData, YieldDataSchema);
112
+ export const YieldData = mongoose.model<IYieldData, TYieldDataModel>(MODEL_NAMES.yieldData, YieldDataSchema);
@@ -31,10 +31,10 @@ export declare const allSchemas: {
31
31
  createdAt: NativeDate;
32
32
  updatedAt: NativeDate;
33
33
  } & {
34
- amount: number;
35
- order: number;
36
34
  bbcSheetId: import("mongoose").Types.ObjectId;
35
+ order: number;
37
36
  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
- amount: number;
49
- order: number;
50
48
  bbcSheetId: import("mongoose").Types.ObjectId;
49
+ order: number;
51
50
  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
- amount: number;
63
- order: number;
64
62
  bbcSheetId: import("mongoose").Types.ObjectId;
63
+ order: number;
65
64
  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.202",
3
+ "version": "1.4.205",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -83,12 +83,12 @@ export declare const YIELD_TOTALS_MAP: {
83
83
  };
84
84
  export declare class YieldService {
85
85
  private getCalculatedYieldData;
86
- getCalculatedYieldTotals(productId: string, selectedMonth: ISelectedMonth): Promise<(mongoose.FlattenMaps<import("../models/Yield.model").IYieldData> & Required<{
86
+ getCalculatedYieldTotals(productId: string, selectedMonth: ISelectedMonth): Promise<(mongoose.FlattenMaps<import("../models/Yield.model").IYieldData> & {
87
87
  _id: mongoose.Types.ObjectId;
88
- }>)[]>;
89
- getCalculatedYieldTotalsForPeriod(productId: string, periodStart: ISelectedMonth, periodEnd: ISelectedMonth): Promise<(mongoose.FlattenMaps<import("../models/Yield.model").IYieldData> & Required<{
88
+ })[]>;
89
+ getCalculatedYieldTotalsForPeriod(productId: string, periodStart: ISelectedMonth, periodEnd: ISelectedMonth): Promise<(mongoose.FlattenMaps<import("../models/Yield.model").IYieldData> & {
90
90
  _id: mongoose.Types.ObjectId;
91
- }>)[]>;
91
+ })[]>;
92
92
  getYieldData(params: IYieldParams): Promise<{
93
93
  data: IYieldViewData[];
94
94
  dateColumns: string[];