Skip to content

Open source alternatives to paid SaaS apps: Notion, Slack, Auth0, Vercel and more. Curated list with licenses and GitHub stars.

Remove unrelated code files

Anil Chandra Naidu Matchade20528abe82
diff --git a/src/app/api/posts/[id]/route.js b/src/app/api/posts/[id]/route.js
deleted file mode 100644
index 3240e23..0000000
--- a/src/app/api/posts/[id]/route.js
+++ /dev/null
@@ -1,84 +0,0 @@
-import { NextResponse } from "next/server";
-import { getServerSession } from "next-auth/next";
-import { authOptions } from "@/lib/auth";
-import { prisma } from "@/lib/prisma";
-
-// DELETE: Delete or Cancel a post
-export async function DELETE(req, { params }) {
- try {
- const session = await getServerSession(authOptions);
- if (!session?.user) {
- return new NextResponse("Unauthorized", { status: 401 });
- }
-
- const { id } = params;
- const post = await prisma.scheduledPost.findUnique({
- where: { id }
- });
-
- if (!post || post.userId !== session.user.id) {
- return new NextResponse("Post not found", { status: 404 });
- }
-
- if (post.status === "processing") {
- return NextResponse.json({ error: "Cannot delete a post that is currently uploading." }, { status: 400 });
- }
-
- // Delete post
- await prisma.scheduledPost.delete({
- where: { id }
- });
-
- return NextResponse.json({ success: true, message: "Post deleted" });
- } catch (error) {
- console.error("[DELETE_POST_ERROR]", error);
- return NextResponse.json({ error: error.message || "Internal Server Error" }, { status: 500 });
- }
-}
-
-// PATCH: Reschedule or Retry a post
-export async function PATCH(req, { params }) {
- try {
- const session = await getServerSession(authOptions);
- if (!session?.user) {
- return new NextResponse("Unauthorized", { status: 401 });
- }
-
- const { id } = params;
- const body = await req.json();
-
- const post = await prisma.scheduledPost.findUnique({
- where: { id }
- });
-
- if (!post || post.userId !== session.user.id) {
- return new NextResponse("Post not found", { status: 404 });
- }
-
- if (post.status === "processing") {
- return NextResponse.json({ error: "Cannot modify a post that is currently uploading." }, { status: 400 });
- }
-
- const updateData = {};
-
- if (body.scheduledAt) {
- updateData.scheduledAt = new Date(body.scheduledAt);
- updateData.status = "scheduled";
- updateData.error = null;
- }
-
- if (body.title !== undefined) updateData.title = body.title;
- if (body.description !== undefined) updateData.description = body.description;
- if (body.privacy !== undefined) updateData.privacy = body.privacy;
-
- const updatedPost = await prisma.scheduledPost.update({
- where: { id },
- data: updateData
- });
-
- return NextResponse.json(updatedPost);
- } catch (error) {
- console.error("[PATCH_POST_ERROR]", error);
- return NextResponse.json({ error: error.message || "Internal Server Error" }, { status: 500 });
- }
-}