payservedb 2.3.12 → 2.4.1
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/package.json +1 -1
- package/src/models/invoice.js +62 -44
- package/src/models/reminder.js +24 -19
package/package.json
CHANGED
package/src/models/invoice.js
CHANGED
|
@@ -1,77 +1,95 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
3
|
// Define the schema for Invoice
|
|
4
|
-
const invoiceSchema = new mongoose.Schema(
|
|
4
|
+
const invoiceSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
5
6
|
invoiceNumber: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true,
|
|
9
10
|
},
|
|
10
11
|
client: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
+
ref: "Customer",
|
|
14
|
+
required: true,
|
|
14
15
|
},
|
|
15
16
|
facility: {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
id: {
|
|
18
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
19
|
+
ref: "Facility",
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
name: { type: String, required: true },
|
|
18
23
|
},
|
|
19
24
|
unit: {
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
id: { type: mongoose.Schema.Types.ObjectId, ref: "Unit", required: true },
|
|
26
|
+
name: { type: String, required: true },
|
|
22
27
|
},
|
|
23
|
-
items: [
|
|
28
|
+
items: [
|
|
29
|
+
{
|
|
24
30
|
description: { type: String, required: true },
|
|
25
31
|
quantity: { type: Number, required: true, min: 1 },
|
|
26
|
-
unitPrice: { type: Number, required: true, min: 0 }
|
|
27
|
-
|
|
32
|
+
unitPrice: { type: Number, required: true, min: 0 },
|
|
33
|
+
},
|
|
34
|
+
],
|
|
28
35
|
subTotal: {
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
type: Number,
|
|
37
|
+
required: true,
|
|
31
38
|
},
|
|
32
39
|
tax: {
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
type: Number,
|
|
41
|
+
required: true,
|
|
35
42
|
},
|
|
36
43
|
totalAmount: {
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
type: Number,
|
|
45
|
+
required: true,
|
|
39
46
|
},
|
|
40
47
|
issueDate: {
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
type: Date,
|
|
49
|
+
required: true,
|
|
43
50
|
},
|
|
44
51
|
dueDate: {
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
type: Date,
|
|
53
|
+
required: true,
|
|
47
54
|
},
|
|
48
55
|
status: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
type: String,
|
|
57
|
+
required: true,
|
|
58
|
+
enum: ["Pending", "Paid", "Overdue"],
|
|
52
59
|
},
|
|
53
60
|
penalty: {
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
type: Number,
|
|
62
|
+
default: 0,
|
|
56
63
|
},
|
|
57
64
|
whatFor: {
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
invoiceType: { type: String, required: true },
|
|
66
|
+
description: { type: String },
|
|
60
67
|
},
|
|
61
68
|
invoiceNote: {
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
type: String,
|
|
70
|
+
default: null,
|
|
64
71
|
},
|
|
72
|
+
|
|
73
|
+
lastReminderSent: Date,
|
|
74
|
+
reminderHistory: [
|
|
75
|
+
{
|
|
76
|
+
sentAt: Date,
|
|
77
|
+
reminderId: Schema.Types.ObjectId,
|
|
78
|
+
notificationTypes: [String],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
65
81
|
paymentDetails: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
paymentStatus: { type: String, required: true },
|
|
83
|
+
paymentMethod: { type: String },
|
|
84
|
+
paymentDate: { type: Date },
|
|
85
|
+
transactionId: { type: String },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
timestamps: true,
|
|
90
|
+
}
|
|
91
|
+
);
|
|
74
92
|
|
|
75
|
-
const Invoice = mongoose.model(
|
|
93
|
+
const Invoice = mongoose.model("Invoice", invoiceSchema);
|
|
76
94
|
|
|
77
|
-
module.exports = Invoice;
|
|
95
|
+
module.exports = Invoice;
|
package/src/models/reminder.js
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
3
|
// Define the schema for Reminder
|
|
4
|
-
const reminderSchema = new mongoose.Schema(
|
|
4
|
+
const reminderSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
5
6
|
name: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
trim: true,
|
|
9
10
|
},
|
|
10
11
|
type: {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
13
14
|
},
|
|
14
15
|
time: {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
17
18
|
},
|
|
18
19
|
day: {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
21
22
|
},
|
|
23
|
+
notificationTypes: [String],
|
|
24
|
+
message: String,
|
|
22
25
|
facilityId: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
+
ref: "Facility",
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
timestamps: true,
|
|
33
|
+
}
|
|
34
|
+
);
|
|
30
35
|
|
|
31
|
-
const Reminder = mongoose.model(
|
|
36
|
+
const Reminder = mongoose.model("Reminder", reminderSchema);
|
|
32
37
|
|
|
33
38
|
module.exports = Reminder;
|