Instead of using manual db lookup for access log,
use device.access_list to fetch the data from
access_log table. This does the SQL query underneath.
To do so, instructions from SQLAlchemey were followed
to to many-to-one relations for users and devices,
respectevly.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
A counter is associated with every
Iot Device. The counter is always increment
when a user is allowed or disallowed to use
the device, hence, ensuring coherency.
It is also now exposed in the
IotDoorPollingRequest schema, enabling the
Iot Device to fetch the new access list.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
A warning was raised whenever the user<->device
relation was accessed. The assumption is that
now the queries perform faster, having fixed
this issue.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
- Classes in models describe tables in database
- Classes in schemas desribe pydantic models to
read from the API.
- database provides a connection and sessions to
the database.
- crud exposes the interface to the database, i.e.
actions we can take from the application onto the
database
Signed-off-by: HeshamTB <hishaminv@gmail.com>