From aac20784ccc0411c104f812eb1579ace260c6826 Mon Sep 17 00:00:00 2001 From: Shyim Date: Wed, 9 May 2018 21:33:19 +0200 Subject: [PATCH] Added channelName column, needed for Chat integration --- .gitignore | 5 +++- .../ReCast/Endpoints/EditEndpoint.vue | 3 ++ public/theme/src/main.js | 2 +- src/Controller/Streams.php | 1 + src/Entity/Endpoint.php | 24 +++++++++++++++ src/Migrations/Version20180509192256.php | 30 +++++++++++++++++++ 6 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 src/Migrations/Version20180509192256.php diff --git a/.gitignore b/.gitignore index 392838c..1321874 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,7 @@ yarn-error.log ###< symfony/web-server-bundle ### .idea -/config/jwt \ No newline at end of file + +###> lexik/jwt-authentication-bundle ### +/config/jwt/*.pem +###< lexik/jwt-authentication-bundle ### diff --git a/public/theme/src/components/ReCast/Endpoints/EditEndpoint.vue b/public/theme/src/components/ReCast/Endpoints/EditEndpoint.vue index 2a68396..b763b50 100644 --- a/public/theme/src/components/ReCast/Endpoints/EditEndpoint.vue +++ b/public/theme/src/components/ReCast/Endpoints/EditEndpoint.vue @@ -36,6 +36,8 @@ + + @@ -61,6 +63,7 @@ type: 'Mixer', server: '', streamKey: '', + channelName: '', }, services: {}, serviceNames: [] diff --git a/public/theme/src/main.js b/public/theme/src/main.js index 44883a8..e38c449 100644 --- a/public/theme/src/main.js +++ b/public/theme/src/main.js @@ -23,7 +23,7 @@ const router = new VueRouter({ }); Vue.router = router; -axios.defaults.baseURL = typeof appUrl === 'undefined' ? `http://streamer.miku/api` : appUrl; +axios.defaults.baseURL = typeof appUrl === 'undefined' ? `http://localhost/api` : appUrl; Vue.use(VueAxios, axios); Vue.use(VueNotify); diff --git a/src/Controller/Streams.php b/src/Controller/Streams.php index 5583345..fa7e9ab 100644 --- a/src/Controller/Streams.php +++ b/src/Controller/Streams.php @@ -250,6 +250,7 @@ class Streams extends Controller $endpoint->setType($requestBody['type']); $endpoint->setServer($requestBody['server']); $endpoint->setStreamKey($requestBody['streamKey']); + $endpoint->setChannelName($requestBody['channelName']); $endpoint->setStream($stream); $manager = $this->get('doctrine.orm.entity_manager'); diff --git a/src/Entity/Endpoint.php b/src/Entity/Endpoint.php index 2f9eabf..6cb7a02 100644 --- a/src/Entity/Endpoint.php +++ b/src/Entity/Endpoint.php @@ -51,6 +51,12 @@ class Endpoint implements \JsonSerializable */ private $streamKey; + /** + * @ORM\Column(name="channelName", type="string", length=255) + * @var string + */ + private $channelName; + /** * @ORM\ManyToOne(targetEntity="App\Entity\Streams", inversedBy="endpoints") * @ORM\JoinColumn(name="stream_id", referencedColumnName="id") @@ -185,6 +191,24 @@ class Endpoint implements \JsonSerializable $this->stream = $stream; } + /** + * @return string + * @author Soner Sayakci + */ + public function getChannelName(): string + { + return $this->channelName; + } + + /** + * @param string $channelName + * @author Soner Sayakci + */ + public function setChannelName(string $channelName): void + { + $this->channelName = $channelName; + } + /** * @ORM\PostPersist() * @ORM\PostUpdate() diff --git a/src/Migrations/Version20180509192256.php b/src/Migrations/Version20180509192256.php new file mode 100644 index 0000000..cc43236 --- /dev/null +++ b/src/Migrations/Version20180509192256.php @@ -0,0 +1,30 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE role role VARCHAR(255) DEFAULT \'user\' NOT NULL'); + $this->addSql('ALTER TABLE endpoint ADD channelName VARCHAR(255) NOT NULL, CHANGE stream_id stream_id INT DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE endpoint DROP channelName, CHANGE stream_id stream_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE user CHANGE role role VARCHAR(255) DEFAULT \'\'user\'\' NOT NULL COLLATE utf8mb4_unicode_ci'); + } +}