tango-api-schema 2.6.62 → 2.6.64

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.
@@ -1,90 +1,90 @@
1
- import mongoose from 'mongoose';
2
-
3
- // Estimates (quotations) — generated before an invoice to share projected
4
- // billing with a client. Mirrors the invoice shape but carries an estimate
5
- // lifecycle (draft → sent → accepted/declined/expired) and a validity date
6
- // instead of a due date.
7
- const estimateSchema = new mongoose.Schema(
8
- {
9
- clientId: {
10
- type: String,
11
- },
12
- estimate: {
13
- type: String, // EST-26-27-00031
14
- },
15
- estimateIndex: {
16
- type: String,
17
- },
18
- companyName: {
19
- type: String,
20
- },
21
- companyAddress: {
22
- type: String,
23
- },
24
- PlaceOfSupply: {
25
- type: String,
26
- },
27
- GSTNumber: {
28
- type: String,
29
- },
30
- groupId: {
31
- type: mongoose.Types.ObjectId,
32
- },
33
- groupName: {
34
- type: String,
35
- },
36
- period: {
37
- type: String, // e.g. "Jun 2026"
38
- },
39
- stores: {
40
- type: Number,
41
- },
42
- products: {
43
- type: Array,
44
- },
45
- tax: {
46
- type: Array,
47
- },
48
- amount: {
49
- type: Number, // excl. GST
50
- },
51
- totalAmount: {
52
- type: Number, // incl. GST
53
- },
54
- currency: {
55
- type: String,
56
- enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
57
- default: 'inr',
58
- },
59
- status: {
60
- type: String,
61
- default: 'pendingCsm',
62
- // Approval pipeline: pendingCsm -> pendingFinance -> pendingApproval
63
- // -> approved. Legacy values (pending/sent/accepted/declined/expired)
64
- // are retained so existing documents still validate on update.
65
- enum: [ 'pendingCsm', 'pendingFinance', 'pendingApproval', 'approved', 'pending', 'sent', 'accepted', 'declined', 'expired' ],
66
- },
67
- createdDate: {
68
- type: Date,
69
- },
70
- validTill: {
71
- type: Date,
72
- },
73
- // Set when an accepted estimate is turned into an invoice.
74
- convertedInvoice: {
75
- type: String,
76
- },
77
- createdBy: {
78
- type: String,
79
- },
80
- notes: {
81
- type: String,
82
- },
83
- }, {
84
- strict: true,
85
- versionKey: false,
86
- timestamps: true,
87
- }
88
- );
89
-
1
+ import mongoose from 'mongoose';
2
+
3
+ // Estimates (quotations) — generated before an invoice to share projected
4
+ // billing with a client. Mirrors the invoice shape but carries an estimate
5
+ // lifecycle (draft → sent → accepted/declined/expired) and a validity date
6
+ // instead of a due date.
7
+ const estimateSchema = new mongoose.Schema(
8
+ {
9
+ clientId: {
10
+ type: String,
11
+ },
12
+ estimate: {
13
+ type: String, // EST-26-27-00031
14
+ },
15
+ estimateIndex: {
16
+ type: String,
17
+ },
18
+ companyName: {
19
+ type: String,
20
+ },
21
+ companyAddress: {
22
+ type: String,
23
+ },
24
+ PlaceOfSupply: {
25
+ type: String,
26
+ },
27
+ GSTNumber: {
28
+ type: String,
29
+ },
30
+ groupId: {
31
+ type: mongoose.Types.ObjectId,
32
+ },
33
+ groupName: {
34
+ type: String,
35
+ },
36
+ period: {
37
+ type: String, // e.g. "Jun 2026"
38
+ },
39
+ stores: {
40
+ type: Number,
41
+ },
42
+ products: {
43
+ type: Array,
44
+ },
45
+ tax: {
46
+ type: Array,
47
+ },
48
+ amount: {
49
+ type: Number, // excl. GST
50
+ },
51
+ totalAmount: {
52
+ type: Number, // incl. GST
53
+ },
54
+ currency: {
55
+ type: String,
56
+ enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
57
+ default: 'inr',
58
+ },
59
+ status: {
60
+ type: String,
61
+ default: 'pendingCsm',
62
+ // Approval pipeline: pendingCsm -> pendingFinance -> pendingApproval
63
+ // -> approved. Legacy values (pending/sent/accepted/declined/expired)
64
+ // are retained so existing documents still validate on update.
65
+ enum: [ 'pendingCsm', 'pendingFinance', 'pendingApproval', 'approved', 'pending', 'sent', 'accepted', 'declined', 'expired' ],
66
+ },
67
+ createdDate: {
68
+ type: Date,
69
+ },
70
+ validTill: {
71
+ type: Date,
72
+ },
73
+ // Set when an accepted estimate is turned into an invoice.
74
+ convertedInvoice: {
75
+ type: String,
76
+ },
77
+ createdBy: {
78
+ type: String,
79
+ },
80
+ notes: {
81
+ type: String,
82
+ },
83
+ }, {
84
+ strict: true,
85
+ versionKey: false,
86
+ timestamps: true,
87
+ }
88
+ );
89
+
90
90
  export default mongoose.model( 'estimate', estimateSchema );
