Skip to content

Commit ce0f6e7

Browse files
committed
Add listing seed data
1 parent 1926c32 commit ce0f6e7

File tree

4 files changed

+328
-42
lines changed

4 files changed

+328
-42
lines changed

cmd/seed/seedData/listing.json

+308
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
[
2+
{
3+
"title": "Wireless Earbuds",
4+
"description": "High-quality wireless earbuds with noise-cancellation feature.",
5+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
6+
"categories": ["Electronics"],
7+
"price": 49.99,
8+
"platform": "Amazon",
9+
"purchaseUrl": "https://www.amazon.com/wireless-earbuds",
10+
"isAvailable": true,
11+
"createdAt": "2023-08-07T08:00:00Z",
12+
"updatedAt": "2023-08-07T08:00:00Z"
13+
},
14+
{
15+
"title": "Smartphone Camera Lens Kit",
16+
"description": "Professional smartphone camera lens kit for capturing stunning photos.",
17+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
18+
"categories": ["Electronics"],
19+
"price": 39.99,
20+
"platform": "Amazon",
21+
"purchaseUrl": "https://www.amazon.com/smartphone-camera-lens-kit",
22+
"isAvailable": true,
23+
"createdAt": "2023-08-07T08:00:01Z",
24+
"updatedAt": "2023-08-07T08:00:01Z"
25+
},
26+
27+
{
28+
"title": "Indoor Plant Collection",
29+
"description": "Set of three beautiful indoor plants to brighten up your home.",
30+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
31+
"categories": ["Home & Garden"],
32+
"price": 59.99,
33+
"platform": "Etsy",
34+
"purchaseUrl": "https://www.etsy.com/indoor-plant-collection",
35+
"isAvailable": true,
36+
"createdAt": "2023-08-07T08:00:02Z",
37+
"updatedAt": "2023-08-07T08:00:02Z"
38+
},
39+
{
40+
"title": "Scented Soy Candles Set",
41+
"description": "Hand-poured scented soy candles in various delightful fragrances.",
42+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
43+
"categories": ["Home & Garden"],
44+
"price": 24.99,
45+
"platform": "Etsy",
46+
"purchaseUrl": "https://www.etsy.com/scented-soy-candles-set",
47+
"isAvailable": true,
48+
"createdAt": "2023-08-07T08:00:03Z",
49+
"updatedAt": "2023-08-07T08:00:03Z"
50+
},
51+
52+
{
53+
"title": "Men's Leather Wallet",
54+
"description": "Elegant and durable leather wallet for men.",
55+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
56+
"categories": ["Fashion"],
57+
"price": 29.99,
58+
"platform": "Amazon",
59+
"purchaseUrl": "https://www.amazon.com/mens-leather-wallet",
60+
"isAvailable": true,
61+
"createdAt": "2023-08-07T08:00:04Z",
62+
"updatedAt": "2023-08-07T08:00:04Z"
63+
},
64+
{
65+
"title": "Women's Fashion Watch",
66+
"description": "Stylish and sophisticated watch for women.",
67+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
68+
"categories": ["Fashion"],
69+
"price": 39.99,
70+
"platform": "Amazon",
71+
"purchaseUrl": "https://www.amazon.com/womens-fashion-watch",
72+
"isAvailable": true,
73+
"createdAt": "2023-08-07T08:00:05Z",
74+
"updatedAt": "2023-08-07T08:00:05Z"
75+
},
76+
77+
{
78+
"title": "LEGO Classic Creative Box",
79+
"description": "Build and create with this versatile LEGO Classic set.",
80+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
81+
"categories": ["Toys & Hobbies"],
82+
"price": 34.99,
83+
"platform": "Amazon",
84+
"purchaseUrl": "https://www.amazon.com/lego-creative-box",
85+
"isAvailable": true,
86+
"createdAt": "2023-08-07T08:00:06Z",
87+
"updatedAt": "2023-08-07T08:00:06Z"
88+
},
89+
{
90+
"title": "Board Game Collection",
91+
"description": "Assortment of popular board games for family fun.",
92+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
93+
"categories": ["Toys & Hobbies"],
94+
"price": 49.99,
95+
"platform": "Amazon",
96+
"purchaseUrl": "https://www.amazon.com/board-game-collection",
97+
"isAvailable": true,
98+
"createdAt": "2023-08-07T08:00:07Z",
99+
"updatedAt": "2023-08-07T08:00:07Z"
100+
},
101+
102+
{
103+
"title": "Fitness Tracker",
104+
"description": "Advanced fitness tracker to monitor your activity and health.",
105+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
106+
"categories": ["Sporting Goods"],
107+
"price": 79.99,
108+
"platform": "Amazon",
109+
"purchaseUrl": "https://www.amazon.com/fitness-tracker",
110+
"isAvailable": true,
111+
"createdAt": "2023-08-07T08:00:08Z",
112+
"updatedAt": "2023-08-07T08:00:08Z"
113+
},
114+
{
115+
"title": "Yoga Mat and Accessories Set",
116+
"description": "Complete yoga set for a serene and balanced practice.",
117+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
118+
"categories": ["Sporting Goods"],
119+
"price": 49.99,
120+
"platform": "Amazon",
121+
"purchaseUrl": "https://www.amazon.com/yoga-mat-accessories-set",
122+
"isAvailable": true,
123+
"createdAt": "2023-08-07T08:00:09Z",
124+
"updatedAt": "2023-08-07T08:00:09Z"
125+
},
126+
127+
{
128+
"title": "Wireless Bluetooth Headphones",
129+
"description": "Premium wireless headphones with excellent sound quality.",
130+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
131+
"categories": ["Electronics", "Sporting Goods"],
132+
"price": 69.99,
133+
"platform": "Amazon",
134+
"purchaseUrl": "https://www.amazon.com/wireless-bluetooth-headphones",
135+
"isAvailable": true,
136+
"createdAt": "2023-08-07T08:00:10Z",
137+
"updatedAt": "2023-08-07T08:00:10Z"
138+
},
139+
{
140+
"title": "Wireless Noise-Canceling Headphones",
141+
"description": "Premium wireless headphones with noise-canceling technology.",
142+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
143+
"categories": ["Electronics", "Fashion"],
144+
"price": 149.99,
145+
"platform": "Amazon",
146+
"purchaseUrl": "https://www.amazon.com/wireless-headphones",
147+
"isAvailable": true,
148+
"createdAt": "2023-08-07T08:00:10Z",
149+
"updatedAt": "2023-08-07T08:00:10Z"
150+
},
151+
{
152+
"title": "Plant Lover's Gift Set",
153+
"description": "A delightful set featuring an indoor plant and scented candles.",
154+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
155+
"categories": ["Home & Garden", "Fashion"],
156+
"price": 69.99,
157+
"platform": "Etsy",
158+
"purchaseUrl": "https://www.etsy.com/plant-lovers-gift-set",
159+
"isAvailable": true,
160+
"createdAt": "2023-08-07T08:00:11Z",
161+
"updatedAt": "2023-08-07T08:00:11Z"
162+
},
163+
{
164+
"title": "Classic Board Game Collection",
165+
"description": "A bundle of classic board games for endless family entertainment.",
166+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
167+
"categories": ["Toys & Hobbies", "Home & Garden"],
168+
"price": 59.99,
169+
"platform": "Amazon",
170+
"purchaseUrl": "https://www.amazon.com/classic-board-games",
171+
"isAvailable": true,
172+
"createdAt": "2023-08-07T08:00:12Z",
173+
"updatedAt": "2023-08-07T08:00:12Z"
174+
},
175+
{
176+
"title": "Outdoor Adventure Gear",
177+
"description": "Get ready for outdoor exploration with this versatile adventure gear kit.",
178+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
179+
"categories": ["Sporting Goods", "Home & Garden"],
180+
"price": 129.99,
181+
"platform": "Amazon",
182+
"purchaseUrl": "https://www.amazon.com/outdoor-adventure-gear",
183+
"isAvailable": true,
184+
"createdAt": "2023-08-07T08:00:13Z",
185+
"updatedAt": "2023-08-07T08:00:13Z"
186+
},
187+
188+
{
189+
"title": "Smart Home Starter Kit",
190+
"description": "Begin your smart home journey with this comprehensive starter kit.",
191+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
192+
"categories": ["Electronics", "Home & Garden"],
193+
"price": 199.99,
194+
"platform": "Amazon",
195+
"purchaseUrl": "https://www.amazon.com/smart-home-starter-kit",
196+
"isAvailable": true,
197+
"createdAt": "2023-08-07T08:00:14Z",
198+
"updatedAt": "2023-08-07T08:00:14Z"
199+
},
200+
{
201+
"title": "Artistic Wall Prints Set",
202+
"description": "Add a touch of creativity to your living space with this set of artistic wall prints.",
203+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
204+
"categories": ["Home & Garden", "Fashion"],
205+
"price": 29.99,
206+
"platform": "Etsy",
207+
"purchaseUrl": "https://www.etsy.com/artistic-wall-prints",
208+
"isAvailable": true,
209+
"createdAt": "2023-08-07T08:00:15Z",
210+
"updatedAt": "2023-08-07T08:00:15Z"
211+
},
212+
{
213+
"title": "Gourmet Chocolate Collection",
214+
"description": "Indulge in the finest gourmet chocolate assortment from around the world.",
215+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
216+
"categories": ["Food & Drink", "Fashion"],
217+
"price": 39.99,
218+
"platform": "Amazon",
219+
"purchaseUrl": "https://www.amazon.com/gourmet-chocolate-collection",
220+
"isAvailable": true,
221+
"createdAt": "2023-08-07T08:00:16Z",
222+
"updatedAt": "2023-08-07T08:00:16Z"
223+
},
224+
{
225+
"title": "DIY Craft Kit",
226+
"description": "Unleash your creativity with this DIY craft kit for hours of fun.",
227+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
228+
"categories": ["Toys & Hobbies", "Home & Garden", "Fashion"],
229+
"price": 19.99,
230+
"platform": "Amazon",
231+
"purchaseUrl": "https://www.amazon.com/diy-craft-kit",
232+
"isAvailable": true,
233+
"createdAt": "2023-08-07T08:00:17Z",
234+
"updatedAt": "2023-08-07T08:00:17Z"
235+
},
236+
{
237+
"title": "Fitness Apparel Bundle",
238+
"description": "Upgrade your workout wardrobe with this bundle of stylish fitness apparel.",
239+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
240+
"categories": ["Fashion", "Sporting Goods"],
241+
"price": 89.99,
242+
"platform": "Amazon",
243+
"purchaseUrl": "https://www.amazon.com/fitness-apparel-bundle",
244+
"isAvailable": true,
245+
"createdAt": "2023-08-07T08:00:18Z",
246+
"updatedAt": "2023-08-07T08:00:18Z"
247+
},
248+
{
249+
"title": "Cooking Essentials Set",
250+
"description": "Equip your kitchen with essential cooking tools and gadgets.",
251+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
252+
"categories": ["Home & Garden", "Food & Drink"],
253+
"price": 49.99,
254+
"platform": "Amazon",
255+
"purchaseUrl": "https://www.amazon.com/cooking-essentials-set",
256+
"isAvailable": true,
257+
"createdAt": "2023-08-07T08:00:19Z",
258+
"updatedAt": "2023-08-07T08:00:19Z"
259+
},
260+
{
261+
"title": "Adventure Travel Backpack",
262+
"description": "Durable and spacious backpack for your adventurous journeys.",
263+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
264+
"categories": ["Fashion", "Sporting Goods", "Travel"],
265+
"price": 79.99,
266+
"platform": "Amazon",
267+
"purchaseUrl": "https://www.amazon.com/adventure-travel-backpack",
268+
"isAvailable": true,
269+
"createdAt": "2023-08-07T08:00:20Z",
270+
"updatedAt": "2023-08-07T08:00:20Z"
271+
},
272+
{
273+
"title": "Educational STEM Toy Set",
274+
"description": "Inspire young minds with this engaging and educational STEM toy set.",
275+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
276+
"categories": ["Toys & Hobbies", "Education"],
277+
"price": 34.99,
278+
"platform": "Amazon",
279+
"purchaseUrl": "https://www.amazon.com/educational-stem-toy-set",
280+
"isAvailable": true,
281+
"createdAt": "2023-08-07T08:00:21Z",
282+
"updatedAt": "2023-08-07T08:00:21Z"
283+
},
284+
{
285+
"title": "Organic Skincare Gift Box",
286+
"description": "Treat yourself to a luxurious organic skincare gift box for ultimate pampering.",
287+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
288+
"categories": ["Health & Beauty", "Home & Garden"],
289+
"price": 59.99,
290+
"platform": "Etsy",
291+
"purchaseUrl": "https://www.etsy.com/organic-skincare-gift-box",
292+
"isAvailable": true,
293+
"createdAt": "2023-08-07T08:00:22Z",
294+
"updatedAt": "2023-08-07T08:00:22Z"
295+
},
296+
{
297+
"title": "Pet Lover's Subscription Box",
298+
"description": "Spoil your furry friend with a monthly subscription box filled with treats and toys.",
299+
"source": "https://thenounproject.com/api/private/icons/4927946/edit/?backgroundShape=SQUARE&backgroundShapeColor=%23000000&backgroundShapeOpacity=0&exportSize=752&flipX=false&flipY=false&foregroundColor=%23000000&foregroundOpacity=1&imageFormat=png&rotation=0",
300+
"categories": ["Home & Garden", "Pets"],
301+
"price": 24.99,
302+
"platform": "Amazon",
303+
"purchaseUrl": "https://www.amazon.com/pet-lovers-subscription-box",
304+
"isAvailable": true,
305+
"createdAt": "2023-08-07T08:00:23Z",
306+
"updatedAt": "2023-08-07T08:00:23Z"
307+
}
308+
]

