pristine-member-nest-api-database 1.0.1 → 1.0.2
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.
- package/dist/models/payment.model.js +22 -14
- package/models/payment.model.ts +47 -38
- package/package.json +2 -2
|
@@ -25,45 +25,53 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.mongoPayment = void 0;
|
|
27
27
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
-
mongoose_1.default.set(
|
|
28
|
+
mongoose_1.default.set("strictPopulate", false);
|
|
29
29
|
const paymentSchema = new mongoose_1.Schema({
|
|
30
30
|
paymentId: { type: Number },
|
|
31
31
|
transactionUuid: { type: String },
|
|
32
32
|
member: {
|
|
33
33
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
34
|
-
ref:
|
|
34
|
+
ref: "Members", // Reference to the 'Members' model
|
|
35
35
|
},
|
|
36
36
|
memberCode: { type: String },
|
|
37
37
|
associationMemberCode: { type: String },
|
|
38
38
|
branch: {
|
|
39
39
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
40
|
-
ref:
|
|
40
|
+
ref: "Branches", // Reference to the 'Members' model
|
|
41
41
|
},
|
|
42
42
|
totalAmount: { type: Number },
|
|
43
|
-
invoices: [
|
|
43
|
+
invoices: [
|
|
44
|
+
{
|
|
44
45
|
invoiceNo: { type: String },
|
|
45
46
|
invoicePeriod: { type: String },
|
|
46
|
-
invoiceAmount: { type: Number }
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
invoiceAmount: { type: Number },
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
downPayments: [
|
|
51
|
+
{
|
|
49
52
|
docEntry: { type: String },
|
|
50
53
|
amount: { type: Number },
|
|
51
|
-
}
|
|
52
|
-
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
openInvoices: [
|
|
57
|
+
{
|
|
53
58
|
docEntry: { type: String },
|
|
54
59
|
amount: { type: Number },
|
|
55
|
-
}
|
|
60
|
+
},
|
|
61
|
+
],
|
|
56
62
|
decision: { type: String },
|
|
57
63
|
isCompleted: { type: Boolean, default: false },
|
|
58
64
|
paymentOn: { type: Date, default: Date.now() },
|
|
59
65
|
paymentGatewayResponse: { type: Object, default: null },
|
|
60
66
|
isSAPSynced: { type: Boolean, default: false },
|
|
61
67
|
sapSyncedOn: { type: Date, default: null },
|
|
62
|
-
audit: [
|
|
68
|
+
audit: [
|
|
69
|
+
{
|
|
63
70
|
userId: { type: String },
|
|
64
71
|
auditedOn: { type: Date, default: Date.now() },
|
|
65
|
-
actionType: { type: String }
|
|
66
|
-
}
|
|
72
|
+
actionType: { type: String },
|
|
73
|
+
},
|
|
74
|
+
],
|
|
67
75
|
});
|
|
68
|
-
const mongoPayment = mongoose_1.default.model(
|
|
76
|
+
const mongoPayment = mongoose_1.default.model("Payments", paymentSchema);
|
|
69
77
|
exports.mongoPayment = mongoPayment;
|
package/models/payment.model.ts
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import mongoose, { Document, Schema } from
|
|
2
|
-
import { Audit } from
|
|
1
|
+
import mongoose, { Document, Schema } from "mongoose";
|
|
2
|
+
import { Audit } from "../interface/Audit.interface";
|
|
3
3
|
|
|
4
4
|
export type Invoice = {
|
|
5
5
|
invoiceNo: string;
|
|
6
|
-
invoicePeriod: string;
|
|
6
|
+
invoicePeriod: string;
|
|
7
7
|
invoiceAmount: number;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
export type DownPayment = {
|
|
11
11
|
docEntry: string;
|
|
12
12
|
amount: number;
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
|
|
15
15
|
export type OpenInvoice = {
|
|
16
16
|
docEntry: string;
|
|
17
17
|
amount: number;
|
|
18
|
-
|
|
18
|
+
code: string;
|
|
19
|
+
};
|
|
19
20
|
|
|
20
21
|
interface PaymentDocument extends Document {
|
|
21
22
|
paymentId: number;
|
|
22
23
|
transactionUuid: string;
|
|
23
24
|
member: mongoose.Types.ObjectId;
|
|
24
|
-
memberCode: string
|
|
25
|
+
memberCode: string;
|
|
25
26
|
associationMemberCode: string;
|
|
26
|
-
branch: mongoose.Types.ObjectId;
|
|
27
|
+
branch: mongoose.Types.ObjectId;
|
|
27
28
|
totalAmount: number;
|
|
28
29
|
invoices: Invoice[];
|
|
29
30
|
downPayments: DownPayment[];
|
|
@@ -37,48 +38,56 @@ interface PaymentDocument extends Document {
|
|
|
37
38
|
audit: Audit[];
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
mongoose.set(
|
|
41
|
+
mongoose.set("strictPopulate", false);
|
|
41
42
|
|
|
42
43
|
const paymentSchema = new Schema<PaymentDocument>({
|
|
43
44
|
paymentId: { type: Number },
|
|
44
|
-
transactionUuid:
|
|
45
|
+
transactionUuid: { type: String },
|
|
45
46
|
member: {
|
|
46
47
|
type: Schema.Types.ObjectId,
|
|
47
|
-
ref:
|
|
48
|
+
ref: "Members", // Reference to the 'Members' model
|
|
48
49
|
},
|
|
49
|
-
memberCode: {type: String},
|
|
50
|
-
associationMemberCode:
|
|
50
|
+
memberCode: { type: String },
|
|
51
|
+
associationMemberCode: { type: String },
|
|
51
52
|
branch: {
|
|
52
53
|
type: Schema.Types.ObjectId,
|
|
53
|
-
ref:
|
|
54
|
+
ref: "Branches", // Reference to the 'Members' model
|
|
54
55
|
},
|
|
55
|
-
totalAmount:
|
|
56
|
-
invoices:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
totalAmount: { type: Number },
|
|
57
|
+
invoices: [
|
|
58
|
+
{
|
|
59
|
+
invoiceNo: { type: String },
|
|
60
|
+
invoicePeriod: { type: String },
|
|
61
|
+
invoiceAmount: { type: Number },
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
downPayments: [
|
|
65
|
+
{
|
|
66
|
+
docEntry: { type: String },
|
|
67
|
+
amount: { type: Number },
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
openInvoices: [
|
|
71
|
+
{
|
|
72
|
+
docEntry: { type: String },
|
|
73
|
+
amount: { type: Number },
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
decision: { type: String },
|
|
70
77
|
isCompleted: { type: Boolean, default: false },
|
|
71
|
-
paymentOn: { type: Date, default: Date.now() },
|
|
78
|
+
paymentOn: { type: Date, default: Date.now() },
|
|
72
79
|
paymentGatewayResponse: { type: Object, default: null },
|
|
73
|
-
isSAPSynced: {type: Boolean, default: false},
|
|
74
|
-
sapSyncedOn: {type: Date, default: null},
|
|
75
|
-
audit: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
isSAPSynced: { type: Boolean, default: false },
|
|
81
|
+
sapSyncedOn: { type: Date, default: null },
|
|
82
|
+
audit: [
|
|
83
|
+
{
|
|
84
|
+
userId: { type: String },
|
|
85
|
+
auditedOn: { type: Date, default: Date.now() },
|
|
86
|
+
actionType: { type: String },
|
|
87
|
+
},
|
|
88
|
+
],
|
|
80
89
|
});
|
|
81
90
|
|
|
82
|
-
const mongoPayment = mongoose.model<PaymentDocument>(
|
|
91
|
+
const mongoPayment = mongoose.model<PaymentDocument>("Payments", paymentSchema);
|
|
83
92
|
|
|
84
93
|
export { PaymentDocument, mongoPayment };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pristine-member-nest-api-database",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Member nest API database",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
"ts-node": "^10.9.2",
|
|
17
17
|
"typescript": "^5.3.3"
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|