Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/actions/posts/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function CreateJob(postdata: createJobSchemaType) {
salary_disclosed: postdata.salary_disclosed,
salary_max: postdata.salary_max,
salary_min: postdata.salary_min,
approved: false,
approved: response.role === "ADMIN" ? true : false,
author: {
connect: {
id: response.userId,
Expand Down
1 change: 1 addition & 0 deletions app/actions/users/checkUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export async function CheckUser() {
status: 200,
message: "Logged In",
userId: session.user.id,
role: isUser.role,
};
} catch (error: any) {
return {
Expand Down
2 changes: 2 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { auth } from "@/auth";
import { Toaster } from "@/components/ui/sonner";
import Loader from "./loading";
import RegisterSw from "@/components/RegisterSw";
import { Analytics } from "@vercel/analytics/react";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -33,6 +34,7 @@ export default async function RootLayout({
<Toaster />
<RegisterSw />
</div>
<Analytics />
</AuthProvider>
</Suspense>
</body>
Expand Down
8 changes: 7 additions & 1 deletion components/Job/MoreDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ export function BookmarkPostComp({ postId }: { postId: string }) {
return (
<>
<div className="flex gap-2">
<div onClick={() => handleBookmarkClick()}>
<div
onClick={(e: any) => {
e.stopPropagation();

handleBookmarkClick();
}}
>
<Bookmark
className={`size-4 cursor-pointer md:size-6 ${
bookmarked ? "fill-white" : ""
Expand Down
7 changes: 0 additions & 7 deletions components/Job/filterCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import ApplyFilterBtn from "./applyBtn";
import ClearFilterBtn from "./clearFIlterBtn";

const experienceValues = ["Fresher", "0-1y", "1y", "3y", "5y"];
Expand Down Expand Up @@ -107,8 +106,6 @@ export default function FilterSideBar() {
</div>
);
})}

<ApplyFilterBtn fn={callBackend} />
</SelectContent>
</Select>

Expand Down Expand Up @@ -140,8 +137,6 @@ export default function FilterSideBar() {
</div>
);
})}

<ApplyFilterBtn fn={callBackend} />
</SelectContent>
</Select>

Expand Down Expand Up @@ -173,8 +168,6 @@ export default function FilterSideBar() {
</div>
);
})}

<ApplyFilterBtn fn={callBackend} />
</SelectContent>
</Select>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const publicRoutes = ["/", "/jobs", "/api/jobs"];
export const publicRoutes = ["/", "/jobs", "/api/jobs", "/jobs/[id]"];

export const authRoutes = ["/signin", "/signup"];

Expand Down
13 changes: 12 additions & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@ import {
REDIRECT_URL,
} from "@/lib/auth";

function matchPublicRoute(pathname: string) {
return publicRoutes.some((route) => {
if (route.includes("[id]")) {
//eslint-disable-next-line
const regex = new RegExp("^" + route.replace("[id]", "[^/]+") + "$");
return regex.test(pathname);
}
return route === pathname;
});
}

export default auth((req) => {
const { nextUrl } = req;
const isLoggedIn = !!req.auth;
const isNextApiRoute = nextUrl.pathname.startsWith(nextApiRoutes);
const isAuthRoute = authRoutes.includes(nextUrl.pathname);
const isPublicRoute = publicRoutes.includes(nextUrl.pathname);
const isPublicRoute = matchPublicRoute(nextUrl.pathname);
const isAdminRoute = nextUrl.pathname.startsWith(adminRoute);

if (isNextApiRoute) return NextResponse.next();
Expand Down
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@tiptap/starter-kit": "^2.6.6",
"@types/bcryptjs": "^2.4.6",
"@typescript-eslint/parser": "^8.14.0",
"@vercel/analytics": "^1.5.0",
"bcryptjs": "^2.4.3",
"class-variance-authority": "^0.7.0",
"cloudinary": "^2.5.1",
Expand Down
2 changes: 1 addition & 1 deletion schema/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const createJobSchema = z
position: z
.string({ message: "Position is required" })
.min(2, { message: "Extend it little" })
.max(20, { message: "Keep it shorter" }),
.max(25, { message: "Keep it shorter" }),

company: z
.string({ message: "Company name is required" })
Expand Down