- Added docker-compose.yml for PostgreSQL and Redis services with health checks. - Created frontend directory with initial Vue.js setup including package.json, vite.config.ts, and TypeScript configuration. - Implemented main application structure with App.vue and HomePage.vue components. - Added message fetching and posting functionality in HomePage.vue. - Included necessary styles and scripts for Ionic framework integration. - Developed a dev-stack script to manage Docker containers and run backend/frontend servers.
40 lines
861 B
TypeScript
40 lines
861 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const count = await prisma.message.count();
|
|
if (count > 0) {
|
|
console.log("⏭️ Database already seeded, skipping.");
|
|
return;
|
|
}
|
|
|
|
const root1 = await prisma.message.create({
|
|
data: {
|
|
content: "Bienvenue sur XIP — le réseau social sans filtre ni compte.",
|
|
authorIp: "1.2.3.4",
|
|
},
|
|
});
|
|
|
|
await prisma.message.create({
|
|
data: {
|
|
content: "Pas de compte, ton IP c'est toi.",
|
|
authorIp: "5.6.7.8",
|
|
},
|
|
});
|
|
|
|
await prisma.message.create({
|
|
data: {
|
|
content: "Réponse au premier message !",
|
|
authorIp: "9.10.11.12",
|
|
parentId: root1.id,
|
|
},
|
|
});
|
|
|
|
console.log("✅ Database seeded with 3 messages.");
|
|
}
|
|
|
|
main()
|
|
.catch(console.error)
|
|
.finally(() => prisma.$disconnect());
|