tango-api-schema 2.6.6 → 2.6.7
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/schema/invoice.model.js +22 -2
- package/schema/regionKey.model.js +31 -31
package/package.json
CHANGED
package/schema/invoice.model.js
CHANGED
|
@@ -95,8 +95,28 @@ const invoiceSchema = new mongoose.Schema(
|
|
|
95
95
|
paymentStatus:{
|
|
96
96
|
type:String,
|
|
97
97
|
default:'unpaid',
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
// 'partial' = paidAmount > 0 && paidAmount < totalAmount.
|
|
99
|
+
// Server derives this in recordPayment so the value stays in sync.
|
|
100
|
+
enum: ['paid','unpaid','partial']
|
|
101
|
+
},
|
|
102
|
+
// Running total of all payments recorded against this invoice. Sum of
|
|
103
|
+
// paymentHistory[].amount; persisted for easy querying / display so
|
|
104
|
+
// the frontend doesn't need to re-sum every render.
|
|
105
|
+
paidAmount:{
|
|
106
|
+
type:Number,
|
|
107
|
+
default:0
|
|
108
|
+
},
|
|
109
|
+
// Append-only audit trail. Each entry is one payment received from
|
|
110
|
+
// the client. recordedAt is server-set; the rest comes from the form.
|
|
111
|
+
paymentHistory:[{
|
|
112
|
+
amount:{type:Number, required:true},
|
|
113
|
+
date:{type:Date, required:true},
|
|
114
|
+
method:{type:String, enum:['banktransfer','upi','cheque','card','cash','other']},
|
|
115
|
+
reference:{type:String},
|
|
116
|
+
notes:{type:String},
|
|
117
|
+
recordedBy:{type:String},
|
|
118
|
+
recordedAt:{type:Date, default:Date.now}
|
|
119
|
+
}],
|
|
100
120
|
advanceInvoice:{
|
|
101
121
|
type:Boolean,
|
|
102
122
|
default:false
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
import { randomUUID } from 'crypto';
|
|
3
|
-
|
|
4
|
-
// schema
|
|
5
|
-
const collection = new mongoose.Schema({
|
|
6
|
-
apiKey: {
|
|
7
|
-
type: String,
|
|
8
|
-
required: true,
|
|
9
|
-
unique: true,
|
|
10
|
-
default: () => randomUUID()
|
|
11
|
-
},
|
|
12
|
-
countryName: {
|
|
13
|
-
type: String,
|
|
14
|
-
},
|
|
15
|
-
countryCode: {
|
|
16
|
-
type: String,
|
|
17
|
-
},
|
|
18
|
-
clientId: {
|
|
19
|
-
type: String,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
timestamps: true,
|
|
24
|
-
strict: true,
|
|
25
|
-
versionKey: false,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
collection.index({ apiKey: 1 });
|
|
30
|
-
|
|
31
|
-
export default mongoose.model('regionKey', collection, 'regionKey');
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { randomUUID } from 'crypto';
|
|
3
|
+
|
|
4
|
+
// schema
|
|
5
|
+
const collection = new mongoose.Schema({
|
|
6
|
+
apiKey: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true,
|
|
10
|
+
default: () => randomUUID()
|
|
11
|
+
},
|
|
12
|
+
countryName: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
countryCode: {
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
clientId: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
timestamps: true,
|
|
24
|
+
strict: true,
|
|
25
|
+
versionKey: false,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
collection.index({ apiKey: 1 });
|
|
30
|
+
|
|
31
|
+
export default mongoose.model('regionKey', collection, 'regionKey');
|