gemcap-be-common 1.4.118 → 1.4.120

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.
@@ -22,7 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document } from 'mongoose';
25
+ import mongoose, { Document, Model } from 'mongoose';
26
26
  export interface IBank {
27
27
  isDeleted?: boolean;
28
28
  active: boolean;
@@ -36,56 +36,27 @@ export interface IBank {
36
36
  export interface IBankWithId extends IBank {
37
37
  _id: mongoose.Types.ObjectId;
38
38
  }
39
- export type IBankView = Omit<IBankWithId, 'order'>;
40
39
  export interface IBankDoc extends IBank, Document {
40
+ _id: mongoose.Types.ObjectId;
41
+ createdAt: Date;
42
+ updatedAt: Date;
41
43
  }
42
- export declare const BankSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
43
- timestamps: true;
44
- }, {
45
- createdAt: NativeDate;
46
- updatedAt: NativeDate;
47
- } & {
48
- name: string;
49
- order: number;
50
- isDeleted: boolean;
51
- active: boolean;
52
- bankAccountNumber: string;
53
- ledgerAccountCodes: Map<string, {
54
- type?: mongoose.Types.ObjectId;
55
- ref?: unknown;
56
- }>;
57
- __v?: number;
58
- }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
59
- createdAt: NativeDate;
60
- updatedAt: NativeDate;
61
- } & {
62
- name: string;
63
- order: number;
64
- isDeleted: boolean;
65
- active: boolean;
66
- bankAccountNumber: string;
67
- ledgerAccountCodes: Map<string, {
68
- type?: mongoose.Types.ObjectId;
69
- ref?: unknown;
70
- }>;
71
- __v?: number;
72
- }>> & mongoose.FlatRecord<{
73
- createdAt: NativeDate;
74
- updatedAt: NativeDate;
75
- } & {
76
- name: string;
77
- order: number;
78
- isDeleted: boolean;
79
- active: boolean;
80
- bankAccountNumber: string;
81
- ledgerAccountCodes: Map<string, {
82
- type?: mongoose.Types.ObjectId;
83
- ref?: unknown;
84
- }>;
85
- __v?: number;
86
- }> & {
44
+ export interface IBankLean extends IBank {
87
45
  _id: mongoose.Types.ObjectId;
88
- }>;
89
- export declare const Bank: mongoose.Model<IBankDoc, {}, {}, {}, mongoose.Document<unknown, {}, IBankDoc> & IBankDoc & {
46
+ createdAt: Date;
47
+ updatedAt: Date;
48
+ }
49
+ export interface IBankPlain extends Omit<IBank, 'ledgerAccountCodes'> {
50
+ _id: string;
51
+ createdAt: Date;
52
+ updatedAt: Date;
53
+ ledgerAccountCodes: {
54
+ [companyId: string]: string;
55
+ };
56
+ }
57
+ export type IBankView = Omit<IBankWithId, 'order'>;
58
+ export type IBankModel = Model<IBank>;
59
+ export declare const BankSchema: mongoose.Schema<IBank, IBankModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IBank, mongoose.Document<unknown, {}, mongoose.FlatRecord<IBank>> & mongoose.FlatRecord<IBank> & {
90
60
  _id: mongoose.Types.ObjectId;
91
- }, any>;
61
+ }>;
62
+ export declare const Bank: IBankModel;
@@ -36,9 +36,5 @@ exports.BankSchema = new mongoose_1.default.Schema({
36
36
  of: { type: mongoose_1.default.Schema.Types.ObjectId, ref: _models_1.MODEL_NAMES.quickbooksAccounts },
37
37
  default: {},
38
38
  },
39
- __v: {
40
- type: Number,
41
- select: false
42
- },
43
39
  }, { timestamps: true });
44
40
  exports.Bank = mongoose_1.default.model(_models_1.MODEL_NAMES.banks, exports.BankSchema);
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose';
1
+ import mongoose, { Document, Model } from 'mongoose';
2
2
 
3
3
  import { MODEL_NAMES } from './_models';
4
4
 
@@ -17,12 +17,32 @@ export interface IBankWithId extends IBank {
17
17
  _id: mongoose.Types.ObjectId;
18
18
  }
19
19
 
