gemcap-be-common 1.5.180 → 1.5.181

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.
@@ -0,0 +1,29 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose from 'mongoose';
26
+ export type TToPlainValue<T> = T extends mongoose.Types.ObjectId | null ? string | null : T extends Date | null ? string | null : T;
27
+ export type TUpdatePayload<T, TReadonly extends keyof T = never> = {
28
+ [K in keyof Omit<T, TReadonly>]?: TToPlainValue<T[K]>;
29
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import mongoose from 'mongoose';
2
+
3
+ export type TToPlainValue<T> =
4
+ T extends mongoose.Types.ObjectId | null
5
+ ? string | null
6
+ : T extends Date | null
7
+ ? string | null
8
+ : T;
9
+
10
+ export type TUpdatePayload<T, TReadonly extends keyof T = never> = {
11
+ [K in keyof Omit<T, TReadonly>]?: TToPlainValue<T[K]>;
12
+ };
@@ -23,6 +23,7 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
+ import { TUpdatePayload } from '../interfaces/db.interface';
26
27
  export interface IBorrowerFinanceSettings {
27
28
  borrowerId: mongoose.Types.ObjectId;
28
29
  companyId: mongoose.Types.ObjectId | null;
@@ -42,13 +43,14 @@ export interface IBorrowerFinanceSettingsLean extends IBorrowerFinanceSettings {
42
43
  export interface IBorrowerFinanceSettingsPlain extends Omit<IBorrowerFinanceSettings, 'borrowerId' | 'companyId' | 'reserveCodeCompanyId' | 'reserveCodeId'> {
43
44
  _id: string;
44
45
  borrowerId: string;
45
- companyId: string;
46
- reserveCodeCompanyId: string;
47
- reserveCodeId: string;
46
+ companyId: string | null;
47
+ reserveCodeCompanyId: string | null;
48
+ reserveCodeId: string | null;
48
49
  createdAt: Date;
49
50
  updatedAt: Date;
50
51
  }
51
52
  export type TBorrowerFinanceSettingsModel = mongoose.Model<TBorrowerFinanceSettingsDoc>;
53
+ export type TUpdateBorrowerFinanceSettings = TUpdatePayload<IBorrowerFinanceSettings, 'borrowerId'>;
52
54
  export declare const BorrowerFinanceSettingsSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
53
55
  timestamps: true;
54
56
  }, {
@@ -1,6 +1,7 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
3
  import { MODEL_NAMES } from './_models';
4
+ import { TToPlainValue, TUpdatePayload } from '../interfaces/db.interface';
4
5
 
5
6
  export interface IBorrowerFinanceSettings {
6
7
  borrowerId: mongoose.Types.ObjectId;
@@ -27,15 +28,21 @@ export interface IBorrowerFinanceSettingsLean extends IBorrowerFinanceSettings {
27
28
  export interface IBorrowerFinanceSettingsPlain extends Omit<IBorrowerFinanceSettings, 'borrowerId' | 'companyId' | 'reserveCodeCompanyId' | 'reserveCodeId'> {
28
29
  _id: string;
29
30
  borrowerId: string;
30
- companyId: string;
31
- reserveCodeCompanyId: string;
32
- reserveCodeId: string;
31
+ companyId: string | null;
32
+ reserveCodeCompanyId: string | null;
33
+ reserveCodeId: string | null;
33
34
  createdAt: Date;
34
35
  updatedAt: Date;
35
36
  }
36
37
 
37
38
  export type TBorrowerFinanceSettingsModel = mongoose.Model<TBorrowerFinanceSettingsDoc>;
38
39
 
40
+ type TBorrowerFinanceSettingsReadonlyFields = 'borrowerId';
41
+
42
+ type TBorrowerFinanceSettingsUpdateFields = Omit<IBorrowerFinanceSettings, TBorrowerFinanceSettingsReadonlyFields>;
43
+
44
+ export type TUpdateBorrowerFinanceSettings = TUpdatePayload<IBorrowerFinanceSettings, 'borrowerId'>;
45
+
39
46
  export const BorrowerFinanceSettingsSchema = new mongoose.Schema(
40
47
  {
41
48
  borrowerId: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.180",
3
+ "version": "1.5.181",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {