Skip to content

Commit

Permalink
Merge pull request #12 from nDevers/use-strict
Browse files Browse the repository at this point in the history
merge: use-strict into main
  • Loading branch information
montasim authored Jan 27, 2025
2 parents 8c5b34b + 0f4e77d commit 1819c32
Show file tree
Hide file tree
Showing 138 changed files with 6,213 additions and 1,661 deletions.
498 changes: 498 additions & 0 deletions .env.example

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@

# Generic folder for production deployments.
.out/
/out
/dist


####################################################
Expand Down Expand Up @@ -129,9 +131,12 @@ yarn-error.log*
# Environment variables for production builds.
.env.production

# Local variations of environment files.
# Local variables of environment files.
.env*.local

# Local variables of sentry environment files.
.env.sentry-build-plugin


####################################################
# TESTING
Expand Down Expand Up @@ -195,4 +200,4 @@ next-env.d.ts
# unauthorized access to uploaded files.

# User-uploaded files stored temporarily.
/public/assets
/public/assets
10 changes: 5 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ fi
# anti-patterns, and potential bugs, contributing to cleaner and more reliable code.

#echo "Running ESLint checks..."
#npm run eslint:check
npm run eslint:check

# Check the exit code of the ESLint command to determine if it succeeded.
#if [ $? -ne 0 ]; then
# echo "ESLint checks failed. Please fix the linting errors and try again."
# exit 1 # Exit with a non-zero status to abort the commit if ESLint checks fail.
#fi
if [ $? -ne 0 ]; then
echo "ESLint checks failed. Please fix the linting errors and try again."
exit 1 # Exit with a non-zero status to abort the commit if ESLint checks fail.
fi

####################################################
# FINAL MESSAGE
Expand Down
2 changes: 1 addition & 1 deletion addUseStrict.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const addUseStrictToFile = (filePath) => {
if (err) {
console.error(`Error writing to file: ${filePath}`, err);
} else {
console.log(`Added 'use strict'; to ${filePath}`);
console.info(`Added 'use strict'; to ${filePath}`);
}
});
}
Expand Down
1 change: 0 additions & 1 deletion app/(home)/(files)/notice/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PageTitle from '@/components/admin/common/PageTitle';
import FileCard from '@/components/card/FileCard';
import React from 'react';

