Refactored notification_services.py

This commit is contained in:
CasVT
2025-08-21 15:15:46 +02:00
parent 536d1a0b93
commit 08bd642224
2 changed files with 40 additions and 36 deletions

View File

@@ -212,7 +212,7 @@ def api_notification_services_list(inputs: Dict[str, str]):
)
if request.method == 'GET':
result = services.fetchall()
result = services.get_all()
return return_api(result=[r.todict() for r in result])
elif request.method == 'POST':
@@ -233,9 +233,7 @@ def api_notification_service_available(inputs: Dict[str, str]):
@api.route('/notificationservices/test', TestNotificationServiceURLData)
@endpoint_wrapper
def api_test_service(inputs: Dict[str, Any]):
user_id = api_key_map[g.hashed_api_key].user_data.user_id
success = NotificationServices(user_id).test(inputs['url'])
success = NotificationServices.test(inputs['url'])
return return_api(
{
'success': success == SendResult.SUCCESS,
@@ -249,7 +247,7 @@ def api_test_service(inputs: Dict[str, Any]):
@endpoint_wrapper
def api_notification_service(inputs: Dict[str, Any], n_id: int):
user_id = api_key_map[g.hashed_api_key].user_data.user_id
service = NotificationServices(user_id).fetchone(n_id)
service = NotificationServices(user_id).get_one(n_id)
if request.method == 'GET':
result = service.get()