From 3a18517de894ca02de625ba9e0a8d951c996f087 Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Tue, 16 Jul 2024 16:22:52 -0400
Subject: [PATCH] fix: add examples to basic & playout views

---
 program/views.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 68 insertions(+), 2 deletions(-)

diff --git a/program/views.py b/program/views.py
index 4385c785..1b113ec6 100644
--- a/program/views.py
+++ b/program/views.py
@@ -107,10 +107,34 @@ class AbstractAPIProgramViewSet(
 
 @extend_schema_view(
     list=extend_schema(
+        examples=[
+            OpenApiExample(
+                "Example entry",
+                value={
+                    "end": "2024-07-15T15:30:00-04:00",
+                    "id": "2024-07-15T19:07:38.604349+00:00...2024-07-15T19:30:00+00:00",
+                    "playlistId": None,
+                    "showId": 1,
+                    "start": "2024-07-15T15:07:38.604349-04:00",
+                    "timeslotId": None,
+                },
+            ),
+            OpenApiExample(
+                "Example virtual entry",
+                value={
+                    "end": "2024-07-15T18:00:00-04:00",
+                    "id": "2024-07-15T19:30:00+00:00...2024-07-15T22:00:00+00:00",
+                    "playlistId": None,
+                    "showId": 3,
+                    "start": "2024-07-15T15:30:00-04:00",
+                    "timeslotId": 141,
+                },
+            ),
+        ],
         summary=(
             "List program for a specific date range. "
             "Only returns the most basic data for clients that fetch other data themselves."
-        )
+        ),
     ),
 )
 class APIProgramBasicViewSet(AbstractAPIProgramViewSet):
@@ -119,11 +143,53 @@ class APIProgramBasicViewSet(AbstractAPIProgramViewSet):
 
 @extend_schema_view(
     list=extend_schema(
+        examples=[
+            OpenApiExample(
+                "Example entry",
+                value={
+                    "end": "2024-07-16T12:30:00-04:00",
+                    "episode": {"id": 11, "title": ""},
+                    "id": "2024-07-16T14:00:00+00:00...2024-07-16T16:30:00+00:00",
+                    "playlistId": None,
+                    "schedule": {"defaultPlaylistId": None, "id": 1},
+                    "show": {"defaultPlaylistId": None, "id": 2, "name": "EINS"},
+                    "showId": 2,
+                    "start": "2024-07-16T10:00:00-04:00",
+                    "timeslot": {
+                        "end": "2024-07-16T12:30:00-04:00",
+                        "id": 11,
+                        "memo": "",
+                        "noteId": 11,
+                        "playlistId": None,
+                        "repetitionOfId": None,
+                        "scheduleId": 1,
+                        "showId": 2,
+                        "start": "2024-07-16T10:00:00-04:00",
+                    },
+                    "timeslotId": 11,
+                },
+            ),
+            OpenApiExample(
+                "Example virtual entry",
+                value={
+                    "end": "2024-07-16T15:23:34.084852-04:00",
+                    "episode": None,
+                    "id": "2024-07-16T16:30:00+00:00...2024-07-16T19:23:34.084852+00:00",
+                    "playlistId": None,
+                    "schedule": None,
+                    "show": {"defaultPlaylistId": None, "id": 1, "name": "Musikpool"},
+                    "showId": 1,
+                    "start": "2024-07-16T12:30:00-04:00",
+                    "timeslot": None,
+                    "timeslotId": None,
+                },
+            ),
+        ],
         summary=(
             "List program for a specific date range. "
             "Returns an extended program dataset for use in the AURA engine. "
             "Not recommended for other tools."
-        )
+        ),
     ),
 )
 class APIProgramPlayoutViewSet(AbstractAPIProgramViewSet):
-- 
GitLab