Add TODOs for view audit logs. #330

This commit is contained in:
Korina Cordero 2020-03-10 05:44:18 +00:00
parent afeb06006d
commit 025e14ff69

View file

@ -502,30 +502,18 @@ class UserController extends Controller
public function getLogs(Client $client, $id)
{
error_log('in getLogs');
// fetch database
// TODO: find way to replace hardcoded db name
$database = $client->selectDB('logging_db');
// query will return a resultset object
// TODO: filter query using user id
$result = $database->query('SELECT * FROM entity_log');
// get the points from the resultset, which is an array
$points = $result->getPoints();
error_log('getLogs count points ' . count($points));
// array has format
/*
$rows = [];
foreach ($points as $point)
{
$row['time'] = $point['time'];
error_log($point['entity_type']);
error_log($point['action']);
} */
// TODO: might need to format time data
return $this->json([
'data' => $points,