@@ -1,157 +1,157 @@
1
- import mongoose from 'mongoose';
2
-
3
- const invoiceSchema = new mongoose.Schema(
4
- {
5
- clientId: {
6
- type:String
7
- },
8
- invoice: {
9
- type:String,
10
- },
11
- invoiceIndex: {
12
- type:String,
13
- },
14
- stores: {
15
- type:Number
16
- },
17
- // For TINV (advance quarterly/half-yearly/yearly) invoices: the actual
18
- // list of stores covered, captured at generation time, with each store's
19
- // products and their working days.
20
- storeDetails: [
21
- {
22
- storeId: { type: String },
23
- storeName: { type: String },
24
- products: [
25
- {
26
- productName: { type: String },
27
- workingdays: { type: Number },
28
- },
29
- ],
30
- },
31
- ],
32
- companyName:{
33
- type:String,
34
- },
35
- monthOfbilling:{
36
- type:String,
37
- },
38
- companyAddress:{
39
- type:String,
40
- },
41
- PlaceOfSupply: {
42
- type:String,
43
- },
44
- GSTNumber: {
45
- type:String,
46
- },
47
- products:{
48
- type:Array
49
- },
50
- tax:{
51
- type:Array
52
- },
53
- amount:{
54
- type:Number
55
- },
56
- totalAmount:{
57
- type:Number
58
- },
59
- paymentMethod:{
60
- type:String
61
- },
62
- status:{
63
- type:String,
64
- default:'pendingCsm',
65
- enum:['pendingCsm','pendingFinance','pendingApproval','approved']
66
- },
67
- receivedAmount:{
68
- type:Number
69
- },
70
- billingDate:{
71
- type:Date
72
- },
73
- dueDate:{
74
- type:Date
75
- },
76
- paymentTerm:{
77
- type:Number
78
- },
79
- paidDate:{
80
- type:Date
81
- },
82
- paymentType: {
83
- type:String,
84
- enum: ['online','banktransfer']
85
- },
86
- paymentReferenceId: {
87
- type:String
88
- },
89
- fromDate:{
90
- type:Date
91
- },
92
- toDate:{
93
- type:Date
94
- },
95
- currency: {
96
- type:String
97
- },
98
- orderId: {
99
- type:String
100
- },
101
- groupName: {
102
- type:String
103
- },
104
- groupId: {
105
- type:String
106
- },
107
- // Purchase order this invoice is mapped to (reduces the PO's remaining
108
- // balance). Empty when the invoice isn't tied to a PO.
109
- purchaseOrderNumber: {
110
- type:String
111
- },
112
- discountAmount: {
113
- type:Number
114
- },
115
- discountPercentage: {
116
- type:Number
117
- },
118
- paymentStatus:{
119
- type:String,
120
- default:'unpaid',
121
- // 'partial' = paidAmount > 0 && paidAmount < totalAmount.
122
- // Server derives this in recordPayment so the value stays in sync.
123
- enum: ['paid','unpaid','partial']
124
- },
125
- // Running total of all payments recorded against this invoice. Sum of
126
- // paymentHistory[].amount; persisted for easy querying / display so
127
- // the frontend doesn't need to re-sum every render.
128
- paidAmount:{
129
- type:Number,
130
- default:0
131
- },
132
- // Append-only audit trail. Each entry is one payment received from
133
- // the client. recordedAt is server-set; the rest comes from the form.
134
- paymentHistory:[{
135
- amount:{type:Number, required:true},
136
- date:{type:Date, required:true},
137
- method:{type:String, enum:['banktransfer','upi','cheque','card','cash','other']},
138
- reference:{type:String},
139
- notes:{type:String},
140
- recordedBy:{type:String},
141
- recordedAt:{type:Date, default:Date.now}
142
- }],
143
- advanceInvoice:{
144
- type:Boolean,
145
- default:false
146
- },
147
- tempIndex:{ type:Number },
148
- advancePeriod:{ type:String },
149
- advanceMonths:{ type:Number },
150
- },{
151
- strict: true,
152
- versionKey: false,
153
- timestamps: true,
154
- }
155
- )
156
-
1
+ import mongoose from 'mongoose';
2
+
3
+ const invoiceSchema = new mongoose.Schema(
4
+ {
5
+ clientId: {
6
+ type:String
7
+ },
8
+ invoice: {
9
+ type:String,
10
+ },
11
+ invoiceIndex: {
12
+ type:String,
13
+ },
14
+ stores: {
15
+ type:Number
16
+ },
17
+ // For TINV (advance quarterly/half-yearly/yearly) invoices: the actual
18
+ // list of stores covered, captured at generation time, with each store's
19
+ // products and their working days.
20
+ storeDetails: [
21
+ {
22
+ storeId: { type: String },
23
+ storeName: { type: String },
24
+ products: [
25
+ {
26
+ productName: { type: String },
27
+ workingdays: { type: Number },
28
+ },
29
+ ],
30
+ },
31
+ ],
32
+ companyName:{
33
+ type:String,
34
+ },
35
+ monthOfbilling:{
36
+ type:String,
37
+ },
38
+ companyAddress:{
39
+ type:String,
40
+ },
41
+ PlaceOfSupply: {
42
+ type:String,
43
+ },
44
+ GSTNumber: {
45
+ type:String,
46
+ },
47
+ products:{
48
+ type:Array
49
+ },
50
+ tax:{
51
+ type:Array
52
+ },
53
+ amount:{
54
+ type:Number
55
+ },
56
+ totalAmount:{
57
+ type:Number
58
+ },
59
+ paymentMethod:{
60
+ type:String
61
+ },
62
+ status:{
63
+ type:String,
64
+ default:'pendingCsm',
65
+ enum:['pendingCsm','pendingFinance','pendingApproval','approved']
66
+ },
67
+ receivedAmount:{
68
+ type:Number
69
+ },
70
+ billingDate:{
71
+ type:Date
72
+ },
73
+ dueDate:{
74
+ type:Date
75
+ },
76
+ paymentTerm:{
77
+ type:Number
78
+ },
79
+ paidDate:{
80
+ type:Date
81
+ },
82
+ paymentType: {
83
+ type:String,
84
+ enum: ['online','banktransfer']
85
+ },
86
+ paymentReferenceId: {
87
+ type:String
88
+ },
89
+ fromDate:{
90
+ type:Date
91
+ },
92
+ toDate:{
93
+ type:Date
94
+ },
95
+ currency: {
96
+ type:String
97
+ },
98
+ orderId: {
99
+ type:String
100
+ },
101
+ groupName: {
102
+ type:String
103
+ },
104
+ groupId: {
105
+ type:String
106
+ },
107
+ // Purchase order this invoice is mapped to (reduces the PO's remaining
108
+ // balance). Empty when the invoice isn't tied to a PO.
109
+ purchaseOrderNumber: {
110
+ type:String
111
+ },
112
+ discountAmount: {
113
+ type:Number
114
+ },
115
+ discountPercentage: {
116
+ type:Number
117
+ },
118
+ paymentStatus:{
119
+ type:String,
120
+ default:'unpaid',
121
+ // 'partial' = paidAmount > 0 && paidAmount < totalAmount.
122
+ // Server derives this in recordPayment so the value stays in sync.
123
+ enum: ['paid','unpaid','partial']
124
+ },
125
+ // Running total of all payments recorded against this invoice. Sum of
126
+ // paymentHistory[].amount; persisted for easy querying / display so
127
+ // the frontend doesn't need to re-sum every render.
128
+ paidAmount:{
129
+ type:Number,
130
+ default:0
131
+ },
132
+ // Append-only audit trail. Each entry is one payment received from
133
+ // the client. recordedAt is server-set; the rest comes from the form.
134
+ paymentHistory:[{
135
+ amount:{type:Number, required:true},
136
+ date:{type:Date, required:true},
137
+ method:{type:String, enum:['banktransfer','upi','cheque','card','cash','other']},
138
+ reference:{type:String},
139
+ notes:{type:String},
140
+ recordedBy:{type:String},
141
+ recordedAt:{type:Date, default:Date.now}
142
+ }],
143
+ advanceInvoice:{
144
+ type:Boolean,
145
+ default:false
146
+ },
147
+ tempIndex:{ type:Number },
148
+ advancePeriod:{ type:String },
149
+ advanceMonths:{ type:Number },
150
+ },{
151
+ strict: true,
152
+ versionKey: false,
153
+ timestamps: true,
154
+ }
155
+ )
156
+
157
157
  export default mongoose.model('invoice', invoiceSchema);
