database-connector 2.2.6 → 2.2.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/models/Payment.js CHANGED
@@ -7,8 +7,6 @@ const mongoose = require('mongoose');
7
7
  * Payment:
8
8
  * type: object
9
9
  * required:
10
- * - userId
11
- * - sellerId
12
10
  * - gateway
13
11
  * - paymentStatus
14
12
  * - paymentAmount
@@ -21,12 +19,14 @@ const mongoose = require('mongoose');
21
19
  * id:
22
20
  * type: string
23
21
  * description: The payment identifier
24
- * userId:
22
+ * creatorId:
25
23
  * type: string
26
- * description: Reference to the user
27
- * sellerId:
24
+ * nullable: true
25
+ * description: Reference to the payment creator (user)
26
+ * ownerId:
28
27
  * type: string
29
- * description: Reference to the seller
28
+ * nullable: true
29
+ * description: Reference to the payment owner
30
30
  * gateway:
31
31
  * type: string
32
32
  * description: Payment gateway used
@@ -66,8 +66,8 @@ const mongoose = require('mongoose');
66
66
  * format: date-time
67
67
  * example:
68
68
  * id: "507f1f77bcf86cd799439011"
69
- * userId: "507f1f77bcf86cd799439012"
70
- * sellerId: "507f1f77bcf86cd799439013"
69
+ * creatorId: "507f1f77bcf86cd799439012"
70
+ * ownerId: "507f1f77bcf86cd799439013"
71
71
  * gateway: "Stripe"
72
72
  * paymentStatus: "succeeded"
73
73
  * paymentAmount: 150.00
@@ -79,14 +79,16 @@ const mongoose = require('mongoose');
79
79
  */
80
80
  const paymentSchema = new mongoose.Schema(
81
81
  {
82
- userId: {
82
+ creatorId: {
83
83
  type: mongoose.Schema.Types.ObjectId,
84
- required: true,
84
+ required: false,
85
+ default: null,
85
86
  ref: 'User',
86
87
  },
87
- sellerId: {
88
+ ownerId: {
88
89
  type: mongoose.Schema.Types.ObjectId,
89
- required: true,
90
+ required: false,
91
+ default: null,
90
92
  ref: 'User',
91
93
  },
92
94
  gateway: {
@@ -144,8 +146,8 @@ const paymentSchema = new mongoose.Schema(
144
146
  );
145
147
 
146
148
  // Indexes for performance optimization
147
- paymentSchema.index({ userId: 1, createdAt: -1 });
148
- paymentSchema.index({ sellerId: 1, createdAt: -1 });
149
+ paymentSchema.index({ creatorId: 1, createdAt: -1 });
150
+ paymentSchema.index({ ownerId: 1, createdAt: -1 });
149
151
  paymentSchema.index({ paymentStatus: 1 });
150
152
  paymentSchema.index({ token: 1 });
151
153
  paymentSchema.index({ gateway: 1 });
package/models/Product.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const mongoose = require('mongoose');
2
2
  const { policySchema } = require('database-connector/models/Policy');
3
- const { getBaseURL, getDefaultImagePath } = require('../config');
3
+ // const { getBaseURL, getDefaultImagePath } = require('../config');
4
4
 
5
5
  /**
6
6
  * @swagger
package/models/Store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const mongoose = require('mongoose');
2
2
  const { policySchema } = require('database-connector/models/Policy');
3
- const { getBaseURL, getDefaultStoreImagePath } = require('../config');
3
+ // const { getBaseURL, getDefaultStoreImagePath } = require('../config');
4
4
 
5
5
  /**
6
6
  * @swagger
@@ -374,6 +374,11 @@ const storeSchema = new mongoose.Schema(
374
374
  },
375
375
  },
376
376
  ],
377
+ qrCode: {
378
+ type: String,
379
+ required: false,
380
+ description: 'QR Code associated with the store',
381
+ },
377
382
  },
378
383
 
379
384
  { timestamps: true, toJSON: { virtuals: true } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "MongoDB models package with Mongoose schemas for e-commerce applications. Includes User, Product, Store, Order and more with built-in validation and virtual properties.",
5
5
  "main": "models/index.js",
6
6
  "scripts": {