tango-api-schema 2.6.34 → 2.6.36
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/index.js +2 -0
- package/package.json +1 -1
- package/schema/basePricing.model.js +9 -0
- package/schema/client.model.js +6 -0
- package/schema/invoice.model.js +21 -1
- package/schema/purchaseOrder.model.js +60 -0
package/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import externalParameterModel from "./schema/externalParameter.model.js";
|
|
|
37
37
|
import transactionModel from "./schema/transaction.model.js";
|
|
38
38
|
import estimateModel from "./schema/estimate.model.js";
|
|
39
39
|
import paymentReminderModel from "./schema/paymentReminder.model.js";
|
|
40
|
+
import purchaseOrderModel from "./schema/purchaseOrder.model.js";
|
|
40
41
|
import bankTransactionModel from "./schema/bankTransaction.model.js";
|
|
41
42
|
import dataMismatchDraftModel from "./schema/dataMismatchDraft.model.js";
|
|
42
43
|
import traxAuditDataModel from "./schema/traxAuditData.model.js";
|
|
@@ -172,6 +173,7 @@ export default {
|
|
|
172
173
|
externalParameterModel,
|
|
173
174
|
transactionModel,
|
|
174
175
|
estimateModel,
|
|
176
|
+
purchaseOrderModel,
|
|
175
177
|
paymentReminderModel,
|
|
176
178
|
bankTransactionModel,
|
|
177
179
|
dataMismatchDraftModel,
|
package/package.json
CHANGED
|
@@ -21,6 +21,15 @@ let pricingSchema = new mongoose.Schema(
|
|
|
21
21
|
oneTimeFeePerStore:{
|
|
22
22
|
type:Number,
|
|
23
23
|
default:"200"
|
|
24
|
+
},
|
|
25
|
+
// Billing-group-wise pricing: when a client has billingGroupWisePricing
|
|
26
|
+
// enabled, each billing group has its own basepricing doc keyed by these.
|
|
27
|
+
// Absent (undefined) on the brand-level doc used when the toggle is off.
|
|
28
|
+
groupId:{
|
|
29
|
+
type:String
|
|
30
|
+
},
|
|
31
|
+
groupName:{
|
|
32
|
+
type:String
|
|
24
33
|
}
|
|
25
34
|
},
|
|
26
35
|
{
|
package/schema/client.model.js
CHANGED
|
@@ -747,6 +747,12 @@ const client = new mongoose.Schema(
|
|
|
747
747
|
enum: ['standard', 'step'],
|
|
748
748
|
default: 'standard',
|
|
749
749
|
},
|
|
750
|
+
// When true, pricing is maintained per billing group (separate basepricing
|
|
751
|
+
// docs keyed by groupId) instead of one brand-level pricing set.
|
|
752
|
+
billingGroupWisePricing: {
|
|
753
|
+
type: Boolean,
|
|
754
|
+
default: false,
|
|
755
|
+
},
|
|
750
756
|
virtualAccount: {
|
|
751
757
|
accountNo: {
|
|
752
758
|
type: String
|
package/schema/invoice.model.js
CHANGED
|
@@ -14,8 +14,23 @@ const invoiceSchema = new mongoose.Schema(
|
|
|
14
14
|
stores: {
|
|
15
15
|
type:Number
|
|
16
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
|
+
],
|
|
17
32
|
companyName:{
|
|
18
|
-
type:String,
|
|
33
|
+
type:String,
|
|
19
34
|
},
|
|
20
35
|
monthOfbilling:{
|
|
21
36
|
type:String,
|
|
@@ -86,6 +101,11 @@ const invoiceSchema = new mongoose.Schema(
|
|
|
86
101
|
groupId: {
|
|
87
102
|
type:String
|
|
88
103
|
},
|
|
104
|
+
// Purchase order this invoice is mapped to (reduces the PO's remaining
|
|
105
|
+
// balance). Empty when the invoice isn't tied to a PO.
|
|
106
|
+
purchaseOrderNumber: {
|
|
107
|
+
type:String
|
|
108
|
+
},
|
|
89
109
|
discountAmount: {
|
|
90
110
|
type:Number
|
|
91
111
|
},
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
// Purchase Orders per brand (clientId). totalAmount is the original PO value and
|
|
4
|
+
// never changes; remainingAmount decreases as invoices are mapped to this PO.
|
|
5
|
+
// `usage` keeps an audit trail of which invoices consumed how much.
|
|
6
|
+
const purchaseOrderSchema = new mongoose.Schema(
|
|
7
|
+
{
|
|
8
|
+
clientId: {
|
|
9
|
+
type: String,
|
|
10
|
+
index: true,
|
|
11
|
+
},
|
|
12
|
+
companyName: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
purchaseOrderNumber: {
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
// Original PO value (immutable once created).
|
|
19
|
+
totalAmount: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 0,
|
|
22
|
+
},
|
|
23
|
+
// Decreases as invoices are mapped; starts equal to totalAmount.
|
|
24
|
+
remainingAmount: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 0,
|
|
27
|
+
},
|
|
28
|
+
date: {
|
|
29
|
+
type: Date,
|
|
30
|
+
},
|
|
31
|
+
// Stored S3 path (assets bucket) of the uploaded PO PDF, if any.
|
|
32
|
+
pdfPath: {
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
// open -> partiallyUsed -> fullyUsed (derived from remainingAmount).
|
|
36
|
+
status: {
|
|
37
|
+
type: String,
|
|
38
|
+
enum: [ 'open', 'partiallyUsed', 'fullyUsed' ],
|
|
39
|
+
default: 'open',
|
|
40
|
+
},
|
|
41
|
+
// Invoices that consumed this PO. One entry per mapping.
|
|
42
|
+
usage: [
|
|
43
|
+
{
|
|
44
|
+
invoice: { type: String },
|
|
45
|
+
amount: { type: Number },
|
|
46
|
+
mappedAt: { type: Date },
|
|
47
|
+
mappedBy: { type: String },
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
createdBy: {
|
|
51
|
+
type: String,
|
|
52
|
+
},
|
|
53
|
+
}, {
|
|
54
|
+
strict: true,
|
|
55
|
+
versionKey: false,
|
|
56
|
+
timestamps: true,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export default mongoose.model( 'purchaseorder', purchaseOrderSchema );
|