Skip to content

Commit

Permalink
backend updated routes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky29-git committed Aug 26, 2024
1 parent c11768a commit bc711a2
Show file tree
Hide file tree
Showing 9 changed files with 553 additions and 10 deletions.
221 changes: 217 additions & 4 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
"deploy": "wrangler deploy --minify src/index.ts"
},
"dependencies": {
"hono": "^4.5.8"
"@chandrashekharchoudha/vichar-common": "^1.0.0",
"@prisma/client": "^5.18.0",
"@prisma/extension-accelerate": "^1.1.0",
"hono": "^4.5.8",
"jsonwebtoken": "^9.0.2",
"prisma": "^5.18.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240529.0",
"wrangler": "^3.57.2"
}
}
}
41 changes: 41 additions & 0 deletions backend/prisma/migrations/20240825082558_init_schema/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"name" TEXT DEFAULT 'Anonymous',

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Post" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"published" BOOLEAN NOT NULL DEFAULT false,
"authorId" TEXT NOT NULL,

CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Comment" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL DEFAULT 'Anonymous',
"content" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"postId" TEXT NOT NULL,

CONSTRAINT "Comment_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- AddForeignKey
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_postId_fkey" FOREIGN KEY ("postId") REFERENCES "Post"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
3 changes: 3 additions & 0 deletions backend/prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -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"
Loading

0 comments on commit bc711a2

Please sign in to comment.