Skip to content

Commit

Permalink
Remove dead code, update project info.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeltzer committed May 19, 2020
1 parent f1e49a6 commit a36e8f8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
js/*.* binary
11 changes: 6 additions & 5 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@

<licence>AGPL</licence>
<author>Joas Schilling</author>
<author>Dan Meltzer</author>

<category>tools</category>

<website>https://github.com/nextcloud/gadgetbridge</website>
<bugs>https://github.com/nextcloud/gadgetbridge/issues</bugs>
<repository type="git">https://github.com/nextcloud/gadgetbridge.git</repository>
<website>https://github.com/dmeltzer/gadgetbridge</website>
<bugs>https://github.com/dmeltzer/gadgetbridge/issues</bugs>
<repository type="git">https://github.com/dmeltzer/gadgetbridge.git</repository>

<version>0.5.5</version>
<version>0.6.5</version>
<namespace>GadgetBridge</namespace>

<dependencies>
<nextcloud min-version="12" max-version="18" />
<nextcloud min-version="18" max-version="20" />
</dependencies>

<navigations>
Expand Down
3 changes: 1 addition & 2 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
'ocs' => [
['name' => 'api#selectDatabase', 'url' => '/api/v1/database', 'verb' => 'POST'],
['name' => 'api#getDevices', 'url' => '/api/v1/{databaseId}/devices', 'verb' => 'GET'],
['name' => 'api#getDeviceData', 'url' => '/api/v1/{databaseId}/devices/{deviceId}/samples/{year}/{month}/{day}/{hours}/{minutes}', 'verb' => 'GET'],
['name' => 'api#getNewDeviceData', 'url' => '/api/v1/{databaseId}/devices/{deviceId}/samples/{startTimestamp}/{endTimestamp}', 'verb' => 'GET'],
['name' => 'api#getDeviceData', 'url' => '/api/v1/{databaseId}/devices/{deviceId}/samples/{startTimestamp}/{endTimestamp}', 'verb' => 'GET'],

],
];
51 changes: 1 addition & 50 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,55 +153,6 @@ public function getDevices($databaseId) {
return new DataResponse($devices);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
*
* OBSOLETE: Remove when convenient
* @param int $databaseId
* @param int $deviceId
* @param int $year
* @param int $month
* @param int $day
* @param int $hours
* @param int $minutes
* @return DataResponse
*/
public function getDeviceData($databaseId, $deviceId, $year, $month, $day, $hours, $minutes) {
try {
$connection = $this->getConnection($databaseId);
} catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\InvalidArgumentException $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}

$query = $connection->getQueryBuilder();
$query->automaticTablePrefix(false);
$query->select('*')
->from('DEVICE')
->where($query->expr()->eq('_id', $query->createNamedParameter($deviceId)));

$result = $query->execute();
$device = $result->fetch();
$result->closeCursor();

$end = \DateTime::createFromFormat(
'Y.n.j G:i:s',
$year . '.' . $month . '.' . $day . ' ' .
$hours . ':' . (($minutes < 10) ? '0': '') . $minutes . ':00');
$start = clone $end;
$start->sub(new \DateInterval('P1D'));

$b = $start->getTimestamp();
$a = $end->getTimestamp();

if ($device['TYPE'] === '14') {
return $this->getMiBandData($connection, $device, $start, $end);
}

return new DataResponse([], Http::STATUS_UNPROCESSABLE_ENTITY);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
Expand All @@ -214,7 +165,7 @@ public function getDeviceData($databaseId, $deviceId, $year, $month, $day, $hour
*
* @return DataResponse
*/
public function getNewDeviceData($databaseId, $deviceId, $startTimestamp, $endTimestamp) {
public function getDeviceData($databaseId, $deviceId, $startTimestamp, $endTimestamp) {
try {
$connection = $this->getConnection($databaseId);
} catch (NotFoundException $e) {
Expand Down

0 comments on commit a36e8f8

Please sign in to comment.