initial commit

This commit is contained in:
2026-04-03 18:25:54 +01:00
commit 17e26fc87f
35 changed files with 4716 additions and 0 deletions

95
prisma/seed.ts Normal file
View File

@@ -0,0 +1,95 @@
import { prisma } from '../lib/prisma';
async function main() {
console.log("Begin seeding...");
const userBob = await prisma.pet.create({
data: {
name: "bob",
species: "dog",
userId: "1001",
}
});
const userSam = await prisma.pet.create({
data: {
name: "Sam",
species: "cat",
userId: "1002",
}
});
const userJess = await prisma.pet.create({
data: {
name: "Jess",
species: "dog",
userId: "1003",
}
});
const userSid = await prisma.pet.create({
data: {
name: "sid",
species: "sloth",
userId: "1004",
}
});
const friendShipOne = await prisma.friendship.create({
data: {
petId: userJess.id,
friendId: userSid.id,
accepted: true
}
});
const friendShipTwo = await prisma.friendship.create({
data: {
petId: userJess.id,
friendId: userSam.id,
accepted: true
}
});
const friendShipThree = await prisma.friendship.create({
data: {
petId: userBob.id,
friendId: userSam.id,
accepted: true
}
});
const postOne = await prisma.post.createMany({
data: [{
content: "Hello, I'm bob and this is my first post!",
petId: userBob.id,
},
{
content: "Woof, it's a lovely day to go for a walk!",
petId: userBob.id,
},
{
content: "Hi Everyone, My name is sid, and i'm a lazy sloth",
petId: userSid.id,
},
{
content: "I think we should all dig holes and live underground, screw the sun",
petId: userSam.id,
},
{
content: "That's it, i'm taking a holiday to China! I know they dogs but i'm sure they'll like me",
petId: userSid.id,
}]
})
}
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});