mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Return the battery object in endpoint /batteries
(closes #2045)
This commit is contained in:
parent
eb370dad1e
commit
7d4a9602ab
55
changelog/70_UNRELEASED_xxxx.xx.xx.md
Normal file
55
changelog/70_UNRELEASED_xxxx.xx.xx.md
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
> ⚠️ xxxBREAKING CHANGESxxx
|
||||||
|
|
||||||
|
> ❗ xxxImportant upgrade informationXXX
|
||||||
|
|
||||||
|
### New feature: xxxx
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Stock
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Shopping list
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Meal plan
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Calendar
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Batteries
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Equipment
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Userfields
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- The Endpoint `/batteries` now also returns the corresponding battery object (as field/property `battery`)
|
@ -26,7 +26,14 @@ class BatteriesService extends BaseService
|
|||||||
|
|
||||||
public function GetCurrent()
|
public function GetCurrent()
|
||||||
{
|
{
|
||||||
return $this->getDatabase()->batteries_current();
|
$batteries = $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
$currentBatteries = $this->getDatabase()->batteries_current();
|
||||||
|
foreach ($currentBatteries as $currentBattery)
|
||||||
|
{
|
||||||
|
$currentBattery->battery = FindObjectInArrayByPropertyValue($batteries, 'id', $currentBattery->battery_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $currentBatteries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChargeCycle(int $batteryId, string $trackedTime)
|
public function TrackChargeCycle(int $batteryId, string $trackedTime)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user