fix: rename podcast name to podcast handle to clarify field usage

- podcast name was too vague and didn't come clearly for users: handle is more relevant
- update
package.json dependencies and remove unnused packages

closes #126
This commit is contained in:
Yassine Doghri 2021-07-26 13:10:46 +00:00
commit 9dd4c7741e
75 changed files with 14944 additions and 13691 deletions

View file

@ -147,14 +147,14 @@ class EpisodeModel extends Model
*/
protected $beforeDelete = ['clearCache'];
public function getEpisodeBySlug(string $podcastName, string $episodeSlug): ?Episode
public function getEpisodeBySlug(string $podcastHandle, string $episodeSlug): ?Episode
{
$cacheName = "podcast-{$podcastName}_episode-{$episodeSlug}";
$cacheName = "podcast-{$podcastHandle}_episode-{$episodeSlug}";
if (! ($found = cache($cacheName))) {
$found = $this->select('episodes.*')
->join('podcasts', 'podcasts.id = episodes.podcast_id')
->where('slug', $episodeSlug)
->where('podcasts.name', $podcastName)
->where('podcasts.handle', $podcastHandle)
->where('`published_at` <= NOW()', null, false)
->first();
@ -292,7 +292,7 @@ class EpisodeModel extends Model
cache()
->deleteMatching("podcast#{$episode->podcast_id}*");
cache()
->deleteMatching("podcast-{$episode->podcast->name}*");
->deleteMatching("podcast-{$episode->podcast->handle}*");
cache()
->delete("podcast_episode#{$episode->id}");
cache()