cmd/seed/seedListing.ts

+18-40
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,27 @@
11
import Listing from "../../src/models/listing";
2+
import listingsJSON from "./seedData/listing.json";
23

3-
const listings = [
4-
{
5-
title: "Listing 1",
6-
description: "Description 1",
7-
source: "Source 1",
8-
categories: ["Type 1", "Type 2"],
4+
type ListingData = {
5+
title: string;
6+
description: string;
7+
source: string;
8+
categories: Array<string>;
99

10-
price: 100,
11-
platform: "Platform 1",
12-
purchaseUrl: "Purchase URL 1",
13-
isAvailable: true,
14-
15-
createdAt: new Date(),
16-
updatedAt: new Date(),
17-
},
18-
{
19-
title: "Listing 2",
20-
description: "Description 2",
21-
source: "Source 2",
22-
categories: ["Type 2", "Type 3"],
23-
24-
price: 200,
25-
platform: "Platform 2",
26-
purchaseUrl: "Purchase URL 2",
27-
isAvailable: true,
28-
29-
createdAt: new Date(),
30-
updatedAt: new Date(),
31-
},
32-
{
33-
title: "Listing 3",
34-
description: "Description 3",
35-
source: "Source 3",
36-
categories: ["Type 1", "Type 2", "Type 3"],
37-
38-
price: 300,
39-
platform: "Platform 3",
40-
purchaseUrl: "Purchase URL 3",
41-
isAvailable: true,
42-
},
43-
];
10+
price: number;
11+
platform: string;
12+
purchaseUrl: string;
13+
isAvailable: boolean;
14+
};
4415

4516
export default async function seed() {
17+
const categories = new Set<string>();
18+
const listings: ListingData[] = listingsJSON;
4619
for (const listing of listings) {
20+
for (const category of listing.categories) {
21+
categories.add(category);
22+
}
4723
await Listing.create(listing);
4824
}
25+
26+
console.log("Categories:", categories);
4927
}

src/models/listing.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function init(db?: Sequelize) {
5757
},
5858

5959
price: {
60-
type: DataTypes.INTEGER,
60+
type: DataTypes.DOUBLE,
6161
allowNull: false,
6262
},
6363
platform: {

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
4040
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
4141
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42-
// "resolveJsonModule": true, /* Enable importing .json files. */
42+
"resolveJsonModule": true /* Enable importing .json files. */,
4343
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
4444
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
4545

0 commit comments

Comments
 (0)