Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"build": "tsc && mkdir -p dist/schema && cp -r src/schema/typeDefs dist/schema/",
"start": "node dist/index.js",
"test": "vitest"
},
Expand Down
9 changes: 8 additions & 1 deletion server/prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();



async function main() {
const tagPasta = await prisma.tag.upsert({ where: { name: 'vegetar' }, update: {}, create: { name: 'vegetar'}});

Expand All @@ -9,8 +11,10 @@ async function main() {
update: {},
create: { id: 'dev-user', name: 'Test Bruker', email: 'test@example.com'}
});
const exists = await prisma.recipe.findUnique({ where: { id: 'seed-pesto-pasta' } });

await prisma.recipe.create({
if (exists!){
await prisma.recipe.create({
data: {
title: "Pesto Pasta",
description: "beste studentmiddagen vi har",
Expand All @@ -36,6 +40,9 @@ async function main() {
},
},
});
}



}

Expand Down