I'm designing a website where a house owner can list its property for sale.
A property can be searched based on its location (city) and it's size(small/big).
I store every property listing with these attributes :
CREATE TABLE property (
id int,
name varchar(255),
location varchar(255),
size varchar(255),
)
I want to add a feature that allows the user to save search filters and receive email alerts when new properties matching their search alert are listed.
For example, a buyer A registers a search record { location: "Paris", size: "small", user_id: 1251}.
Now a seller lists a new small property for sale located in Paris.
The search alert must be triggered to send an email to buyer A.
Should I look for search alerts that match the new listing and send an email to all users affected by the alert?
How can I design design such as system ?
Note: This question is asked to figure out the architecture of the system in order to design it. But also to get feedback from developers who have already implemented a similar solution. So I hope it is in line with the stackoverflow standards.