20
- export type IBankView = Omit<IBankWithId, 'order'>
21
-
22
20
  export interface IBankDoc extends IBank, Document {
21
+ _id: mongoose.Types.ObjectId;
22
+ createdAt: Date;
23
+ updatedAt: Date;
24
+ }
25
+
26
+ export interface IBankLean extends IBank {
27
+ _id: mongoose.Types.ObjectId;
28
+ createdAt: Date;
29
+ updatedAt: Date;
23
30
  }
24
31
 
25
- export const BankSchema = new mongoose.Schema(
32
+ export interface IBankPlain extends Omit<IBank, 'ledgerAccountCodes'> {
33
+ _id: string;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ ledgerAccountCodes: {
37
+ [companyId: string]: string;
38
+ };
39
+ }
40
+
41
+ export type IBankView = Omit<IBankWithId, 'order'>
42
+
43
+ export type IBankModel = Model<IBank>;
44
+
45
+ export const BankSchema = new mongoose.Schema<IBank, IBankModel>(
26
46
  {
27
47
  isDeleted: {
28
48
  type: Boolean,
@@ -53,12 +73,8 @@ export const BankSchema = new mongoose.Schema(
53
73
  of: { type: mongoose.Schema.Types.ObjectId, ref: MODEL_NAMES.quickbooksAccounts },
54
74
  default: {},
55
75
  },
56
- __v: {
57
- type: Number,
58
- select: false
59
- },
60
76
  },
61
77
  { timestamps: true },
62
78
  );
63
79
 
64
- export const Bank = mongoose.model<IBankDoc>(MODEL_NAMES.banks, BankSchema);
80
+ export const Bank = mongoose.model<IBank, IBankModel>(MODEL_NAMES.banks, BankSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.118",
3
+ "version": "1.4.120",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -295,7 +295,7 @@ class BankUploadedTransactionsService {
295
295
  const productIds = new Set();
296
296
  await Promise.all(allocatedTransactions.map(async (transactionToConvert) => {
297
297
  const transaction = transactions.find((tr) => tr._id.toString() === transactionToConvert.uploadedBankTransactionId.toString());
298
- if (transaction.isConverted) {
298
+ if (!transaction || transaction.isConverted) {
299
299
  return;
300
300
  }
301
301
  const splitTransaction = transactionToConvert.splitTransactionId
@@ -332,7 +332,7 @@ export class BankUploadedTransactionsService {
332
332
  const productIds = new Set<string>();
333
333
  await Promise.all(allocatedTransactions.map(async (transactionToConvert) => {
334
334
  const transaction = transactions.find((tr) => tr._id.toString() === transactionToConvert.uploadedBankTransactionId.toString());
335
- if (transaction.isConverted) {
335
+ if (!transaction || transaction.isConverted) {
336
336
  return;
337
337
  }
338
338
  const splitTransaction = transactionToConvert.splitTransactionId
@@ -28,7 +28,7 @@ export declare class BanksService {
28
28
  getBanks(): Promise<IBankView[]>;
29
29
  createBank(bank: IBankView): Promise<void>;
30
30
  editBank(bank: IBankView): Promise<void>;
31
- findBankByNumber(bankAccountNumber: string): Promise<import("mongoose").FlattenMaps<import("../models/Banks.model").IBankDoc> & {
31
+ findBankByNumber(bankAccountNumber: string): Promise<import("mongoose").FlattenMaps<import("../models/Banks.model").IBank> & {
32
32
  _id: import("mongoose").Types.ObjectId;
33
33
  }>;
34
34
  findBankByAccountCode(accountCode: string): Promise<IBankWithId>;
@@ -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;
89
87
  ENTIRE_LOAN?: boolean;
90
88
  SELECTED_PERIOD?: boolean;
89
+ CURRENT_MONTH?: boolean;
90
+ LAST_MONTH?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;
@@ -46,9 +46,9 @@ export declare class BrokersService {
46
46
  getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
47
47
  _id: import("mongoose").Types.ObjectId;
48
48
  })[]>;
49
- getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
49
+ getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
50
50
  _id: import("mongoose").Types.ObjectId;
51
- })[]>;
51
+ })[] | BrokerView[]>;
52
52
  getProductBrokers(productId: string): Promise<import("../models/ProductBroker.model").IProductBrokerDocWithBroker[]>;
53
53
  getTotalShares(borrowerId: string, brokers: IProductBrokerView[], replaceNames?: boolean): Promise<ProductTotal>;
54
54
  getTotals(borrowerId: string): Promise<BrokerTotalView[]>;