/**
 * POST /api/invitations/[token]/delete
 * Delete an invitation after it's been successfully claimed.
 * Unauthenticated — called after a successful wallet connection.
 */

import { UserDAO } from "@/db";
import { createNextRoute } from "@/lib/api/ts-rest/next-route";
import { invitationsContract } from "@/lib/contracts";

const handlers = createNextRoute(invitationsContract, {
  delete: async ({ params }) => {
    await UserDAO.deleteInvitation(params.token);
    return { status: 200, body: { success: true } };
  },
});

export const POST = handlers.POST!;
