-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DB: shcema for ratings, fix build error
- Loading branch information
1 parent
e2041da
commit 97c74bb
Showing
10 changed files
with
313 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NextResponse, NextRequest } from "next/server"; | ||
import prisma from "../../../lib/prisma"; | ||
import { auth } from "../../../lib/auth"; | ||
|
||
export async function GET(request: NextRequest) { | ||
const courses = await prisma.course.findMany({ | ||
select: { | ||
id: true, | ||
courseTitle: true, | ||
}, | ||
where: { year: "S2025" }, | ||
}); | ||
//console.log(plans); | ||
return NextResponse.json(courses, { status: 200 }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export default function DocsLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<section className="flex flex-col items-center justify-center gap-4 "> | ||
<div className="inline-block max-w-lg text-center justify-center "> | ||
{children} | ||
</div> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"use client"; | ||
import { | ||
Card, | ||
CardBody, | ||
CardHeader, | ||
Textarea, | ||
Select, | ||
SelectItem, | ||
Popover, | ||
Autocomplete, | ||
AutocompleteItem, | ||
Button, | ||
Chip, | ||
Input, | ||
} from "@nextui-org/react"; | ||
import useSWR from "swr"; | ||
|
||
export default function RatingPage() { | ||
const fetcher = (url: any) => fetch(url).then((r) => r.json()); | ||
const { | ||
data: courses, | ||
isLoading, | ||
error, | ||
} = useSWR("/api/getCourses", fetcher, {}); | ||
return ( | ||
<Card className=""> | ||
<CardHeader className=""> | ||
<h1 className=" text-center ml-auto mr-auto col-span-3 row-start-1 row-span-1 text-2xl"> | ||
Leave a Rating | ||
</h1> | ||
</CardHeader> | ||
<CardBody className="grid grid-cols-10 grid-rows-6 gap-10 px-10 justify-center items-center"> | ||
<Autocomplete | ||
variant={"bordered"} | ||
labelPlacement="outside-left" | ||
label="Select a Class" | ||
placeholder="Search for a class" | ||
className="col-span-8 col-start-2 max-w-xs " | ||
> | ||
{courses?.map((course: any) => ( | ||
<AutocompleteItem key={course.id}> | ||
{course.courseTitle} | ||
</AutocompleteItem> | ||
))} | ||
</Autocomplete> | ||
|
||
<Textarea | ||
disableAutosize | ||
className="row-start-3 col-span-3 row-span-2" | ||
label="Review" | ||
placeholder="What did you think of this prof/class?" | ||
></Textarea> | ||
</CardBody> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.