File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { NextResponse } from "next/server" ;
22import { connectToDatabase } from "@/lib/database/mongoose" ;
3- import UpcomingSlot from "@/db/upcoming-slot" ;
43import UpcomingSubject from "@/db/upcoming-paper" ;
5- import { calculateCorrespondingSlots } from "@/lib/utils/slot-calculation" ;
64
75export const dynamic = "force-dynamic" ;
86
97export async function GET ( ) {
108 try {
119 await connectToDatabase ( ) ;
12- const upcomingSlot = await UpcomingSlot . find ( ) ;
13- const slot = upcomingSlot [ 0 ] ?. slot ;
14-
15- if ( ! slot ) {
16- return NextResponse . json (
17- {
18- message : "No slot found." ,
19- } ,
20- { status : 404 } ,
21- ) ;
22- }
23-
24- const correspondingSlots = calculateCorrespondingSlots ( slot ) ;
25- const selectedSubjects = await UpcomingSubject . find ( {
26- slots : { $in : correspondingSlots } ,
27- } ) ;
10+ const selectedSubjects = await UpcomingSubject . find ( )
11+ . sort ( { _id : 1 } )
12+ . limit ( 16 )
13+ . lean ( ) ;
2814
2915 if ( selectedSubjects . length === 0 ) {
3016 return NextResponse . json (
@@ -47,4 +33,4 @@ export async function GET() {
4733 { status : 500 } ,
4834 ) ;
4935 }
50- }
36+ }
Original file line number Diff line number Diff line change @@ -52,11 +52,7 @@ export default function PaperRequest() {
5252 "/api/upcoming-papers" ,
5353 ) ;
5454
55- const randomPapers = [ ...response . data ]
56- . sort ( ( ) => Math . random ( ) - 0.5 )
57- . slice ( 0 , 8 ) ;
58-
59- setDisplayPapers ( randomPapers ) ;
55+ setDisplayPapers ( response . data ) ;
6056 } catch ( error ) {
6157 console . error ( "Failed to fetch papers:" , error ) ;
6258 } finally {
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export default function Footer() {
104104 { /* Events */ }
105105 < div className = "flex w-full flex-col gap-2 text-black dark:text-white lg:w-[15%]" >
106106 < h3 className = "font-jost text-xl font-semibold" > Events</ h3 >
107- < Link href = "https://devsoc25 .codechefvit.com" target = "_blank" > DevSOC</ Link >
107+ < Link href = "https://devsoc26 .codechefvit.com" target = "_blank" > DevSOC</ Link >
108108 < Link href = "https://gravitas.codechefvit.com" target = "_blank" > CookOff</ Link >
109109 < Link href = "https://gravitas.codechefvit.com" target = "_blank" > Clueminati</ Link >
110110 </ div >
You can’t perform that action at this time.
0 commit comments