Need help with blocking users from doing an action

Hi there,
I am building an app in which users share an offer with others.
So lets say we have user 1 and user 2
User 1 sends offer A to user 2
Now my requirement is that user 2 should not be able to send the same offer A to user 1 again(user 2 and user 1 can share the offer to other users but I dont want the offers to be just going back and forth
Can anyone please help me with this ?

Do you want to limit the users so that they can only use one offer and thats it?

If so, you can just make a collection of offers and in the user collection give them a true/false property that says something like “Used offer”. Then when the user uses an offer, that button should update the users “used offer” to true. You would also make that button only work if the users “used offer” is false.

It would need some testing but you could probably also have a relationship to the offers collection to users and then make the redeem button check to see if the user has used that offer in the collection.

If you want the user to be able to use multiple offers, one way of doing it could be to add the offer to the users collection and mark it used as ture/false for each individual offer, but that could get messy if you plan on having a lot of offers.

Thanks for the reply!
My idea is that when an user sign up, they have all the offers on their list. Then as they redeemed an offer, it should disappear for them for a specific time such as a week or so. Then after that specified time period, the offer should come back to their list.

How many offers are going to be on this list?

So, yes you will need a collection called “offers” where you will put these offers.

1 Like

Oh ok Thank You!
Currently, I have an “offers” collection and an “users” collection. All the 100 offers are stored in the “offers” collection. When the user signs up, they should see all 100 offers. But when they redeem an offer, that particular offer should go away from their list and come back after a week.
I tried the creating a relation between users and offers. But the only thing which does not seem to work, is that all the 100 offers are not added to the user when they sign up. Can you help me with this?

I dont have a lot of time right now to sit down and think about how or if its possible to automatically renew the offer after X amount of days.

But other than that Here is an app you can clone and play around with. It will show the offers that are available to the user, then when that offer is clicked and redeemed it will disappear from the list and add the date to the collection on when it was used.