Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

chore: remove stage

bautistaaa11fc7a54a704
diff --git a/.env.example b/.env.example
index 6b5a78ae..520b2649 100644
--- a/.env.example
+++ b/.env.example
@@ -1,5 +1,4 @@
DATABASE_URL="mysql://dev:dev@localhost/typehero"
-STAGE=local
GITHUB_ID=
GITHUB_SECRET=
# Next Auth
diff --git a/prisma/seed.ts b/prisma/seed.ts
index 67038f6a..ea1b8d6e 100644
--- a/prisma/seed.ts
+++ b/prisma/seed.ts
@@ -1,49 +1,39 @@
-import { type Difficulty, PrismaClient } from "@prisma/client";
-import uuidByString from "uuid-by-string";
-import { loadChallengesFromTypeChallenge } from "./challenges.mock";
-import { faker } from "@faker-js/faker";
-import UserMock from "./user.mock";
-
+import { faker } from '@faker-js/faker';
+import { PrismaClient } from '@prisma/client';
+import uuidByString from 'uuid-by-string';
+import { loadChallengesFromTypeChallenge } from './challenges.mock';
+import UserMock from './user.mock';
const prisma = new PrismaClient();
-if(process.env.STAGE === 'local') {
- const usersToBeMade = Array.from({ length: 15 }, () => UserMock());
+const usersToBeMade = Array.from({ length: 15 }, () => UserMock());
- await prisma.user.createMany({
- data: usersToBeMade
- });
+await prisma.user.createMany({
+ data: usersToBeMade,
+});
- // Load the challenges.
- const data = await loadChallengesFromTypeChallenge();
- const users = await prisma.user.findMany({
+// Load the challenges.
+const data = await loadChallengesFromTypeChallenge();
+const users = await prisma.user
+ .findMany({
select: {
- id: true
- }
- }).then(r => r.map(u => u.id));
-
- await prisma.challenge.createMany({
- data: data.map(challenge => ({
- ...challenge,
- userId: faker.helpers.arrayElement(users)
- }))
- });
-}
+ id: true,
+ },
+ })
+ .then((r) => r.map((u) => u.id));
+await prisma.challenge.createMany({
+ data: data.map((challenge) => ({
+ ...challenge,
+ userId: faker.helpers.arrayElement(users),
+ })),
+});
-const DIFFICULTIES = ["BEGINNER", "EASY", "MEDIUM", "HARD", "EXTREME"];
-const randomDifficulty = (): Difficulty => {
- return DIFFICULTIES[
- Math.floor(Math.random() * DIFFICULTIES.length)
- ] as Difficulty;
-};
-
-export const trashId = uuidByString("trash");
-export const gId = uuidByString("g");
+export const trashId = uuidByString('trash');
+export const gId = uuidByString('g');
// NOTE: we can use top-level await because we are in a module
try {
-
// await prisma.user.upsert({
// where: { id: trashId },
// update: {},