mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Rename some api parameters.
This commit is contained in:
@@ -116,13 +116,14 @@ class NoteApiController extends ApiController {
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param array $attachts
|
* @param array $attachments
|
||||||
* @param bool $pinned
|
* @param bool $isPinned
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
|
* @param array $sharedWith
|
||||||
* @param string $color
|
* @param string $color
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $title, string $content, array $attachts, bool $pinned, array $tags, string $color = "#F7EB96"): JSONResponse {
|
public function update(int $id, string $title, string $content, array $attachments, bool $isPinned, array $tags, array $sharedWith, string $color): JSONResponse {
|
||||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachts, $pinned, $tags, $color);
|
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachments, $isPinned, $tags, $sharedWith, $color);
|
||||||
if (is_null($note)) {
|
if (is_null($note)) {
|
||||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,14 +108,14 @@ class NoteController extends Controller {
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param array $attachts
|
* @param array $attachments
|
||||||
* @param bool $pinned
|
* @param bool $isPinned
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
* @param array $shared_with
|
* @param array $sharedWith
|
||||||
* @param string $color
|
* @param string $color
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $title, string $content, array $attachts, bool $pinned, array $tags, array $shared_with, string $color = "#F7EB96"): JSONResponse {
|
public function update(int $id, string $title, string $content, array $attachments = [], bool $isPinned, array $tags = [], array $sharedWith = [], string $color): JSONResponse {
|
||||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachts, $pinned, $tags, $shared_with, $color);
|
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachments, $isPinned, $tags, $sharedWith, $color);
|
||||||
if (is_null($note)) {
|
if (is_null($note)) {
|
||||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class Note extends Entity implements JsonSerializable {
|
|||||||
protected $userId;
|
protected $userId;
|
||||||
protected $sharedWith = [];
|
protected $sharedWith = [];
|
||||||
protected $sharedBy = [];
|
protected $sharedBy = [];
|
||||||
protected $isShared;
|
|
||||||
protected $tags;
|
protected $tags;
|
||||||
protected $attachts;
|
protected $attachts;
|
||||||
|
|
||||||
@@ -32,20 +31,17 @@ class Note extends Entity implements JsonSerializable {
|
|||||||
|
|
||||||
public function jsonSerialize() {
|
public function jsonSerialize() {
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'content' => $this->content,
|
'content' => $this->content,
|
||||||
'pinned' => $this->pinned,
|
'pinned' => $this->pinned,
|
||||||
'ispinned' => $this->isPinned,
|
'isPinned' => $this->isPinned,
|
||||||
'timestamp' => $this->timestamp,
|
'timestamp' => $this->timestamp,
|
||||||
'colorid' => $this->colorId,
|
'color' => $this->color,
|
||||||
'color' => $this->color,
|
'sharedWith' => $this->sharedWith,
|
||||||
'userid' => $this->userId,
|
'sharedBy' => $this->sharedBy,
|
||||||
'shared_with' => $this->sharedWith,
|
'tags' => $this->tags,
|
||||||
'shared_by' => $this->sharedBy,
|
'attachments' => $this->attachts
|
||||||
'is_shared' => $this->isShared,
|
|
||||||
'tags' => $this->tags,
|
|
||||||
'attachts' => $this->attachts
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ class NoteService {
|
|||||||
|
|
||||||
// Set shares with others.
|
// Set shares with others.
|
||||||
foreach($notes as $note) {
|
foreach($notes as $note) {
|
||||||
$note->setIsShared(false);
|
|
||||||
$note->setSharedWith($this->noteShareMapper->getSharesForNote($note->getId()));
|
$note->setSharedWith($this->noteShareMapper->getSharesForNote($note->getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +89,6 @@ class NoteService {
|
|||||||
$sharedEntries = $this->noteShareMapper->findForUser($userId);
|
$sharedEntries = $this->noteShareMapper->findForUser($userId);
|
||||||
foreach($sharedEntries as $sharedEntry) {
|
foreach($sharedEntries as $sharedEntry) {
|
||||||
$sharedNote = $this->notemapper->findShared($sharedEntry->getNoteId());
|
$sharedNote = $this->notemapper->findShared($sharedEntry->getNoteId());
|
||||||
$sharedNote->setIsShared(true);
|
|
||||||
|
|
||||||
$sharedEntry->setUserId($sharedNote->getUserId());
|
$sharedEntry->setUserId($sharedNote->getUserId());
|
||||||
$sharedNote->setSharedBy([$sharedEntry]);
|
$sharedNote->setSharedBy([$sharedEntry]);
|
||||||
$shares[] = $sharedNote;
|
$shares[] = $sharedNote;
|
||||||
@@ -343,7 +340,6 @@ class NoteService {
|
|||||||
$newnote->setAttachts($attachts);
|
$newnote->setAttachts($attachts);
|
||||||
|
|
||||||
// Fill shared with with others
|
// Fill shared with with others
|
||||||
$newnote->setIsShared(false);
|
|
||||||
$newnote->setSharedWith($this->noteShareMapper->getSharesForNote($newnote->getId()));
|
$newnote->setSharedWith($this->noteShareMapper->getSharesForNote($newnote->getId()));
|
||||||
|
|
||||||
// Remove old color if necessary
|
// Remove old color if necessary
|
||||||
|
|||||||
Reference in New Issue
Block a user