diff --git a/schemas/openapi-steering.json b/schemas/openapi-steering.json index 345e57754eafecb37382c45b3132c98decd62c71..a81c64734087294cdb9739d12fb232cec72be2e7 100644 --- a/schemas/openapi-steering.json +++ b/schemas/openapi-steering.json @@ -25,55 +25,55 @@ "title": { "type": "integer" }, - "schedule_id": { + "scheduleId": { "type": "integer" }, - "is_repetition": { + "isRepetition": { "type": "boolean", "nullable": true }, - "playlist_id": { + "playlistId": { "type": "integer", "nullable": true }, - "schedule_default_playlist_id": { + "scheduleDefaultPlaylistId": { "type": "integer", "nullable": true }, - "show_default_playlist_id": { + "showDefaultPlaylistId": { "type": "integer", "nullable": true }, - "show_id": { + "showId": { "type": "integer" }, - "show_name": { + "showName": { "type": "string" }, - "show_hosts": { + "showHosts": { "type": "string" }, - "show_type": { + "showType": { "type": "string", "nullable": true }, - "show_categories": { + "showCategories": { "type": "string", "nullable": true }, - "show_topics": { + "showTopics": { "type": "string", "nullable": true }, - "show_musicfocus": { + "showMusicfocus": { "type": "string", "nullable": true }, - "show_languages": { + "showLanguages": { "type": "string", "nullable": true }, - "show_fundingcategory": { + "showFundingcategory": { "type": "string", "nullable": true }, diff --git a/src/aura_engine/scheduling/api.py b/src/aura_engine/scheduling/api.py index 950f66cd49e096b238009765d4103504be9e0251..6a6ff792c05b4e6a11336d77b80a6de2ef5d319c 100644 --- a/src/aura_engine/scheduling/api.py +++ b/src/aura_engine/scheduling/api.py @@ -41,10 +41,10 @@ class ApiFetcher(threading.Thread): """ API_TIMESLOT_ID = "id" - API_PLID_PLAYLIST = "playlist_id" - API_PLID_SCHEDULE = "schedule_default_playlist_id" - API_PLID_SHOW = "show_default_playlist_id" - MODEL_TIMESLOT_ID = "timeslot_id" + API_PLID_PLAYLIST = "playlistId" + API_PLID_SCHEDULE = "scheduleDefaultPlaylistId" + API_PLID_SHOW = "showDefaultPlaylistId" + MODEL_TIMESLOT_ID = "timeslotId" MODEL_PLID_PLAYLIST = "playlist_id" MODEL_PLID_SCHEDULE = "default_schedule_playlist_id" MODEL_PLID_SHOW = "default_show_playlist_id" diff --git a/src/aura_engine/scheduling/programme.py b/src/aura_engine/scheduling/programme.py index dac71650fa60090af41a50d291d4f9942ff47312..7224e9b7b20fa7aeb71be2d87a8da96b7a3c4dc5 100644 --- a/src/aura_engine/scheduling/programme.py +++ b/src/aura_engine/scheduling/programme.py @@ -321,7 +321,7 @@ class ProgrammeStore: # Filter the local timeslot from the fetched ones existing_remotely = list( filter( - lambda new_timeslot: new_timeslot["timeslot_id"] + lambda new_timeslot: new_timeslot["timeslotId"] == local_timeslot.timeslot_id, fetched_timeslots, ) @@ -362,26 +362,26 @@ class ProgrammeStore: timeslot_db = Timeslot() havetoadd = True - timeslot_db.show_id = timeslot["show_id"] - timeslot_db.timeslot_id = timeslot["timeslot_id"] + timeslot_db.show_id = timeslot["showId"] + timeslot_db.timeslot_id = timeslot["timeslotId"] timeslot_db.timeslot_start = SU.to_datetime(timeslot["start"]) timeslot_db.timeslot_end = SU.to_datetime(timeslot["end"]) - timeslot_db.show_name = timeslot["show_name"] - timeslot_db.show_hosts = timeslot["show_hosts"] - timeslot_db.is_repetition = timeslot["is_repetition"] - timeslot_db.funding_category = timeslot["show_fundingcategory"] - timeslot_db.languages = timeslot["show_languages"] - timeslot_db.type = timeslot["show_type"] - timeslot_db.category = timeslot["show_categories"] - timeslot_db.topic = timeslot["show_topics"] - timeslot_db.musicfocus = timeslot["show_musicfocus"] - timeslot_db.playlist_id = timeslot["playlist_id"] + timeslot_db.show_name = timeslot["showName"] + timeslot_db.show_hosts = timeslot["showHosts"] + timeslot_db.is_repetition = timeslot["isRepetition"] + timeslot_db.funding_category = timeslot["showFundingcategory"] + timeslot_db.languages = timeslot["showLanguages"] + timeslot_db.type = timeslot["showType"] + timeslot_db.category = timeslot["showCategories"] + timeslot_db.topic = timeslot["showTopics"] + timeslot_db.musicfocus = timeslot["showMusicfocus"] + timeslot_db.playlist_id = timeslot["playlistId"] # Optional API properties - if "default_schedule_playlist_id" in timeslot: - timeslot_db.default_schedule_playlist_id = timeslot["default_schedule_playlist_id"] + if "default_schedule_playlistId" in timeslot: + timeslot_db.default_schedule_playlist_id = timeslot["defaultSchedulePlaylistId"] if "default_show_playlist_id" in timeslot: - timeslot_db.default_show_playlist_id = timeslot["default_show_playlist_id"] + timeslot_db.default_show_playlist_id = timeslot["defaultShowPlaylistId"] msg = f"Store/Update TIMESLOT havetoadd={havetoadd} - data: {timeslot}" self.logger.debug(SU.pink(msg)) diff --git a/src/aura_steering_api/models/timeslot.py b/src/aura_steering_api/models/timeslot.py index 5da8d5f45a82205abf3bcd1c5a575173cc45b98a..d687341bb5e17627d32dd9baf20c3fb519e027ce 100644 --- a/src/aura_steering_api/models/timeslot.py +++ b/src/aura_steering_api/models/timeslot.py @@ -97,33 +97,33 @@ class Timeslot: if title is not UNSET: field_dict["title"] = title if schedule_id is not UNSET: - field_dict["schedule_id"] = schedule_id + field_dict["scheduleId"] = schedule_id if is_repetition is not UNSET: - field_dict["is_repetition"] = is_repetition + field_dict["isRepetition"] = is_repetition if playlist_id is not UNSET: - field_dict["playlist_id"] = playlist_id + field_dict["playlistId"] = playlist_id if schedule_default_playlist_id is not UNSET: - field_dict["schedule_default_playlist_id"] = schedule_default_playlist_id + field_dict["scheduleDefaultPlaylistId"] = schedule_default_playlist_id if show_default_playlist_id is not UNSET: - field_dict["show_default_playlist_id"] = show_default_playlist_id + field_dict["showDefaultPlaylistId"] = show_default_playlist_id if show_id is not UNSET: - field_dict["show_id"] = show_id + field_dict["showId"] = show_id if show_name is not UNSET: - field_dict["show_name"] = show_name + field_dict["showName"] = show_name if show_hosts is not UNSET: - field_dict["show_hosts"] = show_hosts + field_dict["showHosts"] = show_hosts if show_type is not UNSET: - field_dict["show_type"] = show_type + field_dict["showType"] = show_type if show_categories is not UNSET: - field_dict["show_categories"] = show_categories + field_dict["showCategories"] = show_categories if show_topics is not UNSET: - field_dict["show_topics"] = show_topics + field_dict["showTopics"] = show_topics if show_musicfocus is not UNSET: - field_dict["show_musicfocus"] = show_musicfocus + field_dict["showMusicfocus"] = show_musicfocus if show_languages is not UNSET: - field_dict["show_languages"] = show_languages + field_dict["showLanguages"] = show_languages if show_fundingcategory is not UNSET: - field_dict["show_fundingcategory"] = show_fundingcategory + field_dict["showFundingcategory"] = show_fundingcategory if memo is not UNSET: field_dict["memo"] = memo if class_name is not UNSET: @@ -152,33 +152,33 @@ class Timeslot: title = d.pop("title", UNSET) - schedule_id = d.pop("schedule_id", UNSET) + schedule_id = d.pop("scheduleId", UNSET) - is_repetition = d.pop("is_repetition", UNSET) + is_repetition = d.pop("isRepetition", UNSET) - playlist_id = d.pop("playlist_id", UNSET) + playlist_id = d.pop("playlistId", UNSET) - schedule_default_playlist_id = d.pop("schedule_default_playlist_id", UNSET) + schedule_default_playlist_id = d.pop("scheduleDefaultPlaylistId", UNSET) - show_default_playlist_id = d.pop("show_default_playlist_id", UNSET) + show_default_playlist_id = d.pop("showDefaultPlaylistId", UNSET) - show_id = d.pop("show_id", UNSET) + show_id = d.pop("showId", UNSET) - show_name = d.pop("show_name", UNSET) + show_name = d.pop("showName", UNSET) - show_hosts = d.pop("show_hosts", UNSET) + show_hosts = d.pop("showHosts", UNSET) - show_type = d.pop("show_type", UNSET) + show_type = d.pop("showType", UNSET) - show_categories = d.pop("show_categories", UNSET) + show_categories = d.pop("showCategories", UNSET) - show_topics = d.pop("show_topics", UNSET) + show_topics = d.pop("showTopics", UNSET) - show_musicfocus = d.pop("show_musicfocus", UNSET) + show_musicfocus = d.pop("showMusicfocus", UNSET) - show_languages = d.pop("show_languages", UNSET) + show_languages = d.pop("showLanguages", UNSET) - show_fundingcategory = d.pop("show_fundingcategory", UNSET) + show_fundingcategory = d.pop("showFundingcategory", UNSET) memo = d.pop("memo", UNSET) diff --git a/tests/json/steering-api-v1-playout.json b/tests/json/steering-api-v1-playout.json index e6ba8cf3d92eddb860625605ee8f715198edb0e0..ba6c084504b896df24d766d90fae69f823991437 100644 --- a/tests/json/steering-api-v1-playout.json +++ b/tests/json/steering-api-v1-playout.json @@ -4,20 +4,20 @@ "start":"2023-05-16T10:06:00", "end":"2023-05-16T10:10:00", "title":"Pepi's Polka", - "schedule_id":17, - "is_repetition":false, - "playlist_id":1, - "schedule_default_playlist_id":null, - "show_default_playlist_id":null, - "show_id":1, - "show_name":"Musikprogramm", - "show_hosts":"Musikredaktion", - "show_type":"Unmoderiertes Musikprogramm", - "show_categories":"", - "show_topics":"", - "show_musicfocus":"", - "show_languages":"", - "show_fundingcategory":"Standard", + "scheduleId":17, + "isRepetition":false, + "playlistId":1, + "scheduleDefaultPlaylistId":null, + "showDefaultPlaylistId":null, + "showId":1, + "showName":"Musikprogramm", + "showHosts":"Musikredaktion", + "showType":"Unmoderiertes Musikprogramm", + "showCategories":"", + "showTopics":"", + "showMusicfocus":"", + "showLanguages":"", + "showFundingcategory":"Standard", "memo":"", "className":"default" }, @@ -26,20 +26,20 @@ "start":"2023-05-16T13:00:00", "end":"2023-05-16T13:05:00", "title":"Wurlitzer", - "schedule_id":18, - "is_repetition":false, - "playlist_id":1, - "schedule_default_playlist_id":1, - "show_default_playlist_id":1, - "show_id":1, - "show_name":"Musikprogramm", - "show_hosts":"Musikredaktion", - "show_type":"Unmoderiertes Musikprogramm", - "show_categories":"", - "show_topics":"", - "show_musicfocus":"", - "show_languages":"", - "show_fundingcategory":"Standard", + "scheduleId":18, + "isRepetition":false, + "playlistId":1, + "scheduleDefaultPlaylistId":1, + "showDefaultPlaylistId":1, + "showId":1, + "showName":"Musikprogramm", + "showHosts":"Musikredaktion", + "showType":"Unmoderiertes Musikprogramm", + "showCategories":"", + "showTopics":"", + "showMusicfocus":"", + "showLanguages":"", + "showFundingcategory":"Standard", "memo":"", "className":"default" }, @@ -48,20 +48,20 @@ "start":"2023-05-16T15:00:00", "end":"2023-05-16T15:05:00", "title":"Pepi's Polka II", - "schedule_id":19, - "is_repetition":false, - "playlist_id":1, - "schedule_default_playlist_id":1, - "show_default_playlist_id":1, - "show_id":1, - "show_name":"Musikprogramm", - "show_hosts":"Musikredaktion", - "show_type":"Unmoderiertes Musikprogramm", - "show_categories":"", - "show_topics":"", - "show_musicfocus":"", - "show_languages":"", - "show_fundingcategory":"Standard", + "scheduleId":19, + "isRepetition":false, + "playlistId":1, + "scheduleDefaultPlaylistId":1, + "showDefaultPlaylistId":1, + "showId":1, + "showName":"Musikprogramm", + "showHosts":"Musikredaktion", + "showType":"Unmoderiertes Musikprogramm", + "showCategories":"", + "showTopics":"", + "showMusicfocus":"", + "showLanguages":"", + "showFundingcategory":"Standard", "memo":"", "className":"default" } diff --git a/tests/test_scheduling_api_fetcher.py b/tests/test_scheduling_api_fetcher.py index a47a12179d055819a3d3a7ce75ff4942ce045d55..d4603422d6df90fcc66dc60c5b394999c42a61d4 100644 --- a/tests/test_scheduling_api_fetcher.py +++ b/tests/test_scheduling_api_fetcher.py @@ -102,8 +102,8 @@ class TestSchedulingApiFetcher(unittest.TestCase): # Test Timeslot 1 ts1 = response[0] - self.assertEqual(1, ts1["show_id"]) - self.assertEqual("Musikprogramm", ts1["show_name"]) + self.assertEqual(1, ts1["showId"]) + self.assertEqual("Musikprogramm", ts1["showName"]) self.assertEqual("Wurlitzer", ts1["title"]) self.assertEqual(1, ts1["playlist_id"]) self.assertEqual(1, ts1["playlist"]["id"]) @@ -113,8 +113,8 @@ class TestSchedulingApiFetcher(unittest.TestCase): # Test Timeslot 2 ts2 = response[1] - self.assertEqual(1, ts2["show_id"]) - self.assertEqual("Musikprogramm", ts2["show_name"]) + self.assertEqual(1, ts2["showId"]) + self.assertEqual("Musikprogramm", ts2["showName"]) self.assertEqual("Pepi's Polka II", ts2["title"]) self.assertEqual(1, ts2["playlist_id"]) self.assertEqual(1, ts2["playlist"]["id"])