Untitled

 avatar
unknown
plain_text
a year ago
864 B
4
Indexable
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);
    }
};
Editor is loading...
Leave a Comment