Skip to content

Instantly share code, notes, and snippets.

@cakrads
Last active January 28, 2023 04:08
Show Gist options
  • Save cakrads/a5a15191f34e702cd98a063d77114065 to your computer and use it in GitHub Desktop.
Save cakrads/a5a15191f34e702cd98a063d77114065 to your computer and use it in GitHub Desktop.
products-shoes-model.ts
import type { Product, Brand, Category, Price } from '@prisma/client';
interface TProduct extends Product {
category: Category;
brand: Brand;
price: Price[];
}
export const categories: Category[] = [
{
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
{
id: 2,
title: 'running',
slug: 'running',
description: '',
},
{
id: 3,
title: 'skate',
slug: 'skate',
description: '',
},
];
export const brands: Brand[] = [
{
id: 1,
title: 'nike',
image: 'brand/nike.webp',
description: '',
slug: 'nike',
},
{
id: 2,
title: 'adidas',
image: 'brand/adidas.webp',
description: '',
slug: 'adidas',
},
];
export const products: TProduct[] = [
{
id: 1,
title: 'Air Jordan 1 Retro High OG',
subtitle: "Men's Shoes",
slug: 'air-jordan-1-retro-high-og-shoes',
context: 'lifestyle-nike-air-jordan-1-retro-high-og-shoes',
description:
"3 + 1 = a whole new icon. Celebrating 35 years of the Air Jordan 3, these kicks combine the classic AJ1 silhouette with an original AJ3 colourway. Crafted to the '85 specs, it's got premium leather, a high-top collar and the woven tongue label you know and love. Bold splashes of True Blue throughout (check out the Wings logo) stand out against layers of white and Cement Grey. And the finishing touch? Nike Air cushioning underfoot lets you keep pace, so nothing holds you back from stepping out in style.",
image: [
'product/09c9186d-e28e-4e46-9535-e49f09ddfdd9.webp',
'product/6c389fcd-8609-4632-8eee-0f3449652b68.webp',
],
price: [
{
id: 1,
productId: 1,
currency: 'IDR',
currentPrice: 2849000,
fullPrice: 2849000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/air-jordan-1-retro-high-og-shoes-Pz6fZ9/DZ5485-410',
published: true,
},
{
id: 2,
title: 'Air Jordan 1 Mid SE Craft',
subtitle: "Men's Shoes",
slug: 'air-jordan-1-mid-se-craft-shoes',
context: 'lifestyle-nike-air-jordan-1-mid-se-craft-shoes',
description:
"Reinvent an icon in the AJ1 Craft. The upper is made from canvas and leather for a unique take on the kicks you know and love, while an exposed edge around the collar adds even more texture to your look. And as always, they're made for everyday wear with classic cupsole construction and always-satisfying Air in the sole.",
image: [
'product/f11b83fc-e9e5-41aa-8ae2-1974a11e6b1f.webp',
'product/air-jordan-1-mid-se-craft-shoes-skP03z.webp',
],
price: [
{
id: 2,
productId: 2,
currency: 'IDR',
currentPrice: 2079000,
fullPrice: 2079000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/air-jordan-1-mid-se-craft-shoes-skP03z/DR8868-400',
published: true,
},
{
id: 3,
title: 'Nike Go FlyEase',
subtitle: 'Easy On/Off Shoes',
slug: 'go-flyease-easy-on-off-shoes',
context: 'lifestyle-nike-go-flyease-easy-on-off-shoes',
description:
"Ditch the laces and get outside. These kicks feature Nike's revolutionary FlyEase technology, making on-and-off a breeze. With a heel that pivots open for a totally hands-free entry, they're great for people with limited mobility—or anyone who wants a quicker way to get going.",
image: [
'product/c76e2119-acb7-4944-9085-d4f5ae2bda4a.webp',
'product/0af510b3-6532-46c9-a315-95405e03ae52.webp',
],
price: [
{
id: 3,
productId: 3,
currency: 'IDR',
currentPrice: 2059000,
fullPrice: 2059000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/go-flyease-easy-on-off-shoes-3svRCL/DR5540-002',
published: true,
},
{
id: 4,
title: 'Air Jordan 11 Retro',
subtitle: "Men's Shoes",
slug: 'air-jordan-11-retro-shoes',
context: 'lifestyle-nike-air-jordan-11-retro-shoes',
description:
"Let's cut to the chase—the AJ11 is all-time. MJ won 72 games and a title while wearing 'em. Now, the icon returns in classic colours. From its slick patent leather mudguard to the frosted outsole, this Tinker Hatfield design brings the off-court allure. And for the final touch? Full-length Air cushioning is the cherry on top (err, bottom).",
image: [
'product/8dae38f3-b4c4-4752-bdea-b32ac7d937c8.webp',
'product/8fce10cd-312c-4d6e-9a6d-47027cddf397.webp',
],
price: [
{
id: 4,
productId: 4,
currency: 'IDR',
currentPrice: 3309000,
fullPrice: 3309000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/air-jordan-11-retro-shoes-gMjfzz/CT8012-116',
published: true,
},
{
id: 5,
title: 'Jordan Max Aura 4',
subtitle: "Men's Shoes",
slug: 'jordan-max-aura-4-shoes',
context: 'lifestyle-nike-jordan-max-aura-4-shoes',
description:
'The lightweight cushioning found in this next generation basketball shoe takes cues from its predecessors. Take flight on the court with timeless style and cloud-like heel support.',
image: [
'product/b0ef283f-93da-43e8-b814-c66f427bc7ba.webp',
'product/67976641-f11c-4c26-93d2-55dda03489ad.webp',
],
price: [
{
id: 5,
productId: 5,
currency: 'IDR',
currentPrice: 1899000,
fullPrice: 1899000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/jordan-max-aura-4-shoes-cKMcXJ/DN3687-061',
published: true,
},
{
id: 6,
title: 'Air Jordan Legacy 312 Low',
subtitle: "Men's Shoes",
slug: 'air-jordan-legacy-312-low-shoes',
context: 'lifestyle-nike-air-jordan-legacy-312-low-shoes',
description: '',
image: [
'product/6760a13e-0204-4eda-b08c-817e35bf52ac.webp',
'product/d07bd799-862c-4588-a66c-21edc66ce2c1.webp',
],
price: [
{
id: 6,
productId: 6,
currency: 'IDR',
currentPrice: 2199000,
fullPrice: 2199000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/air-jordan-legacy-312-low-shoes-6Vd4Xl/CD7069-116',
published: true,
},
{
id: 7,
title: 'Nike Vomero 16',
subtitle: "Men's Road Running Shoes",
slug: 'vomero-16-road-running-shoes',
context: 'running-nike-vomero-16-road-running-shoes',
description:
"The Vomero 16 adds responsive ZoomX foam cushioning, bringing an energetic pop to your stride that's perfect for high mileage on the road. It's super-lightweight, with plenty of stretch and ventilation through the upper. Looking for the right amount of support? We've got you covered with an adjustable midfoot band and a stable clip at the heel.",
image: [
'product/2de52cbf-c004-4b8c-8665-ad7a6fb8ca5f.webp',
'product/3d915645-968d-4468-a695-79d49131ad25.webp',
],
price: [
{
id: 7,
productId: 7,
currency: 'IDR',
currentPrice: 2279000,
fullPrice: 2279000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source: 'https://www.nike.com/id/t/vomero-16-road-running-shoes',
published: true,
},
{
id: 8,
title: 'Nike Revolution 6',
subtitle: "Men's Running Shoes (Extra Wide)",
slug: 'revolution-6-running-shoes',
context: 'running-nike-revolution-6-running-shoes',
description: '',
image: [
'product/e839f55c-84d5-4030-9bcf-644e6a6463ea.webp',
'product/410cbbbe-17f3-45f9-ae89-1ccc57c76bd4.webp',
],
price: [
{
id: 8,
productId: 8,
currency: 'IDR',
currentPrice: 799000,
fullPrice: 799000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source: 'https://www.nike.com/id/t/revolution-6-running-shoes',
published: true,
},
{
id: 9,
title: 'Nike Renew Run 3',
subtitle: "Men's Road Running Shoes",
slug: 'renew-run-3-road-running-shoes',
context: 'running-nike-renew-run-3-road-running-shoes',
description:
"Feel the potential with the Nike Renew Run 3. Plush where you need it, stretchy where it counts, this shoe keeps your foot stable with every step and turn. Super-soft foam adds a slightly springy feel for a little jump to your stride. It's got a clean look with fresh details that invite you to lace up and hit the road.",
image: [
'product/d2e2c778-3dbc-4759-89e6-b74a9cc14239.webp',
'product/0504fb45-ba97-4d91-977b-a0f9ec209df9.webp',
],
price: [
{
id: 9,
productId: 9,
currency: 'IDR',
currentPrice: 1299000,
fullPrice: 1299000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source: 'https://www.nike.com/id/t/renew-run-3-road-running-shoes',
published: true,
},
{
id: 10,
title: 'Nike Pegasus 39 Shield By You',
subtitle: "Custom Men's Weatherised Road Running Shoes",
slug: 'custom-nike-pegasus-39-shield-by-you-shoes',
context: 'running-nike-custom-nike-pegasus-39-shield-by-you-shoes',
description:
'Keep your toes toasty and your feet bone dry in the workhorse with wings that does all the dirty work to shield your runs from bad weather. It provides water protection and all-terrain tyre-like traction for downpours, first, but with a cosy fleece feel on the inside, thanks to an unbeatable duo of Heathered lining and structured insulation inspired by our AeroLoft technology. Once you lock in your personal design, you can look forward to the shivery morning outings that bite and bark and tame those gloomy evening jaunts.',
image: [
'product/deee201a-0982-4e60-8213-621e93ca36cc.webp',
'product/f8310033-4eef-4263-9ad6-b862c00309fe.webp',
],
price: [
{
id: 10,
productId: 10,
currency: 'IDR',
currentPrice: 2629000,
fullPrice: 2629000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/u/custom-nike-pegasus-39-shield-by-you-10001377/4049960778',
published: true,
},
{
id: 11,
title: 'Nike Air Zoom Pegasus 38',
subtitle: "Men's Road Running Shoes",
slug: 'air-zoom-pegasus-38-road-running-shoes',
context: 'running-nike-air-zoom-pegasus-38-road-running-shoes',
description: '',
image: [
'product/da968e74-40a9-44d5-9a62-a708c072fc7d.webp',
'product/0a0199a6-a634-4d8e-bf10-16665a58469b.webp',
],
price: [
{
id: 11,
productId: 11,
currency: 'IDR',
currentPrice: 1799000,
fullPrice: 1799000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/air-zoom-pegasus-38-road-running-shoes-Hmsj6Q/CW7356-011',
published: true,
},
{
id: 12,
title: 'Nike SB Force 58',
subtitle: 'Skate Shoes',
slug: 'sb-force-58-skate-shoes',
context: 'skate-nike-sb-force-58-skate-shoes',
description:
'The latest and greatest innovation to hit the streets, the Force 58 gives you the durability of a cupsole with the flexibility of vulcanised shoes. Made from canvas and suede and finished with perforations on the toe, the whole look is infused with heritage basketball DNA.',
image: [
'product/7139370f-a8ad-4451-b2a0-538b14bd5e85.webp',
'product/b41c5292-4a94-4bfa-b502-acdbfb1d542f.webp',
],
price: [
{
id: 12,
productId: 12,
currency: 'IDR',
currentPrice: 1149000,
fullPrice: 1149000,
discount: 0,
},
],
// categoryId: 3,
category: {
id: 3,
title: 'skate',
slug: 'skate',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/sb-force-58-skate-shoes-LJNW5L/DV5477-001',
published: true,
},
{
id: 13,
title: 'Nike SB Ishod Wair',
subtitle: 'Skate Shoes',
slug: 'sb-ishod-wair-skate-shoes',
context: 'skate-nike-sb-ishod-wair-skate-shoes',
description:
"When it came time to build his signature shoe, Ishod Wair was all-in from start to finish.Infused with elements taken from the iconic hoops shoes of the '90s, (did you know that basketball was Ishod's first love?) and built with all the durability you need to skate hard—seriously, check out that new cupsole—the Nike SB Ishod Wair walks the line between original style and modern skate innovation.",
image: [
'product/eb338281-3bdf-4858-b9a9-126e8cb5b86b.webp',
'product/51c9e217-e65b-4565-9c4b-55a1aea4a8f5.webp',
],
price: [
{
id: 13,
productId: 13,
currency: 'IDR',
currentPrice: 1429000,
fullPrice: 1429000,
discount: 0,
},
],
// categoryId: 3,
category: {
id: 3,
title: 'skate',
slug: 'skate',
description: '',
},
// brandId: 1,
brand: {
id: 1,
title: 'nike',
slug: 'nike',
image: 'brand/nike.webp',
description: '',
},
source:
'https://www.nike.com/id/t/sb-ishod-wair-skate-shoes-BFw5xR/DC7232-001',
published: true,
},
{
id: 14,
title: 'DURAMO 10 RUNNING EDITION',
subtitle: 'BLUE/MULTICOLOR/WHITE [HQ4129]',
slug: 'duramo-10-running-shoes',
context: 'running-adidas-duramo-10-shoes',
description:
'From a morning gym session to a day of errands to an evening with friends, keep your feet comfortable and your style on point in these adidas shoes. Pair them with your favourite running shorts for the ultimate athletic-casual vibe. A mesh upper helps you stay cool, while superlight cushioning cradles every step you take.Made with a series of recycled materials, this upper features at least 50% recycled content. This product represents just one of our solutions to help end plastic waste.',
image: [
'product/hq4129_5_footwear_photography_side20medial20center20view_grey.webp',
'product/hq4129_6_footwear_photography_front20lateral20top20view_grey.webp',
],
price: [
{
id: 14,
productId: 14,
currency: 'IDR',
currentPrice: 900000,
fullPrice: 910000,
discount: 10,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/en/duramo-10-shoes-646124.html',
published: true,
},
{
id: 15,
title: 'ADIZERO BOSTON 11',
subtitle: 'WHITE/BLACK/BLUE [HQ3693]',
slug: 'adizero-boston-11-shoes',
context: 'running-adidas-adizero-boston-11-shoes',
description:
"he Boston Marathon is a race. But it's also a goal, and a training plan and all the days it stays on your mind before the big one. The Adizero Boston 11 Shoes are built for mid- to long-distance running. They bring a race-day feel to training with a propulsive feel that comes from ENERGYRODS, which limit energy loss underfoot. They're fast, but that does not come at the cost of durability — the midsole mixes ultralight Lightstrike Pro cushioning with durable Lightstrike EVA.",
image: [
'product/hq3693_5_footwear_photography_side20medial20center20view_grey.webp',
'product/hq3693_6_footwear_photography_front20lateral20top20view_grey.webp',
],
price: [
{
id: 15,
productId: 15,
currency: 'IDR',
currentPrice: 2300000,
fullPrice: 2300000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/en/adizero-boston-11-shoes-646049.html',
published: true,
},
{
id: 16,
title: 'ADISTAR 2.0',
subtitle: 'BLACK/WHITE/BLACK [HP2335]',
slug: 'sepatu-adistar-2-0-shoes',
context: 'running-adidas-sepatu-adistar-2-0-shoes',
description:
"There's a lot more to long-distance running than just getting from here to there. It's about the breeze at your back, the rhythm of your stride, the freedom of the open road. These adidas running shoes are precision-engineered for perpetual motion, ensuring that each step transitions seamlessly into the next, kilometre after kilometre. The dual-density midsole combines lightweight foam for springy cushioning with a firmer compound that cradles the heel. An internal cage locks down the foot for optimal support that never lets up.",
image: [
'product/hp2335_5_footwear_photography_side20medial20center20view_grey.webp',
'product/hp2335_6_footwear_photography_front20lateral20top20view_grey.webp',
],
price: [
{
id: 16,
productId: 16,
currency: 'IDR',
currentPrice: 2200000,
fullPrice: 2200000,
discount: 0,
},
],
// categoryId: 2,
category: {
id: 2,
title: 'running',
slug: 'running',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/sepatu-adistar-2-0-645284.html',
published: true,
},
{
id: 17,
title: 'RACER TR21',
subtitle: 'WHITE/GREY/BLACK [GZ8182]',
slug: 'racer-tr21-shoes',
context: 'lifestyle-adidas-racer-tr21-shoes',
description:
'Bring the comfort and athletic style of running footwear to your everyday look in these adidas shoes. Step through your day confidently with a snug fit and a lightweight midsole that cushions your feet with every step. This product is made with Primegreen, a series of high-performance recycled materials. 50% of upper is recycled content. No virgin polyester.',
image: ['product/gz8182_smc_ecom.webp', 'product/gz8182_flt_ecom.webp'],
price: [
{
id: 17,
productId: 17,
currency: 'IDR',
currentPrice: 1200000,
fullPrice: 1200000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/en/sepatu-racer-tr21-445608.html',
published: true,
},
{
id: 18,
title: 'DURAMO 10 SHOES',
subtitle: 'PINK/BLACK/MULTICOLOR [GW8345]',
slug: 'duramo-10-shoes',
context: 'lifestyle-adidas-duramo-10-shoes',
description:
'From a morning gym session to a day of errands to an evening with friends, keep your feet comfortable and your style on point in these adidas shoes. Pair them with your favourite running shorts for the ultimate athletic-casual vibe. A mesh upper helps you stay cool, while superlight cushioning cradles every step you take. Made with a series of recycled materials, this upper features at least 50% recycled content. This product represents just one of our solutions to help end plastic waste.',
image: ['product/gw8345_smc_ecom.webp', 'product/gw8345_flt_ecom.webp'],
price: [
{
id: 18,
productId: 18,
currency: 'IDR',
currentPrice: 900000,
fullPrice: 900000,
discount: 0,
},
],
// categoryId: 1,
category: {
id: 1,
title: 'lifestyle',
slug: 'lifestyle',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/en/duramo-sl-2-0-shoes-465358.html',
published: true,
},
{
id: 19,
title: 'DURAMO SL 2.0',
subtitle: 'MULTICOLOR/MULTICOLOR/WHITE [ GW8349]',
slug: 'duramo-sl-20-shoes',
context: 'skate-adidas-duramo-sl-20-shoes',
description:
'From a morning gym session to a day of errands to an evening with friends, keep your feet comfortable and your style on point in these adidas shoes. Pair them with your favourite running shorts for the ultimate athletic-casual vibe. A mesh upper helps you stay cool, while superlight cushioning cradles every step you take. Made with a series of recycled materials, this upper features at least 50% recycled content. This product represents just one of our solutions to help end plastic waste.',
image: ['product/gw8349_smc_ecom.webp', 'product/gw8349_flt_ecom.webp'],
price: [
{
id: 19,
productId: 19,
currency: 'IDR',
currentPrice: 900000,
fullPrice: 910000,
discount: 10,
},
],
// categoryId: 3,
category: {
id: 3,
title: 'skate',
slug: 'skate',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/en/duramo-sl-2-0-shoes-471620.html',
published: true,
},
{
id: 20,
title: 'ULTRABOOST 5 DNA RUNNING SPORTSWEAR LIFESTYLE',
subtitle: 'BLACK/WHITE/ORANGE [GV8749]',
slug: 'ultraboost-5-dna-running-sportswear-lifestyle-shoes',
context: 'skate-adidas-ultraboost-5-dna-running-sportswear-lifestyle-shoes',
description:
"The Ultraboost isn't our first performance running shoe to hold appeal in the realm of fashion. It's just one of the most beloved. That's why we made the Ultraboost DNA Shoes, a lifestyle trainer built off the bones of its more technical namesake. The simplicity of the design shines a spotlight on the pattern of the adidas PRIMEKNIT. And because comfort's a non-negotiable, run or no run, BOOST offers incredible energy return in every step.This shoe's upper is made with a high-performance yarn which contains at least 50% Parley Ocean Plastic — reimagined plastic waste, intercepted on remote islands, beaches, coastal communities and shorelines, preventing it from polluting our ocean. The other 50% of the yarn is recycled polyester.",
image: [
'product/gv8749_5_footwear_photography_side_medial_center_view_grey.webp',
'product/gv8749_6_footwear_photography_front_lateral_top_view_grey.webp',
],
price: [
{
id: 20,
productId: 20,
currency: 'IDR',
currentPrice: 3300000,
fullPrice: 3300000,
discount: 0,
},
],
// categoryId: 3,
category: {
id: 3,
title: 'skate',
slug: 'skate',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source:
'https://www.adidas.co.id/ultraboost-5-dna-running-sportswear-lifestyle-shoes-577713.html',
published: true,
},
{
id: 21,
title: 'RACER TR21 SKATE EDITION',
subtitle: 'BLACK/WHITE/BLACK [GZ8184]',
slug: 'racer-tr21-skate-shoes',
context: 'skate-adidas-racer-tr21-skate-shoes',
description:
'Bring the comfort and athletic style of running footwear to your everyday look in these adidas shoes. Step through your day confidently with a snug fit and a lightweight midsole that cushions your feet with every step.This product is made with Primegreen, a series of high-performance recycled materials. 50% of upper is recycled content. No virgin polyester.',
image: ['product/gz8184_smc_ecom.webp', 'product/gz8184_flt_ecom.webp'],
price: [
{
id: 21,
productId: 21,
currency: 'IDR',
currentPrice: 1200000,
fullPrice: 1200000,
discount: 0,
},
],
// categoryId: 3,
category: {
id: 3,
title: 'skate',
slug: 'skate',
description: '',
},
// brandId: 2,
brand: {
id: 2,
title: 'adidas',
slug: 'adidas',
image: 'brand/adidas.webp',
description: '',
},
source: 'https://www.adidas.co.id/racer-tr21-shoes-399955.htm',
published: true,
},
];
model Product {
id Int @id @unique @default(autoincrement())
title String
subtitle String?
slug String @unique
context String
description String?
image String[]
price Price[]
categories Category[]
brands Brand[]
source String?
published Boolean? @default(true)
}
model Price {
id Int @id @unique @default(autoincrement())
currency String
currentPrice Int
fullPrice Int
discount Int
product Product @relation(fields: [productId], references: [id])
productId Int
}
model Category {
id Int @id @unique @default(autoincrement())
title String
description String?
slug String @unique
product Product[]
}
model Brand {
id Int @id @unique @default(autoincrement())
title String
description String?
slug String @unique
image String
Product Product[]
}
import { products } from './initial-data';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
await prisma.$transaction(
products.map((product) => {
return prisma.product.upsert({
where: { slug: product.slug },
update: {},
create: {
title: product.title,
subtitle: product.subtitle,
slug: product.slug,
context: product.context,
description: product.description,
image: product.image,
price: {
create: [
{
currency: product.price[0].currency,
currentPrice: product.price[0].currentPrice,
fullPrice: product.price[0].fullPrice,
discount: product.price[0].discount,
},
],
},
brands: {
connectOrCreate: {
create: {
title: product.brand.title,
slug: product.brand.slug,
image: product.brand.image,
description: product.brand.description,
},
where: {
slug: product.brand.slug,
},
},
},
categories: {
connectOrCreate: {
create: {
title: product.category.title,
slug: product.category.slug,
description: product.category.description,
},
where: {
slug: product.category.slug,
},
},
},
source: product.source,
published: product.published,
},
});
}),
);
}
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment