Skip to content

Commit 2a60fed

Browse files
fix: clean up code formatting and remove unnecessary comments across multiple files
1 parent 08f02c7 commit 2a60fed

File tree

13 files changed

+20
-101
lines changed

13 files changed

+20
-101
lines changed

src/app/actions/get-papers-by-id.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// "use server";
2-
import { type PaperResponse } from "@/interface";
1+
import { type PaperResponse } from "@/interface";
32
import axios, { type AxiosResponse } from "axios";
43

54
export const fetchPaperID = async (id: string): Promise<PaperResponse> => {

src/app/api/ai-upload/route.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cloudinary.v2.config({
2525
api_key: process.env.CLOUDINARY_API_KEY,
2626
api_secret: process.env.CLOUDINARY_SECRET,
2727
});
28-
type SemesterType = IAdminPaper["semester"]; // Extract the exam type from the IPaper interface
28+
type SemesterType = IAdminPaper["semester"];
2929

3030
const config1 = {
3131
cloud_name: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME_1,
@@ -54,7 +54,7 @@ export async function POST(req: Request) {
5454
const uploadPreset = process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET;
5555
const formData = await req.formData();
5656
const files: File[] = formData.getAll("files") as File[];
57-
const isPdf = formData.get("isPdf") === "true"; // Convert string to boolean
57+
const isPdf = formData.get("isPdf") === "true";
5858

5959
let pdfData = "";
6060

@@ -129,8 +129,6 @@ export async function POST(req: Request) {
129129
);
130130
}
131131

132-
// If all checks pass, continue with the rest of the logic
133-
134132
let finalUrl: string | undefined = "";
135133
let public_id_cloudinary: string | undefined = "";
136134
let thumbnailUrl: string | undefined = "";
@@ -255,7 +253,7 @@ async function CreatePDF(orderedFiles: File[]) {
255253
return mergedPdfBytes;
256254
}
257255

258-
//sets course-name to corresponding course name from our api
256+
// Sets course-name to corresponding course name from our api
259257
async function setTagsFromCurrentLists(
260258
tags: ExamDetail | undefined,
261259
courses: string[],
@@ -309,7 +307,7 @@ async function setTagsFromCurrentLists(
309307
return newTags;
310308
}
311309
function findMatch<T>(arr: T[], value: string | undefined): T | undefined {
312-
if (!value) return undefined; // Handle undefined case
310+
if (!value) return undefined;
313311
const pattern = new RegExp(value, "i");
314312
return arr.find((item) => pattern.test(String(item)));
315313
}

src/app/api/paper-by-id/[id]/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ export async function GET(req: Request, { params }: { params: { id: string } })
1414
}
1515

1616
const paper = await Paper.findById(id);
17-
18-
17+
1918
if (!paper) {
2019
return NextResponse.json({ message: "Paper not found" }, { status: 404 });
2120
}

src/app/api/papers/count/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ export async function GET() {
88
try {
99
await connectToDatabase();
1010

11-
1211
const count: number = await Paper.countDocuments();
1312

1413
return NextResponse.json(
15-
{ count },
14+
{ count },
1615
{ status: 200 }
1716
);
1817
} catch (error) {

src/app/api/signImage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export async function POST(request: Request) {
99
paramsToSign,
1010
process.env.CLOUDINARY_SECRET!,
1111
);
12-
return Response.json({ signature }, { status: 200});
12+
return Response.json({ signature }, { status: 200 });
1313
}

src/app/api/upcoming-papers/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { NextResponse } from "next/server";
22
import { connectToDatabase } from "@/lib/mongoose";
3-
import Paper from "@/db/papers";
43
import UpcomingSlot from "@/db/upcoming-slot";
54
import UpcomingSubject from "@/db/upcoming-paper";
6-
import next from "next";
75

86
export const dynamic = "force-dynamic";
97

@@ -23,7 +21,7 @@ export async function GET() {
2321
const nextSlot = String.fromCharCode(slot.charCodeAt(0) + 1)
2422
const correspondingSlots = [slot + "1", slot + "2", nextSlot + "1", nextSlot + "2"];
2523
const selectedSubjects = await UpcomingSubject.find({
26-
slots: { $in: correspondingSlots }, // Match any slot in the array
24+
slots: { $in: correspondingSlots },
2725
});
2826
if (selectedSubjects.length === 0) {
2927
return NextResponse.json(

src/app/api/upload/route.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import cloudinary from "cloudinary";
66
import { type ICourses, type CloudinaryUploadResult } from "@/interface";
77
import Paper, { PaperAdmin } from "@/db/papers";
88
import axios from "axios";
9-
// TODO: REMOVE THUMBNAIL FROM admin-buffer DB
109

1110
const cloudinaryConfig1 = cloudinary.v2;
1211
cloudinaryConfig1.config({
@@ -43,7 +42,7 @@ export async function POST(req: Request) {
4342
const campus = formData.get("campus") as string;
4443
const semester = formData.get("semester") as string;
4544

46-
const isPdf = formData.get("isPdf") === "true"; // Convert string to boolean
45+
const isPdf = formData.get("isPdf") === "true";
4746

4847
const { data } = await axios.get<ICourses[]>(`${process.env.SERVER_URL}/api/course-list`);
4948
const courses = data.map((course: { name: string }) => course.name);
@@ -54,7 +53,7 @@ export async function POST(req: Request) {
5453
years.includes(year) &&
5554
exams.includes(exam) &&
5655
campuses.includes(campus) &&
57-
semesters.includes(semester)
56+
semesters.includes(semester)
5857
)
5958
) {
6059
return NextResponse.json({ message: "Bad Request" }, { status: 400 });

src/app/catalogue/page.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ import { Suspense } from "react";
55
import Loader from "@/components/ui/loader";
66
const Catalogue = () => {
77
return (
8-
<>
9-
10-
<Suspense fallback={<Loader />}>
11-
<CatalogueContent />
12-
</Suspense>
13-
</>
8+
<Suspense fallback={<Loader />}>
9+
<CatalogueContent />
10+
</Suspense>
1411
);
1512
};
1613

src/app/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export default function RootLayout({
9292
}: {
9393
children: React.ReactNode;
9494
}) {
95-
9695
return (
9796
<html lang="en" className={`${GeistSans.variable}`}>
9897
<meta

src/app/manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function manifest(): MetadataRoute.Manifest {
2323
"productivity",
2424
"technology"
2525
],
26-
"shortcuts": [
26+
shortcuts: [
2727
{
2828
"name": "Upload",
2929
"short_name": "Upload",

0 commit comments

Comments
 (0)