const { formatISOWithoutTimezone } = require("../../../utils/FormatDate");

const formatAdminItem = (item) => ({
    ...item,
    createdAt: formatISOWithoutTimezone(item.createdAt),
    updatedAt: formatISOWithoutTimezone(item.updatedAt)
});

exports.AdminResource = (res, data, message = 'Success') => {
    const formattedData = formatAdminItem(data);

    return res.status(200).json({
        success: true,
        message,
        data: formattedData
    });
};