mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Add inital view of tags
This commit is contained in:
@@ -17,25 +17,41 @@ use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
||||
use OCA\QuickNotes\Db\Note;
|
||||
use OCA\QuickNotes\Db\Color;
|
||||
use OCA\QuickNotes\Db\NoteShare;
|
||||
use OCA\QuickNotes\Db\NoteMapper;
|
||||
use OCA\QuickNotes\Db\ColorMapper;
|
||||
use OCA\QuickNotes\Db\Note;
|
||||
use OCA\QuickNotes\Db\NoteMapper;
|
||||
use OCA\QuickNotes\Db\NoteTag;
|
||||
use OCA\QuickNotes\Db\NoteTagMapper;
|
||||
use OCA\QuickNotes\Db\NoteShare;
|
||||
use OCA\QuickNotes\Db\NoteShareMapper;
|
||||
use OCA\QuickNotes\Db\Tag;
|
||||
use OCA\QuickNotes\Db\TagMapper;
|
||||
|
||||
class NoteController extends Controller {
|
||||
|
||||
private $notemapper;
|
||||
private $notetagmapper;
|
||||
private $colormapper;
|
||||
private $notesharemapper;
|
||||
private $tagmapper;
|
||||
private $userId;
|
||||
|
||||
public function __construct($AppName, IRequest $request, NoteMapper $notemapper, NoteShareMapper $notesharemapper, ColorMapper $colormapper, $UserId) {
|
||||
public function __construct($AppName,
|
||||
IRequest $request,
|
||||
NoteMapper $notemapper,
|
||||
NoteTagMapper $notetagmapper,
|
||||
NoteShareMapper $notesharemapper,
|
||||
ColorMapper $colormapper,
|
||||
TagMapper $tagmapper,
|
||||
$UserId)
|
||||
{
|
||||
parent::__construct($AppName, $request);
|
||||
$this->notemapper = $notemapper;
|
||||
$this->notetagmapper = $notetagmapper;
|
||||
$this->colormapper = $colormapper;
|
||||
$this->notesharemapper = $notesharemapper;
|
||||
$this->tagmapper = $tagmapper;
|
||||
$this->userId = $UserId;
|
||||
}
|
||||
|
||||
@@ -56,6 +72,7 @@ class NoteController extends Controller {
|
||||
} else {
|
||||
$note->setSharedWith(null);
|
||||
}
|
||||
$note->setTags($this->tagmapper->getTagsForNote($note->getId()));
|
||||
}
|
||||
$shareEntries = $this->notesharemapper->findForUser($this->userId);
|
||||
$shares = array();
|
||||
|
||||
46
controller/tagcontroller.php
Normal file
46
controller/tagcontroller.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Nextcloud - quicknotes
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Matias De lellis <mati86dl@gmail.com>
|
||||
* @copyright Matias De lellis 2019
|
||||
*/
|
||||
|
||||
namespace OCA\QuickNotes\Controller;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
||||
use OCA\QuickNotes\Db\Tag;
|
||||
use OCA\QuickNotes\Db\TagMapper;
|
||||
|
||||
class TagController extends Controller {
|
||||
|
||||
private $tagmapper;
|
||||
private $userId;
|
||||
|
||||
public function __construct($AppName,
|
||||
IRequest $request,
|
||||
TagMapper $tagmapper,
|
||||
$UserId)
|
||||
{
|
||||
parent::__construct($AppName, $request);
|
||||
$this->tagmapper = $tagmapper;
|
||||
$this->userId = $UserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function index() {
|
||||
$notes = $this->tagmapper->findAll($this->userId);
|
||||
return new DataResponse($notes);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user