tango-api-schema 2.6.35 → 2.6.37

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-api-schema",
3
- "version": "2.6.35",
3
+ "version": "2.6.37",
4
4
  "description": "tangoEye model schema",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -30,6 +30,13 @@ let pricingSchema = new mongoose.Schema(
30
30
  },
31
31
  groupName:{
32
32
  type:String
33
+ },
34
+ // Price type (standard/step) for THIS doc. For group-wise pricing each
35
+ // group can have its own price type; the brand-level doc may leave it
36
+ // unset (falls back to the client's priceType).
37
+ priceType:{
38
+ type:String,
39
+ enum:['standard','step']
33
40
  }
34
41
  },
35
42
  {
@@ -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 );