@francesco_ksh/app-ksh-mgd-schemas 2.4.4 → 2.4.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/index.js +2 -1
- package/models/Claim.js +122 -0
- package/models/Order.js +6 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -35,7 +35,7 @@ const crossListingSchema = require('./models/CrossListing');
|
|
|
35
35
|
const exploreCardSchema = require('./models/ExploreCard');
|
|
36
36
|
const bonusSchema = require('./models/Bonus');
|
|
37
37
|
const payoutContactSchema = require('./models/PayoutContact');
|
|
38
|
-
|
|
38
|
+
const claimSchema = require('./models/Claim');
|
|
39
39
|
// Register Counter model so it's available when User.js and other models try to use it
|
|
40
40
|
const mongoose = require('mongoose');
|
|
41
41
|
if (!mongoose.models.Counter) {
|
|
@@ -80,4 +80,5 @@ module.exports = {
|
|
|
80
80
|
exploreCardSchema,
|
|
81
81
|
bonusSchema,
|
|
82
82
|
payoutContactSchema,
|
|
83
|
+
claimSchema,
|
|
83
84
|
};
|
package/models/Claim.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const ISSUE_TYPES = [
|
|
5
|
+
'Damaged item',
|
|
6
|
+
'Wrong item received',
|
|
7
|
+
'Missing item',
|
|
8
|
+
'Item not as described',
|
|
9
|
+
'Other',
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const ITEM_CONDITIONS = [
|
|
13
|
+
'Severely damaged',
|
|
14
|
+
'Moderately damaged',
|
|
15
|
+
'Slightly damaged',
|
|
16
|
+
'Not as described',
|
|
17
|
+
'Missing parts',
|
|
18
|
+
'Not applicable',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const PACKAGING_OPTIONS = [
|
|
22
|
+
'Yes, properly packaged',
|
|
23
|
+
'No, packaging was damaged',
|
|
24
|
+
'No, item was not packaged',
|
|
25
|
+
'Not sure',
|
|
26
|
+
'Not applicable',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const RESOLUTION_OPTIONS = [
|
|
30
|
+
'Return item and get a refund (can take 2-4 weeks to get it picked up)',
|
|
31
|
+
"Keep the item and get a partial refund (up to 80% of the item's value)",
|
|
32
|
+
'Keep the item and get a store credit (up to 90% of the order value)',
|
|
33
|
+
'Return the item to the seller and get it replaced with a new / correct item',
|
|
34
|
+
'Not sure, I want to hear what resolution I will be offered',
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const claimSchema = new Schema(
|
|
38
|
+
{
|
|
39
|
+
order: {
|
|
40
|
+
type: Schema.Types.ObjectId,
|
|
41
|
+
ref: 'Order',
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
user: {
|
|
45
|
+
type: Schema.Types.ObjectId,
|
|
46
|
+
ref: 'User',
|
|
47
|
+
},
|
|
48
|
+
issueDescription: {
|
|
49
|
+
type: String,
|
|
50
|
+
required: true,
|
|
51
|
+
minlength: 100,
|
|
52
|
+
},
|
|
53
|
+
issueDate: {
|
|
54
|
+
type: Date,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
issueType: {
|
|
58
|
+
type: String,
|
|
59
|
+
// enum: ISSUE_TYPES,
|
|
60
|
+
required: true,
|
|
61
|
+
},
|
|
62
|
+
photos: [
|
|
63
|
+
{
|
|
64
|
+
type: String,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
itemCondition: {
|
|
68
|
+
type: String,
|
|
69
|
+
// enum: ITEM_CONDITIONS,
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
72
|
+
packaging: {
|
|
73
|
+
type: String,
|
|
74
|
+
// enum: PACKAGING_OPTIONS,
|
|
75
|
+
required: true,
|
|
76
|
+
},
|
|
77
|
+
packagingDetails: {
|
|
78
|
+
type: String,
|
|
79
|
+
},
|
|
80
|
+
offPlatformChat: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
offPlatformChatDetails: {
|
|
85
|
+
type: String,
|
|
86
|
+
},
|
|
87
|
+
offPlatformEvidence: [
|
|
88
|
+
{
|
|
89
|
+
type: String,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
preferredResolution: {
|
|
93
|
+
type: String,
|
|
94
|
+
// enum: RESOLUTION_OPTIONS,
|
|
95
|
+
required: true,
|
|
96
|
+
},
|
|
97
|
+
additionalDetails: {
|
|
98
|
+
type: String,
|
|
99
|
+
},
|
|
100
|
+
status: {
|
|
101
|
+
type: String,
|
|
102
|
+
enum: ['under_review', 'resolved', 'rejected', 'cancelled'],
|
|
103
|
+
default: 'under_review',
|
|
104
|
+
},
|
|
105
|
+
resolution: {
|
|
106
|
+
type: String,
|
|
107
|
+
},
|
|
108
|
+
resolvedAt: {
|
|
109
|
+
type: Date,
|
|
110
|
+
},
|
|
111
|
+
reviewedBy: {
|
|
112
|
+
type: Schema.Types.ObjectId,
|
|
113
|
+
ref: 'User',
|
|
114
|
+
},
|
|
115
|
+
notes: {
|
|
116
|
+
type: String,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{ timestamps: true }
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
module.exports = mongoose.model('Claim', claimSchema);
|
package/models/Order.js
CHANGED