profile id support in api requests

This commit is contained in:
Mateusz Gruszczyński
2026-06-16 19:46:16 +02:00
parent c796a740d1
commit a73aeb5544
18 changed files with 1823 additions and 185 deletions
+8 -8
View File
@@ -10,7 +10,7 @@ def _automation_user_id() -> int:
@bp.get('/automations')
def automations_get():
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return ok({'rules': [], 'history': [], 'error': 'No profile'})
try:
@@ -26,7 +26,7 @@ def automations_get():
@bp.get('/automations/export')
def automations_export():
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try:
@@ -39,7 +39,7 @@ def automations_export():
@bp.post('/automations/import')
def automations_import():
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try:
@@ -55,7 +55,7 @@ def automations_import():
@bp.post('/automations')
def automations_save():
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try:
@@ -69,7 +69,7 @@ def automations_save():
@bp.delete('/automations/<int:rule_id>')
def automations_delete(rule_id: int):
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try:
@@ -83,7 +83,7 @@ def automations_delete(rule_id: int):
@bp.post('/automations/<int:rule_id>/run')
def automations_run_rule(rule_id: int):
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try:
@@ -100,7 +100,7 @@ def automations_run_rule(rule_id: int):
@bp.post('/automations/check')
def automations_check():
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try:
@@ -117,7 +117,7 @@ def automations_check():
@bp.delete('/automations/history')
def automations_history_clear():
from ..services import automation_rules
profile = preferences.active_profile()
profile = request_profile()
if not profile:
return jsonify({'ok': False, 'error': 'No profile'}), 400
try: