From 9799652a0efda08595c42c6600173f85ca6b019c Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Thu, 1 Oct 2020 15:32:11 +0200 Subject: [PATCH] Updated spec as per feedback in #10. #13 --- src/rest/models/play_log.py | 4 +++ src/rest/models/track.py | 2 ++ src/rest/swagger/swagger.yaml | 34 +++++++++++++++++++++-- src/rest/test/test_internal_controller.py | 4 +-- src/rest/test/test_public_controller.py | 4 ++- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/rest/models/play_log.py b/src/rest/models/play_log.py index 05145af..e958093 100644 --- a/src/rest/models/play_log.py +++ b/src/rest/models/play_log.py @@ -206,6 +206,7 @@ class PlayLog(Model): def track_type(self): """Gets the track_type of this PlayLog. + Indicates the type: \"0\" = filesystem, \"1\" = stream, \"2\" = live or line in # noqa: E501 :return: The track_type of this PlayLog. :rtype: int @@ -216,6 +217,7 @@ class PlayLog(Model): def track_type(self, track_type): """Sets the track_type of this PlayLog. + Indicates the type: \"0\" = filesystem, \"1\" = stream, \"2\" = live or line in # noqa: E501 :param track_type: The track_type of this PlayLog. :type track_type: int @@ -332,6 +334,7 @@ class PlayLog(Model): def log_source(self): """Gets the log_source of this PlayLog. + From which engine the entry has been logged from e.g. \"1\" for Engine 1 or \"2\" for Engine 2 # noqa: E501 :return: The log_source of this PlayLog. :rtype: int @@ -342,6 +345,7 @@ class PlayLog(Model): def log_source(self, log_source): """Sets the log_source of this PlayLog. + From which engine the entry has been logged from e.g. \"1\" for Engine 1 or \"2\" for Engine 2 # noqa: E501 :param log_source: The log_source of this PlayLog. :type log_source: int diff --git a/src/rest/models/track.py b/src/rest/models/track.py index a778bca..80446c1 100644 --- a/src/rest/models/track.py +++ b/src/rest/models/track.py @@ -201,6 +201,7 @@ class Track(Model): def track_type(self): """Gets the track_type of this Track. + Indicates the type: \"0\" = filesystem, \"1\" = stream, \"2\" = live or line in # noqa: E501 :return: The track_type of this Track. :rtype: int @@ -211,6 +212,7 @@ class Track(Model): def track_type(self, track_type): """Sets the track_type of this Track. + Indicates the type: \"0\" = filesystem, \"1\" = stream, \"2\" = live or line in # noqa: E501 :param track_type: The track_type of this Track. :type track_type: int diff --git a/src/rest/swagger/swagger.yaml b/src/rest/swagger/swagger.yaml index f31072b..d32a826 100644 --- a/src/rest/swagger/swagger.yaml +++ b/src/rest/swagger/swagger.yaml @@ -44,6 +44,26 @@ paths: Lists the track-service entries for a given page. operationId: list_tracks parameters: + - name: from_date + in: query + description: Get entries after this timestamp + required: false + style: form + explode: true + schema: + type: string + format: date-time + example: 2020-08-29T09:12:33.001Z + - name: to_date + in: query + description: Get entries before this timestamp + required: false + style: form + explode: true + schema: + type: string + format: date-time + example: 2020-11-29T09:12:55.001Z - name: page in: query description: The number of items to skip before starting to collect the result @@ -174,6 +194,7 @@ paths: explode: true schema: type: string + format: date-time example: 2020-08-29T09:12:33.001Z - name: to_date in: query @@ -183,7 +204,8 @@ paths: explode: true schema: type: string - example: 2020-11-29T09:12:33.001Z + format: date-time + example: 2020-11-29T09:12:55.001Z - name: page in: query description: The number of items to skip before starting to collect the result @@ -374,7 +396,7 @@ components: example: Kyuss track_album: type: string - example: '...And the Circus Leaves Town' + example: '... And the Circus Leaves Town' track_title: type: string example: El Rodeo @@ -383,6 +405,8 @@ components: example: 303 track_type: type: integer + description: 'Indicates the type: "0" = filesystem, "1" = stream, "2" = + live or line in' example: 2 track_num: type: integer @@ -400,7 +424,7 @@ components: type: string example: Electronic Music from Brazil example: - track_album: '...And the Circus Leaves Town' + track_album: '... And the Circus Leaves Town' show_id: 42 playlist_id: 38 track_start: 2020-08-29T09:12:33.001Z @@ -434,6 +458,8 @@ components: example: 808 track_type: type: integer + description: 'Indicates the type: "0" = filesystem, "1" = stream, "2" = + live or line in' example: 2 track_num: type: integer @@ -452,6 +478,8 @@ components: example: Electronic Music from Brazil log_source: type: integer + description: From which engine the entry has been logged from e.g. "1" for + Engine 1 or "2" for Engine 2 example: 1 example: track_album: Bricolage diff --git a/src/rest/test/test_internal_controller.py b/src/rest/test/test_internal_controller.py index cd4e3a7..2a2590c 100644 --- a/src/rest/test/test_internal_controller.py +++ b/src/rest/test/test_internal_controller.py @@ -96,8 +96,8 @@ class TestInternalController(BaseTestCase): List tracks in the play-log since the given timestamp """ - query_string = [('from_date', '2020-09-29T09:12:33.001Z'), - ('to_date', '2020-11-29T09:12:33.001Z'), + query_string = [('from_date', '2013-10-20T19:20:30+01:00'), + ('to_date', '2013-10-20T19:20:30+01:00'), ('page', 56), ('limit', 200), ('skip_synced', true)] diff --git a/src/rest/test/test_public_controller.py b/src/rest/test/test_public_controller.py index d5b132b..1022a0a 100644 --- a/src/rest/test/test_public_controller.py +++ b/src/rest/test/test_public_controller.py @@ -45,7 +45,9 @@ class TestPublicController(BaseTestCase): List recent tracks in the play-log """ - query_string = [('page', 56), + query_string = [('from_date', '2013-10-20T19:20:30+01:00'), + ('to_date', '2013-10-20T19:20:30+01:00'), + ('page', 56), ('limit', 50)] response = self.client.open( '/api/v1/trackservice', -- GitLab