ADD code to the backend!! urgent

Hi Team,
i have a data collection that holds all the offers which will be in hundreds, i created a query to check on the offers validity and delete the item which is expired.
My question here, where to add this code ! in the backend? is it possible to set a specific time for it to execute?
kindly note that this is really urgent and i would appreciate your assistance.

Hello,

In this case it would be more logical to put the functions in Public and export them to the pages that need the functionality. Here is some help on that - Velo: JavaScript Support | Help Center | Wix.com

As for specific time you have two options based on your needs:

Event Hooks
Automated Task Service ( ex: Zapier )

Event hooks run after a certain event happens (save, insert, update, delete, query)
Automated Task Services run a certain task after an inputted amount of time (daily, weekly, monthly)

Hope this helps,
Majd