import { Request, Response } from "express";
import { paginateServices, setServiceBanned } from "../services/services.service";

export const paginate = async (req: Request, res: Response) => {
    try {
        const result = await paginateServices(req.body);
        res.json(result);
    } catch (e: any) {
        console.log(e);
        const err = e.response ? e.response.data : e.message;
        res.status(500).json({ error: err });
    }
};

export const setBanned = async (req: Request, res: Response) => {
    try {
        const result = await setServiceBanned(req.body);
        res.json(result);
    } catch (e: any) {
        console.log(e);
        const err = e.response ? e.response.data : e.message;
        res.status(500).json({ error: err });
    }
};
