Logo Executive is your partner in logo exploration. Our platform boasts a collection of APIs designed to simplify the process of obtaining company logos.
This pull request introduces a new script that is scheduled to run automatically at midnight to refresh the usage count of subscriptions.
Description
The script performs the following actions:
Connects to the MongoDB database and retrieves all subscriptions.
Calculates the number of days since each subscription was created.
Resets the usage count to zero for subscriptions after every 30 consecutive days starting from the time of creation and only if the current usage count is greater than zero.
Updates the updatedAt field to reflect the reset action.
Hi @aps08 Following your last comment. I have made the following changes.
I have removed individual save for records, instead of it, now using bulkWrite() to update multiple records at once. This will reduce the unnecessary API calls that was earlier being made. As a result, promise.all() was also not required so removed it as well.
I have updated the find query to fetch only those records where usageCount > 0 because anyway we are going to update only those records where usageCount is greater than 0.
Kindly review the changes made. Let me know if you find any issues with the current approach.
Summary
This pull request introduces a new script that is scheduled to run automatically at midnight to refresh the usage count of subscriptions.
Description
The script performs the following actions:
updatedAt
field to reflect the reset action.This PR resolves Issue #355
How to Test the Changes
Context (Optional)
Screenshots or Recordings (Optional)
Checklist