@@ -1,61 +1,61 @@
1
- import mongoose from 'mongoose';
2
-
3
- const paymentAccountSchema = new mongoose.Schema(
4
- {
5
- clientId: {
6
- type: String,
7
- required: true,
8
- unique: true,
9
- },
10
- customerId:{
11
- type: String,
12
- required: true,
13
- unique: true,
14
- },
15
- virtualAccId:{
16
- type: String,
17
- required: true,
18
- unique: true,
19
- },
20
- bankAccId:{
21
- type: String,
22
- required: true,
23
- unique: true,
24
- },
25
- accountNumber:{
26
- type: String,
27
- required: true,
28
- unique: true,
29
- },
30
- paymentType:{
31
- type: String,
32
- },
33
- status:{
34
- type: String,
35
- },
36
- ifsc: {
37
- type: String,
38
- },
39
- swiftCode:{
40
- type: String,
41
- },
42
- branch:{
43
- type: String,
44
- },
45
- credit:{
46
- type: Number,
47
- default:0
48
- },
49
- currency: {
50
- type: String,
51
- enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
52
- },
53
- },
54
- {
55
- strict: true,
56
- versionKey: false,
57
- timestamps: true,
58
- },
59
- );
60
-
1
+ import mongoose from 'mongoose';
2
+
3
+ const paymentAccountSchema = new mongoose.Schema(
4
+ {
5
+ clientId: {
6
+ type: String,
7
+ required: true,
8
+ unique: true,
9
+ },
10
+ customerId:{
11
+ type: String,
12
+ required: true,
13
+ unique: true,
14
+ },
15
+ virtualAccId:{
16
+ type: String,
17
+ required: true,
18
+ unique: true,
19
+ },
20
+ bankAccId:{
21
+ type: String,
22
+ required: true,
23
+ unique: true,
24
+ },
25
+ accountNumber:{
26
+ type: String,
27
+ required: true,
28
+ unique: true,
29
+ },
30
+ paymentType:{
31
+ type: String,
32
+ },
33
+ status:{
34
+ type: String,
35
+ },
36
+ ifsc: {
37
+ type: String,
38
+ },
39
+ swiftCode:{
40
+ type: String,
41
+ },
42
+ branch:{
43
+ type: String,
44
+ },
45
+ credit:{
46
+ type: Number,
47
+ default:0
48
+ },
49
+ currency: {
50
+ type: String,
51
+ enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
52
+ },
53
+ },
54
+ {
55
+ strict: true,
56
+ versionKey: false,
57
+ timestamps: true,
58
+ },
59
+ );
60
+
61
61
  export default mongoose.model( 'paymentAccount', paymentAccountSchema);