diff --git a/appinfo/info.xml b/appinfo/info.xml index 36f6668..e117e8e 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -20,7 +20,8 @@ You need to have [GPodderSync](You need to have GPodderSync installed to use thi multimedia https://git.crystalyx.net/Xefir/RePod/issues - + + diff --git a/composer.json b/composer.json index d1613e1..eec5845 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "config": { "platform": { - "php": "7.4" + "php": "8.0" } } } diff --git a/composer.lock b/composer.lock index f366958..f9caed9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9de82c8d48d25264d6223d576d21996d", + "content-hash": "a1e3c2b1e55310ed136ba261a8932b08", "packages": [], "packages-dev": [ { @@ -389,7 +389,7 @@ "platform": [], "platform-dev": [], "platform-overrides": { - "php": "7.4" + "php": "8.0" }, "plugin-api-version": "2.3.0" } diff --git a/lib/Controller/Errors.php b/lib/Controller/Errors.php deleted file mode 100644 index dd8f973..0000000 --- a/lib/Controller/Errors.php +++ /dev/null @@ -1,23 +0,0 @@ - $e->getMessage()]; - return new DataResponse($message, Http::STATUS_NOT_FOUND); - } - } -} diff --git a/lib/Controller/NoteApiController.php b/lib/Controller/NoteApiController.php deleted file mode 100644 index 2c79e4f..0000000 --- a/lib/Controller/NoteApiController.php +++ /dev/null @@ -1,79 +0,0 @@ -service = $service; - $this->userId = $userId; - } - - /** - * @CORS - * @NoCSRFRequired - * @NoAdminRequired - */ - public function index(): DataResponse { - return new DataResponse($this->service->findAll($this->userId)); - } - - /** - * @CORS - * @NoCSRFRequired - * @NoAdminRequired - */ - public function show(int $id): DataResponse { - return $this->handleNotFound(function () use ($id) { - return $this->service->find($id, $this->userId); - }); - } - - /** - * @CORS - * @NoCSRFRequired - * @NoAdminRequired - */ - public function create(string $title, string $content): DataResponse { - return new DataResponse($this->service->create($title, $content, - $this->userId)); - } - - /** - * @CORS - * @NoCSRFRequired - * @NoAdminRequired - */ - public function update(int $id, string $title, - string $content): DataResponse { - return $this->handleNotFound(function () use ($id, $title, $content) { - return $this->service->update($id, $title, $content, $this->userId); - }); - } - - /** - * @CORS - * @NoCSRFRequired - * @NoAdminRequired - */ - public function destroy(int $id): DataResponse { - return $this->handleNotFound(function () use ($id) { - return $this->service->delete($id, $this->userId); - }); - } -} diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php deleted file mode 100644 index 5c6bdc2..0000000 --- a/lib/Controller/NoteController.php +++ /dev/null @@ -1,69 +0,0 @@ -service = $service; - $this->userId = $userId; - } - - /** - * @NoAdminRequired - */ - public function index(): DataResponse { - return new DataResponse($this->service->findAll($this->userId)); - } - - /** - * @NoAdminRequired - */ - public function show(int $id): DataResponse { - return $this->handleNotFound(function () use ($id) { - return $this->service->find($id, $this->userId); - }); - } - - /** - * @NoAdminRequired - */ - public function create(string $title, string $content): DataResponse { - return new DataResponse($this->service->create($title, $content, - $this->userId)); - } - - /** - * @NoAdminRequired - */ - public function update(int $id, string $title, - string $content): DataResponse { - return $this->handleNotFound(function () use ($id, $title, $content) { - return $this->service->update($id, $title, $content, $this->userId); - }); - } - - /** - * @NoAdminRequired - */ - public function destroy(int $id): DataResponse { - return $this->handleNotFound(function () use ($id) { - return $this->service->delete($id, $this->userId); - }); - } -} diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php deleted file mode 100644 index d95623d..0000000 --- a/lib/Controller/PageController.php +++ /dev/null @@ -1,27 +0,0 @@ - $this->id, - 'title' => $this->title, - 'content' => $this->content - ]; - } -} diff --git a/lib/Db/NoteMapper.php b/lib/Db/NoteMapper.php deleted file mode 100644 index 1e440c7..0000000 --- a/lib/Db/NoteMapper.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ -class NoteMapper extends QBMapper { - public function __construct(IDBConnection $db) { - parent::__construct($db, 'repod', Note::class); - } - - /** - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException - * @throws DoesNotExistException - */ - public function find(int $id, string $userId): Note { - /* @var $qb IQueryBuilder */ - $qb = $this->db->getQueryBuilder(); - $qb->select('*') - ->from('repod') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))) - ->andWhere($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); - return $this->findEntity($qb); - } - - /** - * @param string $userId - * @return array - */ - public function findAll(string $userId): array { - /* @var $qb IQueryBuilder */ - $qb = $this->db->getQueryBuilder(); - $qb->select('*') - ->from('repod') - ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); - return $this->findEntities($qb); - } -} diff --git a/lib/Migration/Version000000Date20181013124731.php b/lib/Migration/Version000000Date20181013124731.php deleted file mode 100644 index bc7fdc3..0000000 --- a/lib/Migration/Version000000Date20181013124731.php +++ /dev/null @@ -1,48 +0,0 @@ -hasTable('repod')) { - $table = $schema->createTable('repod'); - $table->addColumn('id', 'integer', [ - 'autoincrement' => true, - 'notnull' => true, - ]); - $table->addColumn('title', 'string', [ - 'notnull' => true, - 'length' => 200 - ]); - $table->addColumn('user_id', 'string', [ - 'notnull' => true, - 'length' => 200, - ]); - $table->addColumn('content', 'text', [ - 'notnull' => true, - 'default' => '' - ]); - - $table->setPrimaryKey(['id']); - $table->addIndex(['user_id'], 'repod_user_id_index'); - } - return $schema; - } -} diff --git a/lib/Service/NoteNotFound.php b/lib/Service/NoteNotFound.php deleted file mode 100644 index 5b129d7..0000000 --- a/lib/Service/NoteNotFound.php +++ /dev/null @@ -1,8 +0,0 @@ -mapper = $mapper; - } - - /** - * @return list - */ - public function findAll(string $userId): array { - return $this->mapper->findAll($userId); - } - - /** - * @return never - */ - private function handleException(Exception $e) { - if ($e instanceof DoesNotExistException || - $e instanceof MultipleObjectsReturnedException) { - throw new NoteNotFound($e->getMessage()); - } else { - throw $e; - } - } - - public function find(int $id, string $userId): Note { - try { - return $this->mapper->find($id, $userId); - - // in order to be able to plug in different storage backends like files - // for instance it is a good idea to turn storage related exceptions - // into service related exceptions so controllers and service users - // have to deal with only one type of exception - } catch (Exception $e) { - $this->handleException($e); - } - } - - public function create(string $title, string $content, string $userId): Note { - $note = new Note(); - $note->setTitle($title); - $note->setContent($content); - $note->setUserId($userId); - return $this->mapper->insert($note); - } - - public function update(int $id, string $title, string $content, string $userId): Note { - try { - $note = $this->mapper->find($id, $userId); - $note->setTitle($title); - $note->setContent($content); - return $this->mapper->update($note); - } catch (Exception $e) { - $this->handleException($e); - } - } - - public function delete(int $id, string $userId): Note { - try { - $note = $this->mapper->find($id, $userId); - $this->mapper->delete($note); - return $note; - } catch (Exception $e) { - $this->handleException($e); - } - } -} diff --git a/psalm.xml b/psalm.xml index e5035fe..1005f1b 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,6 @@