export default function NoticePage() {
const data = [
Expand Down
1 change: 0 additions & 1 deletion app/(home)/(files)/result/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PageTitle from '@/components/admin/common/PageTitle';
import FileCard from '@/components/card/FileCard';
import React from 'react';

export default function ResultPage() {
const data = [
Expand Down
1 change: 0 additions & 1 deletion app/(home)/(files)/routine/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PageTitle from '@/components/admin/common/PageTitle';
import FileCard from '@/components/card/FileCard';
import React from 'react';

export default function RoutinePage() {
const data = [
Expand Down
1 change: 0 additions & 1 deletion app/(home)/academic/speech/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PageTitle from '@/components/admin/common/PageTitle';
import React from 'react';

export default function SpeechPage() {
return (
Expand Down
2 changes: 0 additions & 2 deletions app/(home)/admission/form/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function AdmissionFormPage() {
return <div>AdmissionFormPage</div>;
}
2 changes: 0 additions & 2 deletions app/(home)/admission/info/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function AdmissionInfoPage() {
return <div>AdmissionInfoPage</div>;
}
2 changes: 0 additions & 2 deletions app/(home)/blog/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function BlogPage() {
return <div>BlogPage</div>;
}
4 changes: 2 additions & 2 deletions app/(home)/contact/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default function ContactPage() {
Get in Touch
</h1>
<p>
Have a question or just want to say hi? We'd love to
hear from you.
Have a question or just want to say hi? We&apos;d love
to hear from you.
</p>
</div>
<div className="grid md:grid-cols-3 gap-10">
Expand Down
2 changes: 1 addition & 1 deletion app/(home)/gallery/photo/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client';
import React from 'react';

import apiConfig from '@/configs/apiConfig';
import PageTitle from '@/components/admin/common/PageTitle';
import PhotoGallery from '@/components/card/PhotoGallery';
Expand Down
1 change: 0 additions & 1 deletion app/(home)/gallery/video/page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PageTitle from '@/components/admin/common/PageTitle';
import VideoPlayer from '@/components/card/VideoPlayer';

Expand Down
2 changes: 0 additions & 2 deletions app/(home)/other/career/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function CareerPage() {
return <div>CareerPage</div>;
}
2 changes: 0 additions & 2 deletions app/(home)/other/holiday/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function HolidayPage() {
return <div>HolidayPage</div>;
}
2 changes: 0 additions & 2 deletions app/(home)/other/meritorious-student/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function MeritoriousStudentPage() {
return <div>MeritoriousStudentPage</div>;
}
2 changes: 0 additions & 2 deletions app/(home)/other/transportation/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function TransportationPage() {
return <div>TransportationPage</div>;
}
3 changes: 2 additions & 1 deletion app/admin/about/achievement/edit/[id]/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import apiConfig from '@/configs/apiConfig';

import NoDataFound from '@/components/admin/common/NoDataFound';
import PageTitle from '@/components/admin/common/PageTitle';
import SchoolAchievementForm from '@/components/admin/form/SchoolAchievementForm';
import apiConfig from '@/configs/apiConfig';
import { fetchDataAsServer } from '@/util/axios';

export default async function SchoolAchievementEditPage({ params }) {
Expand Down
3 changes: 2 additions & 1 deletion app/admin/about/carousel/edit/[id]/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import apiConfig from '@/configs/apiConfig';

import NoDataFound from '@/components/admin/common/NoDataFound';
import PageTitle from '@/components/admin/common/PageTitle';
import CarouselForm from '@/components/admin/form/CarouselForm';
import apiConfig from '@/configs/apiConfig';
import { fetchDataAsServer } from '@/util/axios';

export default async function CategoryEditPage({ params }) {
Expand Down
8 changes: 1 addition & 7 deletions app/admin/page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import React from 'react';
import {
Card,
CardHeader,
CardContent,
CardFooter,
} from '@/components/ui/card';
import { Card, CardHeader, CardContent } from '@/components/ui/card';

export default function Dashboard() {
return (
Expand Down
10 changes: 10 additions & 0 deletions app/api/sentry-example-api/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// import { NextResponse } from 'next/server';

export const dynamic = 'force-dynamic';

// A faulty API route to test Sentry's error monitoring
export function GET() {
throw new Error('Sentry Example API Route Error');

// return NextResponse.json({ data: 'Testing Sentry Error...' });
}
1 change: 0 additions & 1 deletion app/api/v1/admin/about-us/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ const handleUpdateAboutUsById = async (request, context) => {

if (userInput?.deleteImages && Array.isArray(userInput.deleteImages)) {
// Check if all images in deleteImages actually exist in the current images array
console.log(existingCareer?.images);
const nonExistingImages = userInput.deleteImages.filter(
(imageId) =>
!existingCareer?.images?.some(
Expand Down
1 change: 0 additions & 1 deletion app/api/v1/admin/blog/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ const handleUpdateBlogById = async (request, context) => {

if (userInput?.deleteImages && Array.isArray(userInput.deleteImages)) {
// Check if all images in deleteImages actually exist in the current images array
console.log(existingBlog?.images);
const nonExistingImages = userInput.deleteImages.filter(
(imageId) =>
!existingBlog?.images?.some(
Expand Down
5 changes: 1 addition & 4 deletions app/api/v1/admin/blog/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import parseAndValidateFormData from '@/util/parseAndValidateFormData';
import validateToken from '@/util/validateToken';
import blogSelectionCriteria from '@/app/api/v1/blog/blog.selection.criteria';

const { INTERNAL_SERVER_ERROR, CONFLICT, CREATED, NOT_FOUND } =
sharedResponseTypes;
const { INTERNAL_SERVER_ERROR, CONFLICT, CREATED } = sharedResponseTypes;

/**
* Asynchronously creates an "About Us" blog entry in the database and retrieves the created document with specific selection criteria.
Expand Down Expand Up @@ -168,8 +167,6 @@ const handleCreateAboutUs = async (request, context) => {
true
).toDate();

console.log(userInput);

// Create the FAQ entry and send the response
return createAboutUsEntry(userInput, request);
};
Expand Down
2 changes: 0 additions & 2 deletions app/api/v1/admin/gallery/photo/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ const handleUpdateGalleryPhotoById = async (request, context) => {
delete userInput.deleteImages; // Remove deleteImages field from userInput
}

console.log(userInput);

// Create the FAQ entry and send the response
return updateGalleryPhotoEntry(userInput, request);
};
Expand Down
3 changes: 1 addition & 2 deletions app/api/v1/admin/school/info/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import parseAndValidateFormData from '@/util/parseAndValidateFormData';
import validateToken from '@/util/validateToken';
import schoolInfoSelectionCriteria from '@/app/api/v1/school/info/school.info.selection.criteria';

const { INTERNAL_SERVER_ERROR, CONFLICT, CREATED, NOT_FOUND } =
sharedResponseTypes;
const { INTERNAL_SERVER_ERROR, CONFLICT, CREATED } = sharedResponseTypes;

/**
* Creates a new school information entry in the database and retrieves the created document with specified selection criteria.
Expand Down
2 changes: 2 additions & 0 deletions app/api/v1/announcement/announcement.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const allowedMimeTypes = [
mimeTypesConstants.JPG,
mimeTypesConstants.PNG,
mimeTypesConstants.GIF,

mimeTypesConstants.PDF,
];

/**
Expand Down
1 change: 1 addition & 0 deletions app/api/v1/auth/auth.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const resetPassword = z
decodedPassword = decryptData(data?.password); // Decode password
decodedConfirmPassword = decryptData(data?.confirmPassword); // Decode confirmPassword
} catch (err) {
console.error('Error decoding password or confirmPassword:', err);
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Invalid encrypted password or confirmPassword',
Expand Down
3 changes: 0 additions & 3 deletions app/api/v1/auth/refresh-token/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const handleRefreshToken = async (request) => {
const { accessToken, refreshToken } =
await createAuthenticationToken(userTokenData);

console.log(accessToken);
console.log(refreshToken);

// Encrypt the token for response
const returnData = {
accessToken: encryptData(accessToken),
Expand Down
2 changes: 0 additions & 2 deletions app/api/v1/configuration/configuration.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import constants from '@/constants/constants';

const {
nonEmptyString,
nonEmptyStringArray,
validMongooseId,
validDate,
filesValidator,
validEmailArray,
Expand Down
23 changes: 23 additions & 0 deletions app/global-error.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use client';

import * as Sentry from '@sentry/nextjs';
import NextError from 'next/error';
import { useEffect } from 'react';

export default function GlobalError({ error }) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);

return (
<html>
<body>
{/* `NextError` is the default Next.js error page component. Its type
definition requires a `statusCode` prop. However, since the App Router
does not expose status codes for errors, we simply pass 0 to render a
generic error message. */}
<NextError statusCode={0} />
</body>
</html>
);
}
8 changes: 6 additions & 2 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Wrapper from '@/providers/Wrapper';
import appConfig from '@/configs/appConfig';
import { Toaster } from '@/components/ui/sonner';
import { Inter, Satisfy } from 'next/font/google';
import { Noto_Sans_Bengali, Noto_Serif_Bengali } from 'next/font/google'; // Import the Bangla font
import {
Inter,
Satisfy,
Noto_Sans_Bengali,
Noto_Serif_Bengali,
} from 'next/font/google';

import './globals.css';
import 'react-photo-view/dist/react-photo-view.css';
Expand Down
Loading

0 comments on commit 1819c32

Please sign in to comment.