From 04fbcc5f361cd7144fd0d682c147f9aaacc8c4cb Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 22 Jun 2022 16:42:09 +0200 Subject: [PATCH] feat(api): rename podcasts models fields (#1910) --- api/libretime_api/podcasts/models/podcast.py | 19 +++++++++--- api/schema.yml | 32 ++++++++++---------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/api/libretime_api/podcasts/models/podcast.py b/api/libretime_api/podcasts/models/podcast.py index e136307bd..6407a7238 100644 --- a/api/libretime_api/podcasts/models/podcast.py +++ b/api/libretime_api/podcasts/models/podcast.py @@ -9,12 +9,14 @@ class Podcast(models.Model): language = models.CharField(max_length=4096, blank=True, null=True) copyright = models.CharField(max_length=4096, blank=True, null=True) link = models.CharField(max_length=4096, blank=True, null=True) + itunes_author = models.CharField(max_length=4096, blank=True, null=True) itunes_keywords = models.CharField(max_length=4096, blank=True, null=True) itunes_summary = models.CharField(max_length=4096, blank=True, null=True) itunes_subtitle = models.CharField(max_length=4096, blank=True, null=True) itunes_category = models.CharField(max_length=4096, blank=True, null=True) itunes_explicit = models.CharField(max_length=4096, blank=True, null=True) + owner = models.ForeignKey( "core.User", on_delete=models.DO_NOTHING, @@ -35,14 +37,16 @@ class Podcast(models.Model): class PodcastEpisode(models.Model): + podcast = models.ForeignKey("Podcast", on_delete=models.DO_NOTHING) + file = models.ForeignKey( "storage.File", on_delete=models.DO_NOTHING, blank=True, null=True, ) - podcast = models.ForeignKey("Podcast", on_delete=models.DO_NOTHING) - publication_date = models.DateTimeField() + + published_at = models.DateTimeField(db_column="publication_date") download_url = models.CharField(max_length=4096) episode_guid = models.CharField(max_length=4096) episode_title = models.CharField(max_length=4096) @@ -78,10 +82,15 @@ class StationPodcast(models.Model): class ImportedPodcast(models.Model): - auto_ingest = models.BooleanField() - auto_ingest_timestamp = models.DateTimeField(blank=True, null=True) - album_override = models.BooleanField() podcast = models.ForeignKey("Podcast", on_delete=models.DO_NOTHING) + override_album = models.BooleanField(db_column="album_override") + + auto_ingest = models.BooleanField() + auto_ingested_at = models.DateTimeField( + blank=True, + null=True, + db_column="auto_ingest_timestamp", + ) def get_owner(self): return self.podcast.owner diff --git a/api/schema.yml b/api/schema.yml index 9ad776709..b5cc5c1fe 100644 --- a/api/schema.yml +++ b/api/schema.yml @@ -6110,21 +6110,21 @@ components: type: string format: uri readOnly: true + override_album: + type: boolean auto_ingest: type: boolean - auto_ingest_timestamp: + auto_ingested_at: type: string format: date-time nullable: true - album_override: - type: boolean podcast: type: string format: uri required: - - album_override - auto_ingest - item_url + - override_album - podcast ListenerCount: type: object @@ -6523,14 +6523,14 @@ components: type: string format: uri readOnly: true + override_album: + type: boolean auto_ingest: type: boolean - auto_ingest_timestamp: + auto_ingested_at: type: string format: date-time nullable: true - album_override: - type: boolean podcast: type: string format: uri @@ -6816,7 +6816,7 @@ components: type: string format: uri readOnly: true - publication_date: + published_at: type: string format: date-time download_url: @@ -6830,13 +6830,13 @@ components: maxLength: 4096 episode_description: type: string + podcast: + type: string + format: uri file: type: string format: uri nullable: true - podcast: - type: string - format: uri PatchedPreference: type: object properties: @@ -7675,7 +7675,7 @@ components: type: string format: uri readOnly: true - publication_date: + published_at: type: string format: date-time download_url: @@ -7689,13 +7689,13 @@ components: maxLength: 4096 episode_description: type: string + podcast: + type: string + format: uri file: type: string format: uri nullable: true - podcast: - type: string - format: uri required: - download_url - episode_description @@ -7703,7 +7703,7 @@ components: - episode_title - item_url - podcast - - publication_date + - published_at Preference: type: object properties: