Skip to content

Commit fe0cfff

Browse files
committed
feat: update prisma seed for product variants
1 parent a8c0fcc commit fe0cfff

2 files changed

Lines changed: 16 additions & 29 deletions

File tree

‎prisma/initial_data.ts‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,36 @@ export const categories = [
66
{
77
title: "Polos",
88
slug: "polos" as CategorySlug,
9-
imgSrc: `${imagesBaseUrl}/polos.jpg`,
109
alt: "Hombre luciendo polo azul",
1110
description:
1211
"Polos exclusivos con diseños que todo desarrollador querrá lucir. Ideales para llevar el código a donde vayas.",
1312
},
1413
{
1514
title: "Tazas",
1615
slug: "tazas" as CategorySlug,
17-
imgSrc: `${imagesBaseUrl}/tazas.jpg`,
1816
alt: "Tazas con diseño de código",
1917
description:
2018
"Tazas que combinan perfectamente con tu café matutino y tu pasión por la programación. ¡Empieza el día con estilo!",
2119
},
2220
{
2321
title: "Stickers",
2422
slug: "stickers" as CategorySlug,
25-
imgSrc: `${imagesBaseUrl}/stickers.jpg`,
2623
alt: "Stickers de desarrollo web",
2724
description:
2825
"Personaliza tu espacio de trabajo con nuestros stickers únicos y muestra tu amor por el desarrollo web.",
2926
},
3027
];
3128

3229
export const variantAttributes = [
30+
{ name: "no aplica" },
3331
{ name: "talla" },
3432
{ name: "dimensiones" },
35-
{ name: "no aplica" },
3633
]
3734

