database-connector 2.2.5 → 2.2.6

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.
@@ -0,0 +1,73 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ /**
4
+ * @swagger
5
+ * components:
6
+ * schemas:
7
+ * Advertisement:
8
+ * type: object
9
+ * required:
10
+ * - sellerId
11
+ * - storeId
12
+ * - productId
13
+ * - image
14
+ * properties:
15
+ * id:
16
+ * type: string
17
+ * description: The advertisement identifier
18
+ * sellerId:
19
+ * type: string
20
+ * description: Reference to seller
21
+ * storeId:
22
+ * type: string
23
+ * description: Reference to store
24
+ * productId:
25
+ * type: string
26
+ * description: Reference to product
27
+ * image:
28
+ * type: string
29
+ * description: Advertisement image (URL or path)
30
+ * confirmed:
31
+ * type: boolean
32
+ * default: false
33
+ * description: Whether the advertisement is approved by a manager
34
+ * createdAt:
35
+ * type: string
36
+ * format: date-time
37
+ * updatedAt:
38
+ * type: string
39
+ * format: date-time
40
+ */
41
+ const advertisementSchema = new mongoose.Schema(
42
+ {
43
+ sellerId: {
44
+ type: mongoose.Schema.Types.ObjectId,
45
+ ref: 'User',
46
+ required: true,
47
+ },
48
+ storeId: {
49
+ type: mongoose.Schema.Types.ObjectId,
50
+ ref: 'Store',
51
+ required: true,
52
+ },
53
+ productId: {
54
+ type: mongoose.Schema.Types.ObjectId,
55
+ ref: 'Product',
56
+ required: true,
57
+ },
58
+ image: {
59
+ type: String,
60
+ required: true,
61
+ },
62
+ confirmed: {
63
+ type: Boolean,
64
+ default: false,
65
+ required: true,
66
+ },
67
+ },
68
+ {
69
+ timestamps: true,
70
+ }
71
+ );
72
+
73
+ module.exports = mongoose.model('Advertisement', advertisementSchema);
package/models/index.js CHANGED
@@ -40,6 +40,7 @@ const ReductionOffer = require('./ReductionOffer');
40
40
  const Sale = require('./Sale');
41
41
  const StoreCategory = require('./StoreCategory');
42
42
  const UserAction = require('./UserAction.js');
43
+ const Advertisement = require('./Advertisement');
43
44
 
44
45
 
45
46
  module.exports = {
@@ -71,5 +72,6 @@ module.exports = {
71
72
  Plan,
72
73
  SubscriptionOffer,
73
74
  UserAction,
75
+ Advertisement,
74
76
  ObjectId: mongoose.Types.ObjectId,
75
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
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": {