payservedb 8.0.5 → 8.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "8.0.5",
3
+ "version": "8.0.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -14,22 +14,19 @@ const CampaignSchema = new mongoose.Schema({
14
14
  },
15
15
  objective: {
16
16
  type: String,
17
- enum: ['Brand Awareness', 'Lead Generation', 'Sales', 'Engagement'],
18
- required: true
17
+ required: true,
18
+ enum: ['Brand Awareness', 'Lead Generation', 'Sales', 'Engagement']
19
19
  },
20
- startDate: {
21
- type: Date,
22
- required: true
20
+ description: {
21
+ type: String,
22
+ trim: true,
23
+ maxlength: 500
23
24
  },
24
- endDate: {
25
- type: Date,
25
+ campaignType: {
26
+ type: String,
26
27
  required: true,
27
- validate: {
28
- validator: function (value) {
29
- return this.startDate <= value;
30
- },
31
- message: 'End date must be after or equal to start date'
32
- }
28
+ enum: ['immediate', 'scheduled', 'recurring'],
29
+ default: 'immediate'
33
30
  },
34
31
  targetAudience: {
35
32
  type: String,
@@ -46,32 +43,54 @@ const CampaignSchema = new mongoose.Schema({
46
43
  type: mongoose.Schema.Types.ObjectId,
47
44
  ref: 'User'
48
45
  },
49
- sentVia: [String], // e.g., ['SMS', 'Email']
46
+ sentVia: [String],
50
47
  }
51
48
  ],
49
+ emailSubject: {
50
+ type: String
51
+ },
52
52
  message: {
53
53
  type: String,
54
54
  required: true,
55
+ maxlength: 1000
55
56
  },
56
57
  channels: {
57
58
  type: [String],
58
- enum: ['SMS', 'Email'],
59
+ enum: ['SMS', 'Email', 'WhatsApp'],
59
60
  required: true,
60
- validate: {
61
- validator: function (value) {
62
- return value && value.length > 0;
63
- },
64
- message: 'At least one channel must be selected'
65
- }
66
61
  },
62
+ scheduleDate: {
63
+ type: String
64
+ },
65
+ scheduleTime: {
66
+ type: String
67
+ },
68
+ scheduledDateTime: {
69
+ type: Date
70
+ },
71
+ scheduledDates: [{
72
+ date: {
73
+ type: String,
74
+ required: true
75
+ },
76
+ time: {
77
+ type: String,
78
+ required: true
79
+ },
80
+ scheduledDateTime: {
81
+ type: Date,
82
+ required: true
83
+ },
84
+ status: {
85
+ type: String,
86
+ enum: ['Pending', 'Completed', 'Failed'],
87
+ default: 'Pending'
88
+ },
89
+ }],
67
90
  status: {
68
91
  type: String,
69
- enum: ['Draft', 'Ongoing', 'Completed'],
70
- default: 'Draft'
71
- }, description: {
72
- type: String,
73
- trim: true,
74
- maxlength: 500
92
+ enum: ['Pending', 'Processing', 'Scheduled', 'Completed',],
93
+ default: 'Pending'
75
94
  },
76
95
  createdAt: {
77
96
  type: Date,
@@ -85,11 +104,6 @@ const CampaignSchema = new mongoose.Schema({
85
104
  timestamps: true
86
105
  });
87
106
 
88
- // Ensure at least one channel is selected
89
- CampaignSchema.path('channels').validate(function (value) {
90
- return value.length > 0;
91
- }, 'At least one channel must be selected');
92
-
93
107
  const Campaign = mongoose.model('Campaign', CampaignSchema);
94
108
 
95
109
  module.exports = Campaign;