3835
export const products = [
3936
{
4037
title: "Polo React",
4138
imgSrc: `${imagesBaseUrl}/polos/polo-react.png`,
42-
price: 20.0,
4339
description:
4440
"Viste tu pasión por React con estilo y comodidad en cada línea de código.",
4541
categoryId: 1,
@@ -54,7 +50,6 @@ export const products = [
5450
{
5551
title: "Polo JavaScript",
5652
imgSrc: `${imagesBaseUrl}/polos/polo-js.png`,
57-
price: 20.0,
5853
description:
5954
"Deja que tu amor por JavaScript hable a través de cada hilo de este polo.",
6055
categoryId: 1,
@@ -69,7 +64,6 @@ export const products = [
6964
{
7065
title: "Polo Node.js",
7166
imgSrc: `${imagesBaseUrl}/polos/polo-node.png`,
72-
price: 20.0,
7367
description:
7468
"Conéctate al estilo con este polo de Node.js, tan robusto como tu código.",
7569
categoryId: 1,
@@ -84,7 +78,6 @@ export const products = [
8478
{
8579
title: "Polo TypeScript",
8680
imgSrc: `${imagesBaseUrl}/polos/polo-ts.png`,
87-
price: 20.0,
8881
description:
8982
"Tipa tu estilo con precisión: lleva tu pasión por TypeScript en cada hilo.",
9083
categoryId: 1,
@@ -99,7 +92,6 @@ export const products = [
9992
{
10093
title: "Polo Backend Developer",
10194
imgSrc: `${imagesBaseUrl}/polos/polo-backend.png`,
102-
price: 25.0,
10395
description:
10496
"Domina el servidor con estilo: viste con orgullo tu título de Backend Developer.",
10597
categoryId: 1,
@@ -114,7 +106,6 @@ export const products = [
114106
{
115107
title: "Polo Frontend Developer",
116108
imgSrc: `${imagesBaseUrl}/polos/polo-frontend.png`,
117-
price: 25.0,
118109
description:
119110
"Construye experiencias con estilo: luce con orgullo tu polo de Frontend Developer.",
120111
categoryId: 1,
@@ -129,7 +120,6 @@ export const products = [
129120
{
130121
title: "Polo Full-Stack Developer",
131122
imgSrc: `${imagesBaseUrl}/polos/polo-fullstack.png`,
132-
price: 25.0,
133123
description:
134124
"Domina ambos mundos con estilo: lleva tu título de FullStack Developer en cada línea de tu look.",
135125
categoryId: 1,
@@ -144,7 +134,6 @@ export const products = [
144134
{
145135
title: "Polo It's A Feature",
146136
imgSrc: `${imagesBaseUrl}/polos/polo-feature.png`,
147-
price: 15.0,
148137
description:
149138
"Cuando el bug se convierte en arte: lleva con orgullo tu polo 'It's a feature'.",
150139
categoryId: 1,
@@ -159,7 +148,6 @@ export const products = [
159148
{
160149
title: "Polo It Works On My Machine",
161150
imgSrc: `${imagesBaseUrl}/polos/polo-works.png`,
162-
price: 15.0,
163151
description:
164152
"El clásico del desarrollador: presume tu confianza con 'It works on my machine'.",
165153
categoryId: 1,
@@ -174,7 +162,6 @@ export const products = [
174162
{
175163
title: "Sticker JavaScript",
176164
imgSrc: `${imagesBaseUrl}/stickers/sticker-js.png`,
177-
price: 2.99,
178165
description:
179166
"Muestra tu amor por JavaScript con este elegante sticker clásico.",
180167
categoryId: 3,
@@ -189,7 +176,6 @@ export const products = [
189176
{
190177
title: "Sticker React",
191178
imgSrc: `${imagesBaseUrl}/stickers/sticker-react.png`,
192-
price: 2.49,
193179
description:
194180
"Decora tus dispositivos con el icónico átomo giratorio de React.",
195181
categoryId: 3,
@@ -204,7 +190,6 @@ export const products = [
204190
{
205191
title: "Sticker Git",
206192
imgSrc: `${imagesBaseUrl}/stickers/sticker-git.png`,
207-
price: 3.99,
208193
description:
209194
"Visualiza el poder del control de versiones con este sticker de Git.",
210195
categoryId: 3,
@@ -219,7 +204,6 @@ export const products = [
219204
{
220205
title: "Sticker Docker",
221206
imgSrc: `${imagesBaseUrl}/stickers/sticker-docker.png`,
222-
price: 2.99,
223207
description:
224208
"La adorable ballena de Docker llevando contenedores en un sticker único.",
225209
categoryId: 3,
@@ -234,7 +218,6 @@ export const products = [
234218
{
235219
title: "Sticker Linux",
236220
imgSrc: `${imagesBaseUrl}/stickers/sticker-linux.png`,
237-
price: 2.49,
238221
description:
239222
"El querido pingüino Tux, mascota oficial de Linux, en formato sticker.",
240223
categoryId: 3,
@@ -249,7 +232,6 @@ export const products = [
249232
{
250233
title: "Sticker VS Code",
251234
imgSrc: `${imagesBaseUrl}/stickers/sticker-vscode.png`,
252-
price: 2.49,
253235
description: "El elegante logo del editor favorito de los desarrolladores.",
254236
categoryId: 3,
255237
isOnSale: false,
@@ -263,7 +245,6 @@ export const products = [
263245
{
264246
title: "Sticker GitHub",
265247
imgSrc: `${imagesBaseUrl}/stickers/sticker-github.png`,
266-
price: 2.99,
267248
description:
268249
"El alojamiento de repositorios más popular en un sticker de alta calidad.",
269250
categoryId: 3,
@@ -278,7 +259,6 @@ export const products = [
278259
{
279260
title: "Sticker HTML",
280261
imgSrc: `${imagesBaseUrl}/stickers/sticker-html.png`,
281-
price: 2.99,
282262
description:
283263
"El escudo naranja de HTML5, el lenguaje que estructura la web.",
284264
categoryId: 3,
@@ -293,7 +273,6 @@ export const products = [
293273
{
294274
title: "Taza JavaScript",
295275
imgSrc: `${imagesBaseUrl}/tazas/taza-js.png`,
296-
price: 14.99,
297276
description:
298277
"Disfruta tu café mientras programas con el logo de JavaScript.",
299278
categoryId: 2,
@@ -308,7 +287,6 @@ export const products = [
308287
{
309288
title: "Taza React",
310289
imgSrc: `${imagesBaseUrl}/tazas/taza-react.png`,
311-
price: 13.99,
312290
description:
313291
"Una taza que hace render de tu bebida favorita con estilo React.",
314292
categoryId: 2,
@@ -323,7 +301,6 @@ export const products = [
323301
{
324302
title: "Taza Git",
325303
imgSrc: `${imagesBaseUrl}/tazas/taza-git.png`,
326-
price: 12.99,
327304
description: "Commit a tu rutina diaria de café con esta taza de Git.",
328305
categoryId: 2,
329306
isOnSale: false,
@@ -337,7 +314,6 @@ export const products = [
337314
{
338315
title: "Taza SQL",
339316
imgSrc: `${imagesBaseUrl}/tazas/taza-sql.png`,
340-
price: 15.99,
341317
description: "Tu amor por los lenguajes estructurados en una taza de SQL.",
342318
categoryId: 2,
343319
isOnSale: false,
@@ -351,7 +327,6 @@ export const products = [
351327
{
352328
title: "Taza Linux",
353329
imgSrc: `${imagesBaseUrl}/tazas/taza-linux.png`,
354-
price: 13.99,
355330
description: "Toma tu café con la libertad que solo Linux puede ofrecer.",
356331
categoryId: 2,
357332
isOnSale: false,
@@ -365,7 +340,6 @@ export const products = [
365340
{
366341
title: "Taza GitHub",
367342
imgSrc: `${imagesBaseUrl}/tazas/taza-github.png`,
368-
price: 14.99,
369343
description: "Colabora con tu café en esta taza con el logo de GitHub.",
370344
categoryId: 2,
371345
isOnSale: false,

‎prisma/seed.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { categories, products } from "./initial_data";
1+
import { categories, products, variantAttributes, variantAttributeValues } from "./initial_data";
22
import { PrismaClient } from "../generated/prisma/client";
33

44
const prisma = new PrismaClient();
@@ -9,10 +9,23 @@ async function seedDb() {
99
});
1010
console.log("1. Categories successfully inserted");
1111

12+
await prisma.variantAttribute.createMany({
13+
data: variantAttributes,
14+
})
15+
console.log("2. Variant Attributes successfully inserted");
16+
1217
await prisma.product.createMany({
1318
data: products,
19+
1420
});
15-
console.log("2. Products successfully inserted");
21+
console.log("3. Products successfully inserted");
22+
23+
await prisma.variantAttributeValue.createMany({
24+
data: variantAttributeValues,
25+
})
26+
27+
console.log("4. Variant Attribute Values successfully inserted");
28+
1629
}
1730

1831
seedDb()

0 commit comments

Comments
 (0)