Help to a Nearby deal/coupon app

Hi

I'm working on a nearby deal/coupon app

(it's something similar, but not quite the same, but shortest way to explain it)

I have made most of the app, but some important functions are missing, namely the nearby function and some auto functions, which I think the database should do.

1. Nearby function.

Deals are shown in the list view, but must be sorted by the nearest deal.
This function does not exist in FF (yet).

I actually made this function myself, it works fine, but it has to read ALL deals everytime, checks which deals are closest.
When in the future there may be over 1000 deals in the app, this will result in WAY too many reads. It will cost a lot of money in reads to firebase.

What are my alternatives? Will FF come with the function in the future?

2. Auto features.
There must be some background functions in my app/database.
FX. must a store be able to set a start date and end date for a deal.

Have made it so that they can enter this when creating, but there must be an auto function which then also activates and deactivates at the start and end date.

How can it be made? what ideas do you have?

Should it be done in firebase?

1
1 reply