From 860f4c8857c4a57da1f40dbad7b780c4012a114d Mon Sep 17 00:00:00 2001
From: Jonas Heinrich <onny@project-insanity.org>
Date: Tue, 29 Dec 2020 16:37:32 +0100
Subject: [PATCH] enhance function subscribe show

---
 lib/Controller/ShowController.php                 | 8 ++++----
 lib/Db/Show.php                                   | 2 --
 lib/Migration/Version000000Date20181013124731.php | 4 ----
 lib/Service/ShowService.php                       | 4 ++--
 src/views/Show.vue                                | 3 +--
 5 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/lib/Controller/ShowController.php b/lib/Controller/ShowController.php
index 6a08a90..4d2efa1 100644
--- a/lib/Controller/ShowController.php
+++ b/lib/Controller/ShowController.php
@@ -65,10 +65,10 @@ class ShowController extends Controller {
 	/**
 	 * @NoAdminRequired
 	 */
-	 public function create(int $id, int $podcastid, string $imgurl,
-	 	string $author, string $title): DataResponse {
- 		return new DataResponse($this->service->create($id, $podcastid, $imgurl,
-			$author, $title, $this->userId));
+	 public function create(int $id, string $imgurl, string $author,
+	 	string $title): DataResponse {
+ 		return new DataResponse($this->service->create($id, $imgurl, $author,
+			$title, $this->userId));
  	}
 
 	/**
diff --git a/lib/Db/Show.php b/lib/Db/Show.php
index a6c6004..7ec543d 100644
--- a/lib/Db/Show.php
+++ b/lib/Db/Show.php
@@ -28,7 +28,6 @@ use JsonSerializable;
 use OCP\AppFramework\Db\Entity;
 
 class Show extends Entity implements JsonSerializable {
-	protected $podcastid;
 	protected $imgurl;
 	protected $author;
 	protected $title;
@@ -37,7 +36,6 @@ class Show extends Entity implements JsonSerializable {
 	public function jsonSerialize(): array {
 		return [
 			'id' => $this->id,
-			'podcastid' => $this->podcastid,
 			'imgurl' => $this->imgurl,
 			'author' => $this->author,
 			'title' => $this->title,
diff --git a/lib/Migration/Version000000Date20181013124731.php b/lib/Migration/Version000000Date20181013124731.php
index 1d88588..3528650 100644
--- a/lib/Migration/Version000000Date20181013124731.php
+++ b/lib/Migration/Version000000Date20181013124731.php
@@ -45,15 +45,11 @@ class Version000000Date20181013124731 extends SimpleMigrationStep {
 		if (!$schema->hasTable('shows')) {
 			$table = $schema->createTable('shows');
 			$table->addColumn('id', 'integer', [
-				'autoincrement' => true,
 				'notnull' => true,
 			]);
       $table->addColumn('user_id', 'string', [
 				'notnull' => true,
 			]);
-			$table->addColumn('podcastid', 'integer', [
-				'notnull' => true,
-			]);
 			$table->addColumn('imgurl', 'string');
 			$table->addColumn('author', 'string');
 			$table->addColumn('title', 'string');
diff --git a/lib/Service/ShowService.php b/lib/Service/ShowService.php
index 383f9a2..7aa0cb6 100644
--- a/lib/Service/ShowService.php
+++ b/lib/Service/ShowService.php
@@ -66,9 +66,9 @@ class ShowService {
 		}
 	}
 
-	public function create($podcastid, $imgurl, $author, $title, $userId) {
+	public function create($id, $imgurl, $author, $title, $userId) {
 		$show = new Show();
-		$show->setPodcastid($podcastid);
+		$show->setId($id);
 		$show->setImgurl($imgurl);
 		$show->setAuthor($author);
 		$show->setTitle($title);
diff --git a/src/views/Show.vue b/src/views/Show.vue
index 887c308..629ad33 100644
--- a/src/views/Show.vue
+++ b/src/views/Show.vue
@@ -137,8 +137,7 @@ export default {
 
 		async doSubscribe() {
 			const podcastShow = {
-				id: -1,
-				podcastid: this.podcast.id,
+				id: this.podcast.id,
 				imgurl: this.podcast.smallImageURL,
 				title: this.podcast.title,
 				author: this.podcast.author,
-- 
GitLab