Skip to content

Commit

Permalink
ENH:merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Charvit123 committed Jul 4, 2023
2 parents d71542f + cd6b744 commit 3c5107c
Show file tree
Hide file tree
Showing 22 changed files with 233 additions and 154 deletions.
4 changes: 2 additions & 2 deletions admin/src/components/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ const HomePage = () => {
dataTestId="courseCard"
count={allCourse?.length}
header="Total Courses"
link="/"
linkText="See All Course"
link="/courses"
linkText="See All Courses"
></HomeCard>
</div>
<ToastContainer />
Expand Down
8 changes: 4 additions & 4 deletions admin/src/components/course/AddCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,17 @@ const AddCourse = () => {

<Navbar
isCourse={true}
isHome={true}
isProfile={true}
isUser={false}
isHome={false}
isProfile={false}
isUser={true}
isTag={false}
></Navbar>
<div>
<h1
className="text-center pt-10 text-3xl font-bold"
data-testid="addCourseHeading"
>
Add Courses
Add Course
</h1>
</div>
<div className="flex justify-center">
Expand Down
2 changes: 1 addition & 1 deletion admin/src/components/tag/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Tags = () => {
className="text-3xl font-semibold"
data-testid="modelHeader"
>
Update Tags here
Update Tag here
</h3>
<button
className="TagModalUploadButton"
Expand Down
1 change: 0 additions & 1 deletion admin/src/components/user/AddUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const AddUser = (props: addUserProps) => {
var workbook = XLSX.read(bstr, { type: "binary" });
var first_sheet_name = workbook.SheetNames[0];
var worksheet = workbook.Sheets[first_sheet_name];
console.log(XLSX.utils.sheet_to_json(worksheet, { raw: true }));
arraylist = XLSX.utils.sheet_to_json(worksheet, { raw: true });
if (arraylist.length > 0) handleSubmit();
};
Expand Down
69 changes: 38 additions & 31 deletions admin/src/components/utilities/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,6 @@ const Navbar = (props: NavbarProps) => {
Home
</Link>
)}
{props.isCourse && (
<Link
to="/courses"
className="navbarHeaderItems"
data-testid="navbarHeaderCourseLink"
>
Courses
</Link>
)}
{!props.isCourse && (
<Link
to="/addCourse"
className="navbarHeaderItems"
data-testid="navbarHeaderCourseLink"
>
Add Course
</Link>
)}

{props.isUser && (
<Link
to="/users"
Expand All @@ -103,6 +84,24 @@ const Navbar = (props: NavbarProps) => {
Add User
</button>
)}
{props.isCourse && (
<Link
to="/courses"
className="navbarHeaderItems"
data-testid="navbarHeaderCourseLink"
>
Courses
</Link>
)}
{!props.isCourse && (
<Link
to="/addCourse"
className="navbarHeaderItems"
data-testid="navbarHeaderCourseLink"
>
Add Course
</Link>
)}
{!props.isTag && (
<Link
to="/tags"
Expand Down Expand Up @@ -157,8 +156,22 @@ const Navbar = (props: NavbarProps) => {
Home
</Link>
)}
{!props.isUser && (
<button
className="navbarHeaderItems"
data-testid="navbarHeaderAddUserLink"
onClick={addUser}
>
Add User
</button>
)}
{props.isUser && (
<Link to="/users" className="navbarHeaderItems">
Users
</Link>
)}
{props.isCourse && (
<Link to="/course" className="navbarHeaderItems">
<Link to="/courses" className="navbarHeaderItems">
Courses
</Link>
)}
Expand All @@ -171,19 +184,13 @@ const Navbar = (props: NavbarProps) => {
Add Courses
</Link>
)}

{!props.isUser && (
<button
{!props.isTag && (
<Link
to="/tags"
className="navbarHeaderItems"
data-testid="navbarHeaderAddUserLink"
onClick={addUser}
data-testid="navbarHeaderTagLink"
>
Add User
</button>
)}
{props.isUser && (
<Link to="/users" className="navbarHeaderItems">
Users
Tags
</Link>
)}
<button
Expand Down
64 changes: 34 additions & 30 deletions backend/package-lock.json

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

4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@nestjs/jwt": "^10.0.2",
"@nestjs/passport": "^9.0.3",
"@nestjs/platform-express": "^9.0.0",
"@prisma/client": "^4.11.0",
"@prisma/client": "^4.12.0",
"bcrypt": "^5.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
Expand All @@ -41,7 +41,6 @@
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"prisma": "^4.11.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0",
"validator": "^13.9.0"
Expand All @@ -63,6 +62,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jest": "29.3.1",
"prettier": "^2.3.2",
"prisma": "^4.12.0",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.0.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- DropForeignKey
ALTER TABLE "CourseTag" DROP CONSTRAINT "CourseTag_courseId_fkey";

-- DropForeignKey
ALTER TABLE "CourseTag" DROP CONSTRAINT "CourseTag_tagId_fkey";

-- AddForeignKey
ALTER TABLE "CourseTag" ADD CONSTRAINT "CourseTag_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "CourseTag" ADD CONSTRAINT "CourseTag_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `tags` on the `Course` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Course" DROP COLUMN "tags";
8 changes: 2 additions & 6 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
}
Expand Down Expand Up @@ -42,7 +39,6 @@ model Course {
testUrls String[]
imageUrl String
credit Float
tags Int[]
description String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand All @@ -59,9 +55,9 @@ model Tag {
model CourseTag {
id Int @id @default(autoincrement())
courseId String
course Course @relation(fields: [courseId], references: [id])
course Course @relation(fields: [courseId], references: [id], onDelete: Cascade)
tagId Int
tag Tag @relation(fields: [tagId], references: [id])
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
}

model UserCourse {
Expand Down
Loading

0 comments on commit 3c5107c

Please sign in to comment.