Skip to content

Commit d6ae3f2

Browse files
Updated courses structures
1 parent 7649057 commit d6ae3f2

6 files changed

Lines changed: 42 additions & 21 deletions

File tree

src/pages/courses/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,27 @@ export default function Courses() {
279279
</div>
280280
<div className="flex gap-2 items-center">
281281
<p className="font-semibold">
282-
Course Code:
282+
Code:
283283
</p>
284284
<p>{course.code}</p>
285285
</div>
286+
<div className="flex gap-2 items-center">
287+
<p className="font-semibold">
288+
Title :
289+
</p>
290+
<p>{course.title}</p>
291+
</div>
292+
<div className="flex gap-2 items-center">
293+
<p className="font-semibold">
294+
Credits:
295+
</p>
296+
<p>{course.credits}</p>
297+
</div>
286298
<div className="flex gap-2 items-center">
287299
<p className="font-semibold">
288300
Instructor:
289301
</p>
290-
<p>{course.instructorName}</p>
302+
<p>{course.instructor}</p>
291303
</div>
292304
<div className="flex gap-2 items-center">
293305
<p className="font-semibold">

src/services/db/courses/addCourse.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@ import { toast } from 'react-hot-toast'
22
import { api } from '../../../utils/api'
33

44
interface Props {
5-
title: string
5+
id: string
66
code: string
7-
instructorName:string
8-
isAnonymous: boolean
7+
title: string
8+
department: string
9+
credits: number
10+
instructor: string
911
refetch: Function
1012
}
1113

1214
export const addCourse = ({
1315
title,
1416
code,
15-
instructorName,
16-
isAnonymous,
17+
instructor,
18+
credits,
1719
refetch,
1820
}: Props) => {
1921
toast.promise(
2022
api.post('/api/db/courses', {
2123
title,
2224
code,
23-
instructorName,
24-
isAnonymous,
25+
instructor,
26+
credits,
2527
}),
2628
{
2729
loading: 'Adding...',

src/services/db/courses/deleteCourse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { toast } from 'react-hot-toast'
22
import { api } from '../../../utils/api'
33

4-
export const deleteCourse = (id: number, refetchCourses: Function) => {
4+
export const deleteCourse = (id: string, refetchCourses: Function) => {
55
api.delete('/api/db/courses?id=' + id)
66
.then((res) => {
77
refetchCourses()

src/services/db/courses/removeCourseUpvote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { api } from '../../../utils/api'
33
import { Dispatch, SetStateAction } from 'react'
44

55
interface Props {
6-
id: number
6+
id: string
77
setCount: Dispatch<SetStateAction<number>>
88
setIsUpvoted: Dispatch<SetStateAction<boolean>>
99
}

src/services/db/courses/updateCourse.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import { toast } from 'react-hot-toast'
22
import { api } from '../../../utils/api'
3+
import { Bool } from 'aws-sdk/clients/clouddirectory'
34

45
interface Props {
5-
id: number
6-
title: string
6+
id: string
77
code: string
8-
isAnonymous: boolean
8+
title: string
9+
department: string
10+
credits: number
11+
instructor: string
912
refetch: Function
1013
}
1114

1215
export const updateCourse = ({
1316
id,
1417
title,
1518
code,
16-
isAnonymous,
19+
credits,
1720
refetch,
1821
}: Props) => {
1922
toast.promise(
2023
api.put('/api/db/courses?id=' + id, {
2124
title,
2225
code,
23-
anonymous:isAnonymous,
2426
}),
2527
{
2628
loading: 'Updating...',

src/types/coursesColumnData.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
export interface coursesColumnData {
2-
sno: string
3-
upvotes: number
2+
id:string
3+
// sno: string
4+
// upvotes: number
5+
credits:number
6+
instructor:string
7+
department:string
48
title: string
5-
courseCode: string
6-
uploadedBy: string
7-
actions: JSX.Element
9+
code: string
10+
// uploadedBy: string
11+
// actions: JSX.Element
12+
813
}

0 commit comments

Comments
 (0)