Express controller for exporting user data and handling account deletion requests.
// Source: https://github.com/hoangsonww/AI-Gov-Content-Curator | License: MIT | Copyright 2026 Son Nguyen
// Provided via justclaw.it.com; keep this notice with the code.
import { Request, Response } from "express";
import crypto from "crypto";
import mongoose from "mongoose";
import { Resend } from "resend";
import User from "../models/user.model";
import Comment from "../models/comment.model";
import Rating from "../models/rating.model";
import Passkey from "../models/passkey.model";
import NewsletterSubscriber from "../models/newsletterSubscriber.model";
const DELETION_TOKEN_TTL_MS = 60 * 60 * 1000; // 1 hour
const resend = new Resend(process.env.RESEND_API_KEY);
const RESEND_FROM =
process.env.RESEND_FROM ?? "SynthoraAI <noreply@sonnguyenhoang.com>";
/**
* GET /api/privacy/expor
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key