@francesco_ksh/app-ksh-mgd-schemas 1.1.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/README.md ADDED
@@ -0,0 +1 @@
1
+ # kashew-schemas
package/index.js ADDED
@@ -0,0 +1,65 @@
1
+ const adminReviewSchema = require('./models/AdminReview');
2
+ const articleSchema = require('./models/Article');
3
+ const brandSchema = require('./models/Brand');
4
+ const carrierSchema = require('./models/Carrier');
5
+ const carrierPortalOrderSchema = require('./models/CarrierPortalOrder');
6
+ const chatSchema = require('./models/Chat');
7
+ const chatMessagesSchema = require('./models/ChatMessages');
8
+ const commentSchema = require('./models/Comment');
9
+ const consignmentListingSchema = require('./models/ConsignmentListing');
10
+ const CSVUploadSchema = require('./models/CSVUpload');
11
+ const errorSchema = require('./models/Error');
12
+ const etsySchema = require('./models/Etsy');
13
+ const feedbackSchema = require('./models/Feedback');
14
+ const listingSchema = require('./models/Listing');
15
+ const marketplaceUpdatesSchema = require('./models/MarketplaceUpdates');
16
+ const missingLocationsSchema = require('./models/MissingLocations');
17
+ const mktModelSchema = require('./models/MktModel');
18
+ const notificationSchema = require('./models/Notification');
19
+ const offerSchema = require('./models/Offer');
20
+ const orderSchema = require('./models/Order');
21
+ const orderReviewSchema = require('./models/OrderReview');
22
+ const promoSchema = require('./models/Promo');
23
+ const removedListingSchema = require('./models/RemovedListing');
24
+ const shopifyApiSchema = require('./models/ShopifyApi');
25
+ const storeSchema = require('./models/Store');
26
+ const synonymsSchema = require('./models/Synonyms');
27
+ const testSchema = require('./models/Test');
28
+ const topPicksSchema = require('./models/TopPicks');
29
+ const userSchema = require('./models/User');
30
+ const woocommerceApiSchema = require('./models/WoocommerceApi');
31
+ const xCartApiSchema = require('./models/XCartApi');
32
+
33
+ module.exports = {
34
+ adminReviewSchema,
35
+ articleSchema,
36
+ brandSchema,
37
+ carrierSchema,
38
+ carrierPortalOrderSchema,
39
+ chatSchema,
40
+ chatMessagesSchema,
41
+ commentSchema,
42
+ consignmentListingSchema,
43
+ CSVUploadSchema,
44
+ errorSchema,
45
+ etsySchema,
46
+ feedbackSchema,
47
+ listingSchema,
48
+ marketplaceUpdatesSchema,
49
+ missingLocationsSchema,
50
+ mktModelSchema,
51
+ notificationSchema,
52
+ offerSchema,
53
+ orderSchema,
54
+ orderReviewSchema,
55
+ promoSchema,
56
+ removedListingSchema,
57
+ shopifyApiSchema,
58
+ storeSchema,
59
+ synonymsSchema,
60
+ testSchema,
61
+ topPicksSchema,
62
+ userSchema,
63
+ woocommerceApiSchema,
64
+ xCartApiSchema,
65
+ };
@@ -0,0 +1,28 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const adminReviewSchema = new Schema({
5
+ authorName: {
6
+ type: String,
7
+ required: true,
8
+ },
9
+ authorDescription: {
10
+ type: String,
11
+ },
12
+ authorReview: {
13
+ type: String,
14
+ },
15
+ picture: {
16
+ type: String,
17
+ },
18
+ rating: {
19
+ type: Number,
20
+ required: true,
21
+ },
22
+ date: {
23
+ type: Date,
24
+ default: Date.now,
25
+ },
26
+ });
27
+
28
+ module.exports = adminReviewSchema;
@@ -0,0 +1,38 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const articlesSchema = new Schema({
5
+ title: {
6
+ type: String,
7
+ },
8
+ picture: {
9
+ type: String,
10
+ },
11
+ content: {
12
+ type: Array,
13
+ },
14
+ author: {
15
+ type: Schema.Types.ObjectId,
16
+ ref: 'User',
17
+ required: true,
18
+ },
19
+ tags: {
20
+ type: Array,
21
+ },
22
+ teaser: {
23
+ type: String,
24
+ },
25
+ views: {
26
+ type: Number,
27
+ default: 20,
28
+ },
29
+ date: {
30
+ type: Date,
31
+ default: Date.now,
32
+ },
33
+ sellerId: {
34
+ type: String,
35
+ },
36
+ });
37
+
38
+ module.exports = articlesSchema;
@@ -0,0 +1,20 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const brandSchema = new Schema({
5
+ brand: {
6
+ type: String,
7
+ },
8
+ link: {
9
+ type: String,
10
+ },
11
+ ranking: {
12
+ type: Number,
13
+ default: 0,
14
+ },
15
+ clones: {
16
+ type: Array,
17
+ },
18
+ });
19
+
20
+ module.exports = brandSchema;
@@ -0,0 +1,25 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const CSVUploadSchema = new Schema({
5
+ data: {
6
+ type: Array,
7
+ },
8
+ user: {
9
+ type: Schema.Types.ObjectId,
10
+ ref: 'User',
11
+ },
12
+ storeId: {
13
+ type: Schema.Types.ObjectId,
14
+ ref: 'Store',
15
+ },
16
+ fileName: {
17
+ type: String,
18
+ },
19
+ date: {
20
+ type: Date,
21
+ default: Date.now,
22
+ },
23
+ });
24
+
25
+ module.exports = CSVUploadSchema;
@@ -0,0 +1,111 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const carrierSchema = new Schema({
5
+ name: {
6
+ type: String,
7
+ required: true,
8
+ },
9
+ email: {
10
+ type: String,
11
+ required: true,
12
+ // unique: true,
13
+ },
14
+ phone: {
15
+ type: String,
16
+ },
17
+ company: {
18
+ type: String,
19
+ },
20
+ picture: {
21
+ type: String,
22
+ },
23
+ driversLicenseBack: {
24
+ type: String,
25
+ },
26
+ driversLicenseFront: {
27
+ type: String,
28
+ },
29
+ headShot: {
30
+ type: String,
31
+ },
32
+ password: {
33
+ type: String,
34
+ required: true,
35
+ },
36
+ isAdmin: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ accountBalance: {
41
+ type: Number,
42
+ default: 0,
43
+ },
44
+ notifications: [
45
+ {
46
+ type: Schema.Types.ObjectId,
47
+ ref: 'Notification',
48
+ },
49
+ ],
50
+ balances: [
51
+ {
52
+ type: {
53
+ type: String,
54
+ },
55
+ order: {
56
+ type: Schema.Types.ObjectId,
57
+ ref: 'Order',
58
+ },
59
+ amount: {
60
+ type: 'Number',
61
+ },
62
+ balance: {
63
+ type: 'Number',
64
+ },
65
+ date: {
66
+ type: Date,
67
+ default: Date.now,
68
+ },
69
+ },
70
+ ],
71
+
72
+ payoutAccounts: {
73
+ venmo: {
74
+ venmoHandle: {
75
+ type: String,
76
+ },
77
+ venmoPhone: {
78
+ type: String,
79
+ },
80
+ },
81
+ payPal: {
82
+ paypalHandle: {
83
+ type: String,
84
+ },
85
+ paypalUserName: {
86
+ type: String,
87
+ },
88
+ },
89
+ bankTransfer: {
90
+ fullName: {
91
+ type: String,
92
+ },
93
+ accountNumber: {
94
+ type: String,
95
+ },
96
+ routingNumber: {
97
+ type: String,
98
+ },
99
+ },
100
+ },
101
+ date: {
102
+ type: Date,
103
+ default: Date.now,
104
+ },
105
+ lastLogin: {
106
+ type: Date,
107
+ default: Date.now,
108
+ },
109
+ });
110
+
111
+ module.exports = carrierSchema;
@@ -0,0 +1,155 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+ const moment = require('moment');
4
+ const carrierPortalOrderSchema = new Schema({
5
+ buyer: {
6
+ type: Schema.Types.ObjectId,
7
+ ref: 'User',
8
+ },
9
+ seller: {
10
+ type: Schema.Types.ObjectId,
11
+ ref: 'User',
12
+ },
13
+ carrier: {
14
+ price: {
15
+ type: Number,
16
+ },
17
+ accepted: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ carrier: {
22
+ type: Schema.Types.ObjectId,
23
+ ref: 'Carrier',
24
+ },
25
+ dropOffDate: {
26
+ type: Date,
27
+ },
28
+ pickupPictures: {
29
+ type: Array,
30
+ },
31
+ dropOffPictures: {
32
+ type: Array,
33
+ },
34
+ questions: [
35
+ {
36
+ question: {
37
+ type: String,
38
+ },
39
+ date: {
40
+ type: Date,
41
+ },
42
+ sender: {
43
+ type: Schema.Types.ObjectId,
44
+ ref: 'Carrier',
45
+ },
46
+ },
47
+ ],
48
+ },
49
+
50
+ approved: {
51
+ type: Boolean,
52
+ },
53
+
54
+ listings: [
55
+ {
56
+ listing: {
57
+ type: Schema.Types.ObjectId,
58
+ ref: 'Listing',
59
+ },
60
+ quantity: {
61
+ type: Number,
62
+ },
63
+ listingPrice: {
64
+ type: Number,
65
+ },
66
+ carrierNotes: {
67
+ type: String,
68
+ },
69
+ },
70
+ ],
71
+ type: {
72
+ type: String,
73
+ },
74
+ deliveryType: {
75
+ type: String,
76
+ },
77
+
78
+ status: {
79
+ type: String,
80
+ },
81
+ delivery: {
82
+ carrier: {
83
+ name: {
84
+ type: String,
85
+ },
86
+ phone: {
87
+ type: String,
88
+ },
89
+ email: {
90
+ type: String,
91
+ },
92
+ },
93
+ trackingLink: {
94
+ type: String,
95
+ },
96
+ bolLink: {
97
+ type: String,
98
+ },
99
+ durationEstimate: {
100
+ type: Object,
101
+ },
102
+ price: {
103
+ type: Number,
104
+ },
105
+ storeDelivers: {
106
+ type: Boolean,
107
+ },
108
+ storeDeliveryCost: {
109
+ type: Number,
110
+ },
111
+ productSKUs: {
112
+ type: String,
113
+ },
114
+
115
+ buyer: {
116
+ address: {
117
+ type: Object,
118
+ },
119
+ location: {
120
+ type: Object,
121
+ },
122
+
123
+ elevator: {
124
+ type: Boolean,
125
+ },
126
+ contact: {
127
+ phone: {
128
+ type: String,
129
+ },
130
+ email: {
131
+ type: String,
132
+ },
133
+ },
134
+ flights: {
135
+ type: String,
136
+ },
137
+ otherInfo: {
138
+ type: String,
139
+ },
140
+ coordinates: {
141
+ type: Object,
142
+ },
143
+ },
144
+ },
145
+ date: {
146
+ type: Date,
147
+ default: Date.now,
148
+ },
149
+ expirationDate: {
150
+ type: Date,
151
+ default: moment().add(3, 'days'),
152
+ },
153
+ });
154
+
155
+ module.exports = carrierPortalOrderSchema;
package/models/Chat.js ADDED
@@ -0,0 +1,89 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const chatSchema = new Schema({
5
+ participants: [
6
+ {
7
+ type: Schema.Types.ObjectId,
8
+ ref: 'User',
9
+ },
10
+ ],
11
+ buyer: {
12
+ type: Schema.Types.ObjectId,
13
+ ref: 'User',
14
+ },
15
+ seller: {
16
+ type: Schema.Types.ObjectId,
17
+ ref: 'User',
18
+ },
19
+
20
+ listing: {
21
+ type: Schema.Types.ObjectId,
22
+ ref: 'Listing',
23
+ },
24
+ listings: [
25
+ {
26
+ listing: {
27
+ type: Schema.Types.ObjectId,
28
+ ref: 'Listing',
29
+ },
30
+ quantity: {
31
+ type: Number,
32
+ },
33
+ listingPrice: {
34
+ type: Number,
35
+ },
36
+
37
+ discount: {
38
+ type: Object,
39
+ },
40
+ },
41
+ ],
42
+ order: {
43
+ type: Schema.Types.ObjectId,
44
+ ref: 'Order',
45
+ },
46
+ messages: [
47
+ {
48
+ type: Schema.Types.ObjectId,
49
+ ref: 'ChatMessages',
50
+ },
51
+ ],
52
+ notification: {
53
+ present: {
54
+ type: Boolean,
55
+ },
56
+ users: [
57
+ {
58
+ type: Schema.Types.ObjectId,
59
+ ref: 'User',
60
+ },
61
+ ],
62
+ },
63
+ pickupCode: {
64
+ type: Number,
65
+ },
66
+ isArchived: {
67
+ type: Boolean,
68
+ default: false,
69
+ },
70
+ hasMessage: {
71
+ type: Boolean,
72
+ default: false,
73
+ },
74
+
75
+ offer: {
76
+ type: Schema.Types.ObjectId,
77
+ ref: 'Offer',
78
+ },
79
+ status: {
80
+ type: String,
81
+ enum: ['active', 'completed', 'deleted'],
82
+ },
83
+ date: {
84
+ type: Date,
85
+ default: Date.now,
86
+ },
87
+ });
88
+
89
+ module.exports = chatSchema;
@@ -0,0 +1,61 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const chatMessagesSchema = new Schema({
5
+ sender: {
6
+ type: Schema.Types.ObjectId,
7
+ ref: 'User',
8
+ },
9
+ text: {
10
+ type: String,
11
+ // required: true,
12
+ },
13
+ seenBy: [
14
+ {
15
+ type: Schema.Types.ObjectId,
16
+ ref: 'User',
17
+ },
18
+ ],
19
+ type: {
20
+ type: String,
21
+ },
22
+ timeslot: [
23
+ {
24
+ beginningTime: {
25
+ type: String,
26
+ },
27
+ endTime: {
28
+ type: String,
29
+ },
30
+ },
31
+ ],
32
+ actionRequired: {
33
+ isRequired: {
34
+ type: Boolean,
35
+ },
36
+ // This could be - 'yes/no' - 'select-timeslot'
37
+
38
+ type: {
39
+ type: String,
40
+ },
41
+ },
42
+ pickupCode: {
43
+ type: Number,
44
+ },
45
+ imageUrl: {
46
+ type: String,
47
+ default: null,
48
+ },
49
+
50
+ offer: {
51
+ type: Schema.Types.ObjectId,
52
+ ref: 'Offer',
53
+ },
54
+
55
+ date: {
56
+ type: Date,
57
+ default: Date.now,
58
+ },
59
+ });
60
+
61
+ module.exports = chatMessagesSchema;
@@ -0,0 +1,57 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const commentSchema = new Schema({
5
+ text: {
6
+ type: String,
7
+ },
8
+ sender: {
9
+ type: Schema.Types.ObjectId,
10
+ ref: 'User',
11
+ },
12
+ listing: {
13
+ type: Schema.Types.ObjectId,
14
+ ref: 'Listing',
15
+ },
16
+
17
+ status: {
18
+ type: String,
19
+ default: 'active',
20
+ },
21
+ date: {
22
+ type: Date,
23
+ },
24
+ replies: [
25
+ {
26
+ text: {
27
+ type: String,
28
+ },
29
+ sender: {
30
+ type: Schema.Types.ObjectId,
31
+ ref: 'User',
32
+ },
33
+
34
+ seen: {
35
+ type: Boolean,
36
+ },
37
+ date: {
38
+ type: Date,
39
+ },
40
+ type: {
41
+ type: String,
42
+ },
43
+ imageUrl: {
44
+ type: String,
45
+ },
46
+ },
47
+ ],
48
+ imageUrl: {
49
+ type: String,
50
+ default: null,
51
+ },
52
+ type: {
53
+ type: String,
54
+ },
55
+ });
56
+
57
+ module.exports = commentSchema;