@francesco_ksh/app-ksh-mgd-schemas 1.1.0
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 +1 -0
- package/index.js +73 -0
- package/models/AdminReview.js +31 -0
- package/models/Article.js +44 -0
- package/models/Brand.js +23 -0
- package/models/CSVUpload.js +28 -0
- package/models/Carrier.js +114 -0
- package/models/CarrierPortalOrder.js +158 -0
- package/models/Chat.js +92 -0
- package/models/ChatMessages.js +64 -0
- package/models/Comment.js +60 -0
- package/models/ConsignmentListing.js +89 -0
- package/models/Counter.js +15 -0
- package/models/CrossListing.js +24 -0
- package/models/Discount.js +105 -0
- package/models/Error.js +21 -0
- package/models/Etsy.js +112 -0
- package/models/ExploreCard.js +168 -0
- package/models/Feedback.js +30 -0
- package/models/Listing.js +414 -0
- package/models/MarketplaceUpdates.js +895 -0
- package/models/MissingLocations.js +23 -0
- package/models/MktModel.js +40 -0
- package/models/Notification.js +68 -0
- package/models/Offer.js +60 -0
- package/models/Order.js +555 -0
- package/models/OrderReview.js +75 -0
- package/models/Promo.js +56 -0
- package/models/RemovedListing.js +21 -0
- package/models/ShopifyApi.js +151 -0
- package/models/Store.js +519 -0
- package/models/Synonyms.js +20 -0
- package/models/Test.js +29 -0
- package/models/TopPicks.js +15 -0
- package/models/User.js +476 -0
- package/models/WoocommerceApi.js +81 -0
- package/models/XCartApi.js +38 -0
- package/package.json +25 -0
- package/utils/furnitureCategoryList.js +69 -0
- package/utils/getSchemaDefinition.js +650 -0
- package/utils/getTaxonomy.js +30 -0
- package/utils/schemaTypes.js +44680 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
const moment = require('moment');
|
|
4
|
+
const consignmentListingSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
items: [
|
|
7
|
+
{
|
|
8
|
+
images: {
|
|
9
|
+
type: Array,
|
|
10
|
+
},
|
|
11
|
+
brand: {
|
|
12
|
+
type: String,
|
|
13
|
+
},
|
|
14
|
+
retailLink: {
|
|
15
|
+
type: String,
|
|
16
|
+
},
|
|
17
|
+
otherInfo: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
author: {
|
|
24
|
+
type: Schema.Types.ObjectId,
|
|
25
|
+
ref: 'User',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
contact: {
|
|
29
|
+
email: {
|
|
30
|
+
type: String,
|
|
31
|
+
},
|
|
32
|
+
phone: {
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
firstName: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
pickup: {
|
|
41
|
+
address: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
stairs: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
},
|
|
47
|
+
elevator: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
},
|
|
50
|
+
flights: {
|
|
51
|
+
type: Number,
|
|
52
|
+
},
|
|
53
|
+
otherInfo: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
coordinates: {
|
|
57
|
+
type: [Number],
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
acceptedBy: {
|
|
62
|
+
type: Schema.Types.ObjectId,
|
|
63
|
+
ref: 'User',
|
|
64
|
+
},
|
|
65
|
+
declined: [
|
|
66
|
+
{
|
|
67
|
+
type: Schema.Types.ObjectId,
|
|
68
|
+
ref: 'User',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
status: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: 'sent',
|
|
74
|
+
},
|
|
75
|
+
date: {
|
|
76
|
+
type: Date,
|
|
77
|
+
default: Date.now,
|
|
78
|
+
},
|
|
79
|
+
expiration: {
|
|
80
|
+
type: Date,
|
|
81
|
+
default: moment().add(7, 'days'),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{ supressReservedKeysWarning: true }
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
consignmentListingSchema.index({ '$**': 'text' });
|
|
88
|
+
|
|
89
|
+
module.exports = consignmentListingSchema;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const counterSchema = new Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
count: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 0,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
module.exports = counterSchema;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const crossListingSchema = new Schema({
|
|
5
|
+
BA: {
|
|
6
|
+
facebook: {
|
|
7
|
+
listed: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
date: {
|
|
12
|
+
type: Date,
|
|
13
|
+
},
|
|
14
|
+
urls: {
|
|
15
|
+
type: Array,
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
module.exports = crossListingSchema;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const discountSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
createdBy: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
ref: 'User',
|
|
9
|
+
},
|
|
10
|
+
discountMethod: {
|
|
11
|
+
type: String,
|
|
12
|
+
enum: ['automatic', 'code'],
|
|
13
|
+
},
|
|
14
|
+
discountType: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: ['percentage', 'amount'],
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
title: {
|
|
20
|
+
type: String,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
code: {
|
|
24
|
+
type: String,
|
|
25
|
+
unique: true,
|
|
26
|
+
sparse: true,
|
|
27
|
+
required: function () {
|
|
28
|
+
return this.discountMethod === 'code';
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
amount: {
|
|
33
|
+
type: Number,
|
|
34
|
+
},
|
|
35
|
+
appliesTo: {
|
|
36
|
+
type: Array, // products, shipping, packaging
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
listings: [
|
|
40
|
+
{
|
|
41
|
+
type: Schema.Types.ObjectId,
|
|
42
|
+
ref: 'Listing',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
productsAndCategories: {
|
|
46
|
+
type: String, // allProducts, specificProducts, specificCollections
|
|
47
|
+
enum: ['allProducts', 'specificProducts', 'specificCollections'],
|
|
48
|
+
},
|
|
49
|
+
collections: {
|
|
50
|
+
type: Array,
|
|
51
|
+
},
|
|
52
|
+
minOrderValue: {
|
|
53
|
+
isRequired: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
},
|
|
56
|
+
value: {
|
|
57
|
+
type: Number,
|
|
58
|
+
},
|
|
59
|
+
includingShipping: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
eligibility: {
|
|
64
|
+
isSpecific: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
},
|
|
67
|
+
customers: {
|
|
68
|
+
type: Array,
|
|
69
|
+
},
|
|
70
|
+
notification: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
timeFrame: {
|
|
75
|
+
startDate: {
|
|
76
|
+
type: Date,
|
|
77
|
+
},
|
|
78
|
+
endDate: {
|
|
79
|
+
type: Date,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
status: {
|
|
83
|
+
type: String,
|
|
84
|
+
enum: ['active', 'inactive', 'expired', 'scheduled'],
|
|
85
|
+
},
|
|
86
|
+
usedBy: [
|
|
87
|
+
{
|
|
88
|
+
type: Schema.Types.ObjectId,
|
|
89
|
+
ref: 'User',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
isFromAdmin: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
},
|
|
95
|
+
date: {
|
|
96
|
+
type: Date,
|
|
97
|
+
default: Date.now,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{ supressReservedKeysWarning: true }
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
discountSchema.index({ '$**': 'text' });
|
|
104
|
+
|
|
105
|
+
module.exports = discountSchema;
|
package/models/Error.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const errorSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
message: {},
|
|
7
|
+
type: {
|
|
8
|
+
type: String,
|
|
9
|
+
},
|
|
10
|
+
body: {
|
|
11
|
+
type: Object,
|
|
12
|
+
},
|
|
13
|
+
date: {
|
|
14
|
+
type: Date,
|
|
15
|
+
default: Date.now,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{ supressReservedKeysWarning: true }
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
module.exports = errorSchema;
|
package/models/Etsy.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const etsySchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
uploadsPaused: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
},
|
|
9
|
+
shop_id: {
|
|
10
|
+
type: String,
|
|
11
|
+
},
|
|
12
|
+
storeUrl: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
shop_name: {
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
user_id: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
PKCE: {
|
|
22
|
+
codeVerifier: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
codeChallenge: {
|
|
26
|
+
type: String,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
create_date: {
|
|
30
|
+
type: String,
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
currency_code: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
sale_message: {
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
listing_active_count: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
login_name: {
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
url: {
|
|
48
|
+
type: String,
|
|
49
|
+
},
|
|
50
|
+
icon_url_fullxfull: {
|
|
51
|
+
type: String,
|
|
52
|
+
},
|
|
53
|
+
transaction_sold_count: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
shipping_from_country_iso: {
|
|
57
|
+
type: String,
|
|
58
|
+
},
|
|
59
|
+
review_average: {
|
|
60
|
+
type: String,
|
|
61
|
+
},
|
|
62
|
+
requestAuth: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
review_count: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
etsyAuthCode: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
pastUploads: {
|
|
73
|
+
uploading: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
77
|
+
uploads: {
|
|
78
|
+
type: Array,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
etsyTokens: {
|
|
82
|
+
access_token: {
|
|
83
|
+
type: String,
|
|
84
|
+
},
|
|
85
|
+
token_type: {
|
|
86
|
+
type: String,
|
|
87
|
+
},
|
|
88
|
+
refresh_token: {
|
|
89
|
+
type: String,
|
|
90
|
+
},
|
|
91
|
+
expires_in: {
|
|
92
|
+
type: String,
|
|
93
|
+
},
|
|
94
|
+
date: {
|
|
95
|
+
type: Date,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
user: {
|
|
99
|
+
type: Schema.Types.ObjectId,
|
|
100
|
+
ref: 'User',
|
|
101
|
+
required: true,
|
|
102
|
+
},
|
|
103
|
+
type: { type: String, default: 'Etsy' },
|
|
104
|
+
date: {
|
|
105
|
+
type: Date,
|
|
106
|
+
default: Date.now,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{ supressReservedKeysWarning: true }
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
module.exports = etsySchema;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const exploreCardSchema = new Schema({
|
|
5
|
+
date: {
|
|
6
|
+
type: Date,
|
|
7
|
+
default: Date.now,
|
|
8
|
+
},
|
|
9
|
+
instaPostUrl: {
|
|
10
|
+
type: String,
|
|
11
|
+
},
|
|
12
|
+
postImgUrl: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
instaPostDescription: {
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
tags: {
|
|
22
|
+
type: Array,
|
|
23
|
+
},
|
|
24
|
+
metadata: {
|
|
25
|
+
title: {
|
|
26
|
+
type: String,
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
type: String,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
kashewSeller: {
|
|
33
|
+
type: Schema.Types.ObjectId,
|
|
34
|
+
ref: 'User',
|
|
35
|
+
},
|
|
36
|
+
products: [
|
|
37
|
+
{
|
|
38
|
+
productName: {
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
image: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
brand: {
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
designer: {
|
|
48
|
+
type: String,
|
|
49
|
+
},
|
|
50
|
+
countryOfOrigin: {
|
|
51
|
+
type: String,
|
|
52
|
+
},
|
|
53
|
+
manufacturedDate: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
retailPrice: {
|
|
57
|
+
type: String,
|
|
58
|
+
},
|
|
59
|
+
description: {
|
|
60
|
+
type: String,
|
|
61
|
+
},
|
|
62
|
+
metadata: {
|
|
63
|
+
title: {
|
|
64
|
+
type: String,
|
|
65
|
+
},
|
|
66
|
+
description: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
shoppingResults: [
|
|
71
|
+
{
|
|
72
|
+
position: {
|
|
73
|
+
type: Number,
|
|
74
|
+
},
|
|
75
|
+
title: {
|
|
76
|
+
type: String,
|
|
77
|
+
},
|
|
78
|
+
product_link: {
|
|
79
|
+
type: String,
|
|
80
|
+
},
|
|
81
|
+
product_id: {
|
|
82
|
+
type: String,
|
|
83
|
+
},
|
|
84
|
+
serpapi_product_api: {
|
|
85
|
+
type: String,
|
|
86
|
+
},
|
|
87
|
+
immersive_product_page_token: {
|
|
88
|
+
type: String,
|
|
89
|
+
},
|
|
90
|
+
serpapi_immersive_product_api: {
|
|
91
|
+
type: String,
|
|
92
|
+
},
|
|
93
|
+
source: {
|
|
94
|
+
type: String,
|
|
95
|
+
},
|
|
96
|
+
source_icon: {
|
|
97
|
+
type: String,
|
|
98
|
+
},
|
|
99
|
+
price: {
|
|
100
|
+
type: String,
|
|
101
|
+
},
|
|
102
|
+
extracted_price: {
|
|
103
|
+
type: Number,
|
|
104
|
+
},
|
|
105
|
+
old_price: {
|
|
106
|
+
type: String,
|
|
107
|
+
},
|
|
108
|
+
extracted_old_price: {
|
|
109
|
+
type: Number,
|
|
110
|
+
},
|
|
111
|
+
rating: {
|
|
112
|
+
type: Number,
|
|
113
|
+
},
|
|
114
|
+
reviews: {
|
|
115
|
+
type: Number,
|
|
116
|
+
},
|
|
117
|
+
thumbnail: {
|
|
118
|
+
type: String,
|
|
119
|
+
},
|
|
120
|
+
thumbnails: {
|
|
121
|
+
type: Array,
|
|
122
|
+
},
|
|
123
|
+
tag: {
|
|
124
|
+
type: String,
|
|
125
|
+
},
|
|
126
|
+
extensions: {
|
|
127
|
+
type: Array,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
authorInstaProfile: {
|
|
134
|
+
type: String,
|
|
135
|
+
},
|
|
136
|
+
kashewId: {
|
|
137
|
+
type: String,
|
|
138
|
+
unique: true,
|
|
139
|
+
required: false,
|
|
140
|
+
sparse: true,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
exploreCardSchema.pre('save', async function (next) {
|
|
145
|
+
const card = this;
|
|
146
|
+
|
|
147
|
+
// Only generate `kashewId` if it doesn't already exist
|
|
148
|
+
if (!card.kashewId) {
|
|
149
|
+
try {
|
|
150
|
+
// Find the highest existing kashewId and increment it
|
|
151
|
+
const counter = await mongoose.model('Counter').findOneAndUpdate(
|
|
152
|
+
{ name: 'cardKashewId' }, // Counter for kashewId
|
|
153
|
+
{ $inc: { count: 1 } }, // Increment by 1
|
|
154
|
+
{ new: true, upsert: true } // Create if it doesn't exist
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// Format the newId as KSH followed by 5 digits
|
|
158
|
+
card.kashewId = `ksh${counter.count}`;
|
|
159
|
+
next();
|
|
160
|
+
} catch (err) {
|
|
161
|
+
return next(err);
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
next();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
module.exports = exploreCardSchema;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const feedbackSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
type: {
|
|
7
|
+
type: String,
|
|
8
|
+
},
|
|
9
|
+
subject: {
|
|
10
|
+
type: String,
|
|
11
|
+
},
|
|
12
|
+
text: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
rating: {
|
|
16
|
+
type: Number,
|
|
17
|
+
},
|
|
18
|
+
user: {
|
|
19
|
+
type: Schema.Types.ObjectId,
|
|
20
|
+
ref: 'User',
|
|
21
|
+
},
|
|
22
|
+
date: {
|
|
23
|
+
type: Date,
|
|
24
|
+
default: Date.now,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{ supressReservedKeysWarning: true }
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
module.exports = feedbackSchema;
|