I’m am currently making a property app where people can pay to show there property for a period of time is it possible to assign time to each property from the moment they pay to the moment it ends like 15 days
I would suggest using a separate “Purchases” collection for that. It may look like:
- relation to Properties (1 Property can have many Purchases, but each Purchase belongs to one Property)
- relation to Users (1 User can have many Purchases, but each Purchase belongs to one User)
- “Payment” datetime
- “Access Expiration” datetime.
When a user makes a purchase, you create a record in Purchases collection - linking it to Logged-in User and Current Property, and you store Current Time as Payment and Current Time + 15 as Access Expiration.
Then you can use this purchasing record to determine whether the property is shown to a user or not. A couple of possible ways:
- make a list of Purchases, filter it for Logged-In User and for Access Expiration - Is After - Current Time. Then you can have a link to another screen with Current Purchase. And you can easily get all the Property details from Current Purchase.
- in the list of Properties, if you have a View button, you can use a conditional visibility on it. Make it visible so that Current Property → Purchases → Count, where User Email is equal to Logged-in User Email AND Access Expiration - Is After - Current Time, is greater than 0.
Explanation of this count: it should count all records from Purchases collection, but only those, which belong to Current Property, and also their User’s Email is the one of Logged-in User, and also their Access Expiration is in future.
Hope this helps.
When you do current time + 15 does that mean 15 days for the expiration date
Yes, DateTime in Adalo is stored in days, since 1/1/1970.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.