From 9c5e8b13bb4354d6ae97690904154c7215b55483 Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Mon, 22 Jun 2020 19:12:37 +0200
Subject: [PATCH] Wire up services.

---
 src/rest/controllers/internal_controller.py | 30 ++++++++++---------
 src/rest/controllers/public_controller.py   | 32 ++++++++++++---------
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/src/rest/controllers/internal_controller.py b/src/rest/controllers/internal_controller.py
index e8f641e..e2afc41 100644
--- a/src/rest/controllers/internal_controller.py
+++ b/src/rest/controllers/internal_controller.py
@@ -6,7 +6,24 @@ from src.rest.models.play_log_entry import PlayLogEntry  # noqa: E501
 from src.rest.models.status_entry import StatusEntry  # noqa: E501
 from src.rest import util
 
+from src.service.playlist_service import playlistService
+from src.service.track_service import trackService
+from src.service.engine_service import engineService
 
+
+def get_report(year_month):  # noqa: E501
+    """Report for one month
+
+    Returns a report for the given month  # noqa: E501
+
+    :param year_month: Month to create the report for in the format \&quot;yyyy_mm\&quot;
+    :type year_month: str
+
+    :rtype: List[PlayLogEntry]
+    """
+    return 'do some magic!'
+
+    
 def activate_engine(engine_number):  # noqa: E501
     """Set active engine
 
@@ -44,19 +61,6 @@ def get_engine_health(engine_number):  # noqa: E501
     return 'do some magic!'
 
 
-def get_report(year_month):  # noqa: E501
-    """Report for one month
-
-    Returns a report for the given month  # noqa: E501
-
-    :param year_month: Month to create the report for in the format \&quot;yyyy_mm\&quot;
-    :type year_month: str
-
-    :rtype: List[PlayLogEntry]
-    """
-    return 'do some magic!'
-
-
 def log_engine_health(engine_number):  # noqa: E501
     """Log health info
 
diff --git a/src/rest/controllers/public_controller.py b/src/rest/controllers/public_controller.py
index f1bf3db..fc87ff4 100644
--- a/src/rest/controllers/public_controller.py
+++ b/src/rest/controllers/public_controller.py
@@ -5,16 +5,9 @@ from src.rest.models.play_log_entry import PlayLogEntry  # noqa: E501
 from src.rest.models.playlist import Playlist  # noqa: E501
 from src.rest import util
 
-
-def current_playlist():  # noqa: E501
-    """Get current playlist
-
-    Retrieves the currently playing playlist.  # noqa: E501
-
-
-    :rtype: Playlist
-    """
-    return 'do some magic!'
+from src.service.playlist_service import playlistService
+from src.service.track_service import trackService
+from src.service.engine_service import engineService
 
 
 def current_track():  # noqa: E501
@@ -25,7 +18,7 @@ def current_track():  # noqa: E501
 
     :rtype: PlayLogEntry
     """
-    return 'do some magic!'
+    return trackService.current_track()
 
 
 def get_track(track_id):  # noqa: E501
@@ -38,7 +31,7 @@ def get_track(track_id):  # noqa: E501
 
     :rtype: PlayLogEntry
     """
-    return 'do some magic!'
+    return trackService.get_track(track_id)
 
 
 def list_tracks(offset=None, limit=None):  # noqa: E501
@@ -53,7 +46,18 @@ def list_tracks(offset=None, limit=None):  # noqa: E501
 
     :rtype: List[PlayLogEntry]
     """
-    return 'do some magic!'
+    return trackService.list_tracks(offset, limit)
+
+
+def current_playlist():  # noqa: E501
+    """Get current playlist
+
+    Retrieves the currently playing playlist.  # noqa: E501
+
+
+    :rtype: Playlist
+    """
+    return playlistService.current_playlist()
 
 
 def next_playlist():  # noqa: E501
@@ -64,4 +68,4 @@ def next_playlist():  # noqa: E501
 
     :rtype: Playlist
     """
-    return 'do some magic!'
+    return playlistService.next_playlist()
-- 
GitLab