Updated JSON models so they are easier to

handle by the client.
master
Michael 10 months ago
parent 5f1ee177ba
commit 66ef8aba63

@ -9,7 +9,7 @@ import (
// GET /health
// Returns the health status of the application
func GetHealth(c *gin.Context) {
// TODO: Consider adding health checks to services this app relise on like queue and the database.
// TODO: Consider adding health checks to services this app relies on like queue and the database.
// Send our response
c.String(http.StatusOK, "ok")

@ -18,7 +18,7 @@ func GetPodcastEpisode(c *gin.Context) {
return
}
c.JSON(http.StatusOK, gin.H{"data": PodcastEpisode})
c.JSON(http.StatusOK, PodcastEpisode)
}
// POST /podcast-episode
@ -37,5 +37,5 @@ func CreatePodcastEpisode(c *gin.Context) {
return
}
c.JSON(http.StatusOK, gin.H{"data": input})
c.JSON(http.StatusOK, input)
}

@ -24,7 +24,7 @@ func CreatePodcastSeries(c *gin.Context) {
return
}
c.JSON(http.StatusOK, gin.H{"data": input})
c.JSON(http.StatusOK, input)
}
// GET /podcast-series/:id
@ -37,5 +37,20 @@ func GetPodcastSeries(c *gin.Context) {
return
}
c.JSON(http.StatusOK, gin.H{"data": PodcastSeries})
/* PodcastEpisodeStruct{"https://lexfridman.com/?p=5393", "#359 Andrew Strominger: Black Holes, Quantum Gravity, and Theoretical Physics", "Lex Fridman Podcast", "Feb 15, 2023", "2:25:03", "Bhaskar Sunkara is a democratic socialist, political writer, founding editor of Jacobin, president of The Nation, and author of The Socialist Manifesto. Please support this podcast by checking out our sponsors: House of Macadamias: https://houseofmacadamias.com/lex and use code LEX to get 20% of your first order Linode: https://linode.com/lex to get $100 free credit Onnit: https://lexfridman.com/onnit to get up to 10% off InsideTracker: https://insidetracker.com/lex to get 20% off ExpressVPN: https://expressvpn.com/lexpod to get 3 months free EPISODE LINKS: Bhaskars Twitter: https://twitter.com/sunraysunray Jacobin: https://jacobin.com Jacobins Twitter: https://twitter.com/jacobin The Nation: https://thenation.com The Socialist Manifesto (book): https://amzn.to/3hKpt2p PODCAST INFO: Podcast website: https://lexfridman.com/podcast Apple Podcasts: https://apple.co/2lwqZIr Spotify: https://spoti.fi/2nEwCF8 RSS: https://lexfridman.com/feed/podcast/ YouTube Full Episodes: https://youtube.com/lexfridman YouTube Clips: https://youtube.com/lexclips SUPPORT & CONNECT: Check out the sponsors above, its the best way to support this podcast Support on Patreon: https://www.patreon.com/lexfridman Twitter: https://twitter.com/lexfridman Instagram: https://www.instagram.com/lexfridman LinkedIn: https://www.linkedin.com/in/lexfridman Facebook: https://www.facebook.com/lexfridman Medium: https://medium.com/@lexfridman OUTLINE: Heres the timestamps for the episode. On some podcast players you should be able to click the timestamp to jump to that time. (00:00) Introduction (13:24) Socialism (31:54) Communism (58:31) Class struggle (1:09:33) Quality of life (1:17:29) Unions (1:29:57) Corruption (1:43:15) Freedom of speech (1:51:38) War (1:59:24) Karl Marx (2:13:03) Socialist vision (2:18:28) AI and socialism (2:23:26) Socialist policies (2:48:45) Billionaires (2:54:43) Bernie Sanders (3:05:10) AOC (3:17:11) 2024 presidential election (3:22:05) China (3:31:06) Jacobin (3:38:35) The Socialist Manifesto (3:45:55) Advice for young people (3:49:28) Meaning of life", "https://cdn.player.fm/images/38011093/series/tXl33Iu1sb4pl2VB/512.png", "#359 Andrew Strominger: Black Holes, Quantum Gravity, and Theoretical Physics", "https://media.blubrry.com/takeituneasy/content.blubrry.com/takeituneasy/lex_ai_andrew_strominger.mp3"},
*/
c.JSON(http.StatusOK, PodcastSeries)
}
// GET /podcast-series/:id/episodes
// Get Podcast Episodes associated with a Podcast Series
func GetPodcastSeriesEpisodes(c *gin.Context) {
// Get model if it exists
var PodcastEpisodes []models.PodcastEpisode
if err := models.DB.Where("podcast_series_id = ?", c.Param("id")).Order("date_published desc").Find(&PodcastEpisodes).Error; err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"})
return
}
c.JSON(http.StatusOK, PodcastEpisodes)
}

@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.20
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
appVersion: "0.1.3"

@ -5,12 +5,12 @@ import "time"
type PodcastEpisode struct {
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
Name string `json:"name"`
DatePublished time.Time `json:"date_published"`
DatePublished time.Time `json:"datePublished"`
GUID string `json:"guid" desc:"Global Unique identifier of podcast." gorm:"uniqueIndex"`
Duration string `json:"duration"`
Description string `json:"description"`
ImageURL string `json:"image_url,omitempty"`
ContentURL string `json:"content_url"`
ImageURL string `json:"imageURL,omitempty"`
ContentURL string `json:"contentURL"`
PodcastSeriesID int `json:"podcast_series_id"`
PodcastSeries PodcastSeries `json:"podcast_series" desc:"Podcast series that this episode belongs to."`
}

@ -5,10 +5,10 @@ import "time"
type PodcastSeries struct {
ID int `json:"id,omitempty" gorm:"primaryKey;autoIncrement"`
WebFeed string `json:"web_feed" gorm:"uniqueIndex" desc:"URL of RSS feed for the podcast series."`
Name string `json:"name" desc:"Title of the podcast series."`
Name string `json:"name" gorm:"index:,expression:LOWER(name)" desc:"Title of the podcast series."`
URL string `json:"url" desc:"URL of the podcast series."`
Explicit bool `json:"explicit" desc:"Indicates if content was marked as explicit or not."`
ImageURL string `json:"image_url,omitempty" desc:"Image associated with the podcast series."`
ImageURL string `json:"imageURL,omitempty" desc:"Image associated with the podcast series."`
ITunesType string `json:"itunes_type,omitempty" desc:"The value of itunes:type provided in the feed."`
InLanguage string `json:"language" desc:"The language used in the podcast series."`
GUID string `json:"guid" desc:"Global Unique identifier of podcast."`

Loading…
Cancel
Save