Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
864 B
1
Indexable
Never
const updatePaymentCheckTime = async (updatableDomains) => {
    try {
        // Read the existing domains data
        const domains = await controllers.readDomainsFile(filePath);

        // Update paymentCheckedAt for the specified domains
        const updatedDomains = domains.map(domain => {
            if (updatableDomains.includes(domain.domain)) {
                return {
                    ...domain,
                    paymentCheckedAt: todayDateFormatted(),
                };
            }
            return domain;
        });

        // Write the updated data back to the file
        await controllers.writeDomainsFile(filePath, updatedDomains);

        console.log('Payment check time updated successfully.');
    } catch (error) {
        console.error('Error updating payment check time:', error.message);
    }
};
Leave a Comment