//import { addCron } from '@opengis/fastify-table/utils.js';

async function deleteOldNotifications({ pg }) {
    const { rowCount } = pg?.pk?.['crm.notifications'] ? await pg.query('delete from crm.notifications where CURRENT_DATE - \'14 days\'::interval > cdate') : {};
    return { rowCount };
}

export default async function cron(fastify) {
    // addCron(deleteOldNotifications, 60 * 60 * 24, fastify);
    //  addCron(deleteOldNotifications, 60 * 1, fastify); // debug
}