payservedb 8.0.5 → 8.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "8.0.5",
3
+ "version": "8.0.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -14,16 +14,25 @@ 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
+ },
20
+ description: {
21
+ type: String,
22
+ trim: true,
23
+ maxlength: 500
24
+ },
25
+ campaignType: {
26
+ type: String,
27
+ required: true,
28
+ enum: ['immediate', 'scheduled', 'recurring'],
29
+ default: 'immediate'
19
30
  },
20
31
  startDate: {
21
32
  type: Date,
22
- required: true
23
33
  },
24
34
  endDate: {
25
35
  type: Date,
26
- required: true,
27
36
  validate: {
28
37
  validator: function (value) {
29
38
  return this.startDate <= value;
@@ -46,32 +55,54 @@ const CampaignSchema = new mongoose.Schema({
46
55
  type: mongoose.Schema.Types.ObjectId,
47
56
  ref: 'User'
48
57
  },
49
- sentVia: [String], // e.g., ['SMS', 'Email']
58
+ sentVia: [String],
50
59
  }
51
60
  ],
61
+ emailSubject: {
62
+ type: String
63
+ },
52
64
  message: {
53
65
  type: String,
54
66
  required: true,
67
+ maxlength: 1000
55
68
  },
56
69
  channels: {
57
70
  type: [String],
58
- enum: ['SMS', 'Email'],
71
+ enum: ['SMS', 'Email', 'WhatsApp'],
59
72
  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
73
  },
74
+ scheduleDate: {
75
+ type: String
76
+ },
77
+ scheduleTime: {
78
+ type: String
79
+ },
80
+ scheduledDateTime: {
81
+ type: Date
82
+ },
83
+ scheduledDates: [{
84
+ date: {
85
+ type: String,
86
+ required: true
87
+ },
88
+ time: {
89
+ type: String,
90
+ required: true
91
+ },
92
+ scheduledDateTime: {
93
+ type: Date,
94
+ required: true
95
+ },
96
+ status: {
97
+ type: String,
98
+ enum: ['Pending', 'Completed', 'Failed'],
99
+ default: 'Pending'
100
+ },
101
+ }],
67
102
  status: {
68
103
  type: String,
69
- enum: ['Draft', 'Ongoing', 'Completed'],
70
- default: 'Draft'
71
- }, description: {
72
- type: String,
73
- trim: true,
74
- maxlength: 500
104
+ enum: ['Pending', 'Processing', 'Scheduled', 'Completed',],
105
+ default: 'Pending'
75
106
  },
76
107
  createdAt: {
77
108
  type: Date,
@@ -85,11 +116,6 @@ const CampaignSchema = new mongoose.Schema({
85
116
  timestamps: true
86
117
  });
87
118
 
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
119
  const Campaign = mongoose.model('Campaign', CampaignSchema);
94
120
 
95
121
  module.exports = Campaign;