mypetbook-core 1.1.39 → 1.1.41

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": "mypetbook-core",
3
- "version": "1.1.39",
3
+ "version": "1.1.41",
4
4
  "description": "This contain all the entity model for the mypetbook",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -0,0 +1,62 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const PushNotificationSchema = new mongoose.Schema(
4
+ {
5
+
6
+ createdBy: {
7
+ type: mongoose.Schema.Types.ObjectId,
8
+ ref: 'User',
9
+ },
10
+
11
+ // ManyToMany -> Array of references
12
+ users: [
13
+ {
14
+ type: mongoose.Schema.Types.ObjectId,
15
+ ref: 'User',
16
+ },
17
+ ],
18
+
19
+ title: {
20
+ type: String,
21
+ },
22
+
23
+ message: {
24
+ type: String,
25
+ },
26
+
27
+ attachments: {
28
+ type: String,
29
+ },
30
+
31
+ send: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+
36
+ isRead: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+
41
+ isDeleted: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+
46
+ userExist: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ },
51
+ {
52
+ timestamps: {
53
+ createdAt: 'createdOn',
54
+ updatedAt: 'updatedOn',
55
+ },
56
+ }
57
+ );
58
+
59
+ module.exports = mongoose.model(
60
+ 'PushNotification',
61
+ PushNotificationSchema
62
+ );
@@ -0,0 +1,34 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const SmsTemplateID = {
4
+ Appointment_Confirmation: 'appointment_confirmation',
5
+ Appointment_Reminder: 'appointment_reminder',
6
+ Vaccination_Reminder_Four_Days: 'vaccination_reminder_four_days',
7
+ Vaccination_Reminder_Two_Days: 'vaccination_reminder_two_days',
8
+ Vaccination_Due_Today: 'vaccination_due_today',
9
+ Other_Notification:'other_notification',
10
+ };
11
+
12
+ const SmsNotificationTemplateSchema = new mongoose.Schema(
13
+ {
14
+ title: {
15
+ type: String,
16
+ },
17
+ message: {
18
+ type: String,
19
+ },
20
+ status: {
21
+ type: Boolean,
22
+ default: false,
23
+ },
24
+ templateId: {
25
+ type: String,
26
+ enum: Object.values(SmsTemplateID),
27
+ },
28
+ }
29
+ );
30
+
31
+ module.exports = mongoose.model(
32
+ 'SmsNotificationTemplate',
33
+ SmsNotificationTemplateSchema
34
+ );
@@ -0,0 +1,62 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const SmsNotificationSchema = new mongoose.Schema(
4
+ {
5
+
6
+ createdBy: {
7
+ type: mongoose.Schema.Types.ObjectId,
8
+ ref: 'User',
9
+ },
10
+
11
+ // ManyToMany -> Array of references
12
+ users: [
13
+ {
14
+ type: mongoose.Schema.Types.ObjectId,
15
+ ref: 'User',
16
+ },
17
+ ],
18
+
19
+ title: {
20
+ type: String,
21
+ },
22
+
23
+ message: {
24
+ type: String,
25
+ },
26
+
27
+ attachments: {
28
+ type: String,
29
+ },
30
+
31
+ send: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+
36
+ isRead: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+
41
+ isDeleted: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+
46
+ userExist: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ },
51
+ {
52
+ timestamps: {
53
+ createdAt: 'createdOn',
54
+ updatedAt: 'updatedOn',
55
+ },
56
+ }
57
+ );
58
+
59
+ module.exports = mongoose.model(
60
+ 'SmsNotification',
61
+ SmsNotificationSchema
62
+ );
@@ -0,0 +1,30 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const PushTemplateID = {
4
+ Appointment_Reminder: 'appointment_reminder',
5
+ Vaccination_Due_Today: 'vaccination_due_today'
6
+ };
7
+
8
+ const PushNotificationTemplateSchema = new mongoose.Schema(
9
+ {
10
+ title: {
11
+ type: String,
12
+ },
13
+ message: {
14
+ type: String,
15
+ },
16
+ status: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ templateId: {
21
+ type: String,
22
+ enum: Object.values(PushTemplateID),
23
+ },
24
+ }
25
+ );
26
+
27
+ module.exports = mongoose.model(
28
+ 'PushNotificationTemplate',
29
+ PushNotificationTemplateSchema
30
+ );
@@ -38,10 +38,13 @@ const treatmentSchema = new Schema({
38
38
  paymentMethod: {
39
39
  type: String,
40
40
  index: true,
41
- enum: PaymentMethodEnum
41
+ enum: PaymentMethodEnum,
42
+ default: PaymentMethod.Cash,
43
+ required: true
42
44
  },
43
45
  treatmentStart: { type: String, default: new Date().toLocaleTimeString() },
44
46
  treatmentDone: { type: Date },
47
+ extraDiscount: { type: Number, default: 0 },
45
48
  appointment: {
46
49
  type:mongoose.Schema.ObjectId,
47
50
  ref: "Appointment",
@@ -71,7 +74,7 @@ const treatmentSchema = new Schema({
71
74
  totalDiscount = totalDiscount+ ti.discount_amount;
72
75
  }
73
76
 
74
- return totalDiscount;
77
+ return totalDiscount + (this.extraDiscount || 0);
75
78
  },
76
79
  },
77
80
  },