tango-api-schema 2.6.6 → 2.6.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-api-schema",
3
- "version": "2.6.6",
3
+ "version": "2.6.8",
4
4
  "description": "tangoEye model schema",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -62,6 +62,16 @@ const billingSchema = new mongoose.Schema(
62
62
  type: String,
63
63
  enum: ['dollar','inr','singaporedollar','euro'],
64
64
  },
65
+ // Drives invoice-generation tax behavior. 'domestic' runs the
66
+ // existing GST/IGST/CGST/SGST logic. 'international' suppresses
67
+ // tax lines entirely (the tax array is left empty so totalAmount
68
+ // equals subtotal). Defaults to 'domestic' so existing records
69
+ // keep their current behavior on read.
70
+ taxCalculationType: {
71
+ type: String,
72
+ enum: ['domestic','international'],
73
+ default: 'domestic'
74
+ },
65
75
  isInstallationOneTime: {
66
76
  type: Boolean,
67
77
  default: false
@@ -95,8 +95,28 @@ const invoiceSchema = new mongoose.Schema(
95
95
  paymentStatus:{
96
96
  type:String,
97
97
  default:'unpaid',
98
- enum: ['paid','unpaid']
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');