4 ms·
Ask HN: Design patterns for granting access to data scoped to blocks of time?
I'm struggling to come up with the right query terms for Google on this one.
Here's the basic business problem I'm trying to solve:
Let's say I have a car rental company. I rent cars one week at a time. I have reports for things like mileage over time periods for my renters to use.
Here's a scenario:
Customer 1 rents Car 1 for 1 week, drives 100 miles. Customer 2 then rents Car 1 for 1 week, drives 200 miles. Customer 1 rents Car 1 again for a week, and another 100 miles.
In my mileage report, I want to give Customer 1 access to the mileage accrued in by Car 1, but only for the blocks of time that they were the renters of the Car (so week 1 and week 3). Likewise, Customer 2 should only be able to access their block of time of rental (week 3).
Setting the UX concerns aside of chunks of missing data in a report, are there any established patterns out there for this type of query situation?
- tlack 9y agoMaybe I am under-thinking it, but why not just gray out and obscure those regions of the graph (or whatever) with a label "Different Driver"?
- hluska 9y agoI'm pretty sure that I don't understand this, but can't you represent that problem with this sql? SELECT mileage FROM table WHERE customer_id = 1; Am I on the right track?