feat: initialize project with Docker, PostgreSQL, Redis, and Vue.js frontend
- 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.
This commit is contained in:
13
backend/prisma/migrations/20260529094703_init/migration.sql
Normal file
13
backend/prisma/migrations/20260529094703_init/migration.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "messages" (
|
||||
"id" TEXT NOT NULL,
|
||||
"content" VARCHAR(267) NOT NULL,
|
||||
"authorIp" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"parentId" TEXT,
|
||||
|
||||
CONSTRAINT "messages_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "messages" ADD CONSTRAINT "messages_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "messages"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
3
backend/prisma/migrations/migration_lock.toml
Normal file
3
backend/prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
24
backend/prisma/schema.prisma
Normal file
24
backend/prisma/schema.prisma
Normal file
@@ -0,0 +1,24 @@
|
||||
// This is your Prisma schema file
|
||||
// Learn more: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Message {
|
||||
id String @id @default(uuid())
|
||||
content String @db.VarChar(267)
|
||||
authorIp String
|
||||
createdAt DateTime @default(now())
|
||||
parentId String?
|
||||
|
||||
parent Message? @relation("ThreadReplies", fields: [parentId], references: [id])
|
||||
replies Message[] @relation("ThreadReplies")
|
||||
|
||||
@@map("messages")
|
||||
}
|
||||
39
backend/prisma/seed.ts
Normal file
39
backend/prisma/seed.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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());
|
||||
Reference in New Issue
Block a user