From 110f7e2f725b98d9b4a14f722d400a4c46887652 Mon Sep 17 00:00:00 2001
From: Rituraj Singh <2300520140055@ietlucknow.ac.in>
Date: Sun, 8 Sep 2024 06:41:34 +0530
Subject: [PATCH 1/2] devi ji
---
frontend/src/components/Polls.jsx | 2 +-
frontend/src/components/Posts.jsx | 2 +-
frontend/src/pages/Home.jsx | 2 +-
frontend/src/pages/ProfileComments.jsx | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/frontend/src/components/Polls.jsx b/frontend/src/components/Polls.jsx
index 7006d98..70f611d 100644
--- a/frontend/src/components/Polls.jsx
+++ b/frontend/src/components/Polls.jsx
@@ -282,7 +282,7 @@ const Polls = ({ poll, setPollVote, user, inRoom, room, topic, joined }) => {
-
+
>
diff --git a/frontend/src/components/Posts.jsx b/frontend/src/components/Posts.jsx
index 92b076a..fa9fa1f 100644
--- a/frontend/src/components/Posts.jsx
+++ b/frontend/src/components/Posts.jsx
@@ -344,7 +344,7 @@ const Posts = ({ id, post, title,topic, body, media, countComment, inRoom, room,
-
+
>
);
};
diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx
index 0676af9..c6a56d6 100644
--- a/frontend/src/pages/Home.jsx
+++ b/frontend/src/pages/Home.jsx
@@ -129,7 +129,7 @@ const Home = () => {
return (<>
- )
}
From 657e56583026749e824480d7de655e8a1cece992 Mon Sep 17 00:00:00 2001
From: Rituraj Singh <2300520140055@ietlucknow.ac.in>
Date: Sun, 8 Sep 2024 16:21:36 +0530
Subject: [PATCH 2/2] added poll migration
---
.../migration.sql | 48 -------------------
.../20240731125024_dev/migration.sql | 5 ++
.../20240731132317_dev/migration.sql | 5 ++
.../20240816011135_init/migration.sql | 24 ++++++++++
.../20240816063047_init/migration.sql | 14 ++++++
.../20240817011920_init/migration.sql | 2 +
.../20240820113120_development/migration.sql | 3 ++
.../20240825232056_init/migration.sql | 2 +
.../20240905164750_development/migration.sql | 23 ---------
.../20240907193820_development/migration.sql | 2 -
.../20240908104001_poll/migration.sql | 47 ++++++++++++++++++
frontend/src/pages/Room.jsx | 6 +--
12 files changed, 104 insertions(+), 77 deletions(-)
rename backend/prisma/migrations/{20240905125921_init => 20240730103208_init}/migration.sql (78%)
create mode 100644 backend/prisma/migrations/20240731125024_dev/migration.sql
create mode 100644 backend/prisma/migrations/20240731132317_dev/migration.sql
create mode 100644 backend/prisma/migrations/20240816011135_init/migration.sql
create mode 100644 backend/prisma/migrations/20240816063047_init/migration.sql
create mode 100644 backend/prisma/migrations/20240817011920_init/migration.sql
create mode 100644 backend/prisma/migrations/20240820113120_development/migration.sql
create mode 100644 backend/prisma/migrations/20240825232056_init/migration.sql
delete mode 100644 backend/prisma/migrations/20240905164750_development/migration.sql
delete mode 100644 backend/prisma/migrations/20240907193820_development/migration.sql
create mode 100644 backend/prisma/migrations/20240908104001_poll/migration.sql
diff --git a/backend/prisma/migrations/20240905125921_init/migration.sql b/backend/prisma/migrations/20240730103208_init/migration.sql
similarity index 78%
rename from backend/prisma/migrations/20240905125921_init/migration.sql
rename to backend/prisma/migrations/20240730103208_init/migration.sql
index 7d24d6d..9bfcb45 100644
--- a/backend/prisma/migrations/20240905125921_init/migration.sql
+++ b/backend/prisma/migrations/20240730103208_init/migration.sql
@@ -1,54 +1,18 @@
-- CreateTable
CREATE TABLE "User" (
"dp" TEXT,
- "bgImg" TEXT,
"bio" TEXT,
"userID" TEXT NOT NULL,
"username" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"isVarified" BOOLEAN NOT NULL DEFAULT false,
- "leetcode" TEXT,
- "showLC" BOOLEAN NOT NULL DEFAULT false,
- "codeforces" TEXT,
- "showCf" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("userID")
);
--- CreateTable
-CREATE TABLE "Poll" (
- "id" TEXT NOT NULL,
- "title" TEXT NOT NULL,
- "description" TEXT,
- "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "updatedAt" TIMESTAMP(3) NOT NULL,
- "userId" TEXT NOT NULL,
-
- CONSTRAINT "Poll_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "PollOption" (
- "id" TEXT NOT NULL,
- "text" TEXT NOT NULL,
- "pollId" TEXT NOT NULL,
-
- CONSTRAINT "PollOption_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "Vote" (
- "id" TEXT NOT NULL,
- "userId" TEXT NOT NULL,
- "optionId" TEXT NOT NULL,
- "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "Vote_pkey" PRIMARY KEY ("id")
-);
-
-- CreateTable
CREATE TABLE "UserVarify" (
"userID" TEXT NOT NULL,
@@ -164,18 +128,6 @@ CREATE UNIQUE INDEX "Rooms_id_title_key" ON "Rooms"("id", "title");
-- CreateIndex
CREATE UNIQUE INDEX "EnrolledRooms_userId_RoomId_key" ON "EnrolledRooms"("userId", "RoomId");
--- AddForeignKey
-ALTER TABLE "Poll" ADD CONSTRAINT "Poll_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE RESTRICT ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "PollOption" ADD CONSTRAINT "PollOption_pollId_fkey" FOREIGN KEY ("pollId") REFERENCES "Poll"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "Vote" ADD CONSTRAINT "Vote_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE RESTRICT ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "Vote" ADD CONSTRAINT "Vote_optionId_fkey" FOREIGN KEY ("optionId") REFERENCES "PollOption"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-
-- AddForeignKey
ALTER TABLE "Post" ADD CONSTRAINT "Post_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/backend/prisma/migrations/20240731125024_dev/migration.sql b/backend/prisma/migrations/20240731125024_dev/migration.sql
new file mode 100644
index 0000000..2581bb6
--- /dev/null
+++ b/backend/prisma/migrations/20240731125024_dev/migration.sql
@@ -0,0 +1,5 @@
+-- DropForeignKey
+ALTER TABLE "Rooms" DROP CONSTRAINT "Rooms_CreatorId_fkey";
+
+-- AddForeignKey
+ALTER TABLE "Rooms" ADD CONSTRAINT "Rooms_CreatorId_fkey" FOREIGN KEY ("CreatorId") REFERENCES "User"("username") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/backend/prisma/migrations/20240731132317_dev/migration.sql b/backend/prisma/migrations/20240731132317_dev/migration.sql
new file mode 100644
index 0000000..9ed152c
--- /dev/null
+++ b/backend/prisma/migrations/20240731132317_dev/migration.sql
@@ -0,0 +1,5 @@
+-- DropForeignKey
+ALTER TABLE "Rooms" DROP CONSTRAINT "Rooms_CreatorId_fkey";
+
+-- AddForeignKey
+ALTER TABLE "Rooms" ADD CONSTRAINT "Rooms_CreatorId_fkey" FOREIGN KEY ("CreatorId") REFERENCES "User"("userID") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/backend/prisma/migrations/20240816011135_init/migration.sql b/backend/prisma/migrations/20240816011135_init/migration.sql
new file mode 100644
index 0000000..26e2ed1
--- /dev/null
+++ b/backend/prisma/migrations/20240816011135_init/migration.sql
@@ -0,0 +1,24 @@
+-- CreateTable
+CREATE TABLE "Leetcode" (
+ "id" TEXT NOT NULL,
+ "acceptanceRate" DOUBLE PRECISION NOT NULL,
+ "contributionPoints" INTEGER NOT NULL,
+ "easySolved" INTEGER NOT NULL,
+ "hardSolved" INTEGER NOT NULL,
+ "mediumSolved" INTEGER NOT NULL,
+ "ranking" INTEGER NOT NULL,
+ "totalEasy" INTEGER NOT NULL,
+ "totalHard" INTEGER NOT NULL,
+ "totalMedium" INTEGER NOT NULL,
+ "totalQuestions" INTEGER NOT NULL,
+ "totalSolved" INTEGER NOT NULL,
+ "userId" TEXT NOT NULL,
+
+ CONSTRAINT "Leetcode_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Leetcode_userId_key" ON "Leetcode"("userId");
+
+-- AddForeignKey
+ALTER TABLE "Leetcode" ADD CONSTRAINT "Leetcode_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/backend/prisma/migrations/20240816063047_init/migration.sql b/backend/prisma/migrations/20240816063047_init/migration.sql
new file mode 100644
index 0000000..e3a3805
--- /dev/null
+++ b/backend/prisma/migrations/20240816063047_init/migration.sql
@@ -0,0 +1,14 @@
+/*
+ Warnings:
+
+ - You are about to drop the `Leetcode` table. If the table is not empty, all the data it contains will be lost.
+
+*/
+-- DropForeignKey
+ALTER TABLE "Leetcode" DROP CONSTRAINT "Leetcode_userId_fkey";
+
+-- AlterTable
+ALTER TABLE "User" ADD COLUMN "leetcode" TEXT;
+
+-- DropTable
+DROP TABLE "Leetcode";
diff --git a/backend/prisma/migrations/20240817011920_init/migration.sql b/backend/prisma/migrations/20240817011920_init/migration.sql
new file mode 100644
index 0000000..aea2fc1
--- /dev/null
+++ b/backend/prisma/migrations/20240817011920_init/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "User" ADD COLUMN "showLC" BOOLEAN NOT NULL DEFAULT false;
diff --git a/backend/prisma/migrations/20240820113120_development/migration.sql b/backend/prisma/migrations/20240820113120_development/migration.sql
new file mode 100644
index 0000000..99d4511
--- /dev/null
+++ b/backend/prisma/migrations/20240820113120_development/migration.sql
@@ -0,0 +1,3 @@
+-- AlterTable
+ALTER TABLE "User" ADD COLUMN "codeforces" TEXT,
+ADD COLUMN "showCf" BOOLEAN NOT NULL DEFAULT false;
diff --git a/backend/prisma/migrations/20240825232056_init/migration.sql b/backend/prisma/migrations/20240825232056_init/migration.sql
new file mode 100644
index 0000000..99f8ba8
--- /dev/null
+++ b/backend/prisma/migrations/20240825232056_init/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "User" ADD COLUMN "bgImg" TEXT;
diff --git a/backend/prisma/migrations/20240905164750_development/migration.sql b/backend/prisma/migrations/20240905164750_development/migration.sql
deleted file mode 100644
index 6ffc465..0000000
--- a/backend/prisma/migrations/20240905164750_development/migration.sql
+++ /dev/null
@@ -1,23 +0,0 @@
--- DropForeignKey
-ALTER TABLE "PollOption" DROP CONSTRAINT "PollOption_pollId_fkey";
-
--- DropForeignKey
-ALTER TABLE "Vote" DROP CONSTRAINT "Vote_optionId_fkey";
-
--- DropForeignKey
-ALTER TABLE "Vote" DROP CONSTRAINT "Vote_userId_fkey";
-
--- AlterTable
-ALTER TABLE "Poll" ADD COLUMN "subCommunity" TEXT;
-
--- AddForeignKey
-ALTER TABLE "Poll" ADD CONSTRAINT "Poll_subCommunity_fkey" FOREIGN KEY ("subCommunity") REFERENCES "Rooms"("title") ON DELETE CASCADE ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "PollOption" ADD CONSTRAINT "PollOption_pollId_fkey" FOREIGN KEY ("pollId") REFERENCES "Poll"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "Vote" ADD CONSTRAINT "Vote_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE CASCADE ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "Vote" ADD CONSTRAINT "Vote_optionId_fkey" FOREIGN KEY ("optionId") REFERENCES "PollOption"("id") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/backend/prisma/migrations/20240907193820_development/migration.sql b/backend/prisma/migrations/20240907193820_development/migration.sql
deleted file mode 100644
index 7fe8b0e..0000000
--- a/backend/prisma/migrations/20240907193820_development/migration.sql
+++ /dev/null
@@ -1,2 +0,0 @@
--- AlterTable
-ALTER TABLE "Poll" ADD COLUMN "topic" TEXT;
diff --git a/backend/prisma/migrations/20240908104001_poll/migration.sql b/backend/prisma/migrations/20240908104001_poll/migration.sql
new file mode 100644
index 0000000..00234dd
--- /dev/null
+++ b/backend/prisma/migrations/20240908104001_poll/migration.sql
@@ -0,0 +1,47 @@
+-- CreateTable
+CREATE TABLE "Poll" (
+ "id" TEXT NOT NULL,
+ "title" TEXT NOT NULL,
+ "topic" TEXT,
+ "description" TEXT,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL,
+ "userId" TEXT NOT NULL,
+ "subCommunity" TEXT,
+
+ CONSTRAINT "Poll_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "PollOption" (
+ "id" TEXT NOT NULL,
+ "text" TEXT NOT NULL,
+ "pollId" TEXT NOT NULL,
+
+ CONSTRAINT "PollOption_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "Vote" (
+ "id" TEXT NOT NULL,
+ "userId" TEXT NOT NULL,
+ "optionId" TEXT NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "Vote_pkey" PRIMARY KEY ("id")
+);
+
+-- AddForeignKey
+ALTER TABLE "Poll" ADD CONSTRAINT "Poll_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "Poll" ADD CONSTRAINT "Poll_subCommunity_fkey" FOREIGN KEY ("subCommunity") REFERENCES "Rooms"("title") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "PollOption" ADD CONSTRAINT "PollOption_pollId_fkey" FOREIGN KEY ("pollId") REFERENCES "Poll"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "Vote" ADD CONSTRAINT "Vote_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userID") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "Vote" ADD CONSTRAINT "Vote_optionId_fkey" FOREIGN KEY ("optionId") REFERENCES "PollOption"("id") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/frontend/src/pages/Room.jsx b/frontend/src/pages/Room.jsx
index 4f04a24..dba759e 100644
--- a/frontend/src/pages/Room.jsx
+++ b/frontend/src/pages/Room.jsx
@@ -456,8 +456,8 @@ export const RoomPost = ({title,privateRoom,joined,data})=>{
console.log('Request canceled:', error.message);
} else {
console.error(error);
- setHasMore(false); // Disable further fetching in case of error
- } // Stop fetching if there's an error
+ setHasMore(false);
+ }
}
}
@@ -494,8 +494,6 @@ export const RoomPost = ({title,privateRoom,joined,data})=>{
endMessage={hotposts.length > 0 ? {"You've reached the end of the page!"}
: No posts available to display!
}
>
-
-
{
(