import { d as db, g as servers } from '../../admin/create-upload-progress-table/POST-C-OoiMoW.js';
import { eq } from 'drizzle-orm';

async function handler(req, res) {
  try {
    const { serverId } = req.params;
    if (!serverId) {
      return res.status(400).json({
        success: false,
        error: "Server ID is required"
      });
    }
    const server = await db.select().from(servers).where(eq(servers.serverId, serverId)).limit(1);
    if (server.length === 0) {
      return res.status(404).json({
        success: false,
        error: "Server not found"
      });
    }
    res.json({
      success: true,
      server: server[0]
    });
  } catch (error) {
    console.error("Server fetch error:", error);
    res.status(500).json({
      success: false,
      error: "Failed to fetch server",
      message: String(error)
    });
  }
}

export { handler as h };
