mirror of
https://github.com/grocy/grocy.git
synced 2025-10-15 17:58:32 +00:00
Added amount value for locations api (#668)
This commit is contained in:
@@ -3547,6 +3547,9 @@
|
|||||||
"product_id": {
|
"product_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"amount": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
@@ -3560,6 +3563,7 @@
|
|||||||
"example": {
|
"example": {
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"product_id": "3",
|
"product_id": "3",
|
||||||
|
"amount": "2",
|
||||||
"location_id": "1",
|
"location_id": "1",
|
||||||
"name": "Fridge"
|
"name": "Fridge"
|
||||||
}
|
}
|
||||||
|
@@ -10,3 +10,18 @@ ADD shopping_location_id INTEGER;
|
|||||||
|
|
||||||
ALTER TABLE stock
|
ALTER TABLE stock
|
||||||
ADD shopping_location_id INTEGER;
|
ADD shopping_location_id INTEGER;
|
||||||
|
|
||||||
|
DROP VIEW stock_current_locations;
|
||||||
|
CREATE VIEW stock_current_locations
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
1 AS id, -- Dummy, LessQL needs an id column
|
||||||
|
s.product_id,
|
||||||
|
SUM(s.amount) as amount,
|
||||||
|
s.location_id AS location_id,
|
||||||
|
l.name AS location_name,
|
||||||
|
l.is_freezer AS location_is_freezer
|
||||||
|
FROM stock s
|
||||||
|
JOIN locations l
|
||||||
|
ON s.location_id = l.id
|
||||||
|
GROUP BY s.product_id, s.location_id, l.name;
|
||||||
|
Reference in New Issue
Block a user