mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Just some reorder of arguments..
This commit is contained in:
@@ -134,14 +134,31 @@ class NoteApiController extends ApiController {
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param array $attachments
|
* @param string $color
|
||||||
* @param bool $isPinned
|
* @param bool $isPinned
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
* @param array $sharedWith
|
* @param array $sharedWith
|
||||||
* @param string $color
|
* @param array $attachments
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $title, string $content, array $attachments, bool $isPinned, array $tags, array $sharedWith, string $color): JSONResponse {
|
public function update(int $id,
|
||||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachments, $isPinned, $tags, $sharedWith, $color);
|
string $title,
|
||||||
|
string $content,
|
||||||
|
string $color,
|
||||||
|
bool $isPinned,
|
||||||
|
array $tags,
|
||||||
|
array $sharedWith,
|
||||||
|
array $attachments): JSONResponse
|
||||||
|
{
|
||||||
|
$note = $this->noteService->update($this->userId,
|
||||||
|
$id,
|
||||||
|
$title,
|
||||||
|
$content,
|
||||||
|
$color,
|
||||||
|
$isPinned,
|
||||||
|
$tags,
|
||||||
|
$sharedWith,
|
||||||
|
$attachments);
|
||||||
|
|
||||||
if (is_null($note)) {
|
if (is_null($note)) {
|
||||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,14 +126,31 @@ class NoteController extends Controller {
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param array $attachments
|
* @param string $color
|
||||||
* @param bool $isPinned
|
* @param bool $isPinned
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
* @param array $sharedWith
|
* @param array $sharedWith
|
||||||
* @param string $color
|
* @param array $attachments
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $title, string $content, array $attachments = [], bool $isPinned, array $tags = [], array $sharedWith = [], string $color): JSONResponse {
|
public function update(int $id,
|
||||||
$note = $this->noteService->update($this->userId, $id, $title, $content, $attachments, $isPinned, $tags, $sharedWith, $color);
|
string $title,
|
||||||
|
string $content,
|
||||||
|
string $color,
|
||||||
|
bool $isPinned,
|
||||||
|
array $tags,
|
||||||
|
array $sharedWith,
|
||||||
|
array $attachments): JSONResponse
|
||||||
|
{
|
||||||
|
$note = $this->noteService->update($this->userId,
|
||||||
|
$id,
|
||||||
|
$title,
|
||||||
|
$content,
|
||||||
|
$color,
|
||||||
|
$isPinned,
|
||||||
|
$tags,
|
||||||
|
$sharedWith,
|
||||||
|
$attachments);
|
||||||
|
|
||||||
if (is_null($note)) {
|
if (is_null($note)) {
|
||||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ class NoteService {
|
|||||||
|
|
||||||
// Insert true color pin and tags to response
|
// Insert true color pin and tags to response
|
||||||
$newNote->setColor($hcolor->getColor());
|
$newNote->setColor($hcolor->getColor());
|
||||||
$newNote->setIsPinned(false);
|
$newNote->setIsPinned($isPinned);
|
||||||
$newNote->setTags([]);
|
$newNote->setTags([]);
|
||||||
$newNote->setAttachts([]);
|
$newNote->setAttachts([]);
|
||||||
|
|
||||||
@@ -209,21 +209,21 @@ class NoteService {
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param array $attachts
|
|
||||||
* @param bool $pinned
|
|
||||||
* @param array $tags
|
|
||||||
* @param array $shares
|
|
||||||
* @param string $color
|
* @param string $color
|
||||||
|
* @param bool $isPinned
|
||||||
|
* @param array $sharedWith
|
||||||
|
* @param array $tags
|
||||||
|
* @param array $attachments
|
||||||
*/
|
*/
|
||||||
public function update(string $userId,
|
public function update(string $userId,
|
||||||
int $id,
|
int $id,
|
||||||
string $title,
|
string $title,
|
||||||
string $content,
|
string $content,
|
||||||
array $attachts,
|
string $color,
|
||||||
bool $pinned,
|
bool $isPinned,
|
||||||
|
array $sharedWith,
|
||||||
array $tags,
|
array $tags,
|
||||||
array $shares,
|
array $attachments): ?Note
|
||||||
string $color): ?Note
|
|
||||||
{
|
{
|
||||||
// Get current Note and Color.
|
// Get current Note and Color.
|
||||||
$note = $this->get($userId, $id);
|
$note = $this->get($userId, $id);
|
||||||
@@ -257,7 +257,7 @@ class NoteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add new attachts
|
// Add new attachts
|
||||||
foreach ($attachts as $attach) {
|
foreach ($attachments as $attach) {
|
||||||
if (!$this->attachMapper->fileAttachExists($userId, $id, $attach['file_id'])) {
|
if (!$this->attachMapper->fileAttachExists($userId, $id, $attach['file_id'])) {
|
||||||
$hAttach = new Attach();
|
$hAttach = new Attach();
|
||||||
$hAttach->setUserId($userId);
|
$hAttach->setUserId($userId);
|
||||||
@@ -284,7 +284,7 @@ class NoteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add new shares
|
// Add new shares
|
||||||
foreach ($shares as $share) {
|
foreach ($sharedWith as $share) {
|
||||||
if (!$this->noteShareMapper->existsByNoteAndUser($id, $share['shared_user'])) {
|
if (!$this->noteShareMapper->existsByNoteAndUser($id, $share['shared_user'])) {
|
||||||
$hShare = new NoteShare();
|
$hShare = new NoteShare();
|
||||||
$hShare->setNoteId($id);
|
$hShare->setNoteId($id);
|
||||||
@@ -333,7 +333,7 @@ class NoteService {
|
|||||||
// Set new info on Note
|
// Set new info on Note
|
||||||
$note->setTitle($title);
|
$note->setTitle($title);
|
||||||
$note->setContent($content);
|
$note->setContent($content);
|
||||||
$note->setPinned($pinned ? 1 : 0);
|
$note->setPinned($isPinned ? 1 : 0);
|
||||||
$note->setTimestamp(time());
|
$note->setTimestamp(time());
|
||||||
$note->setColorId($hcolor->id);
|
$note->setColorId($hcolor->id);
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ class NoteService {
|
|||||||
|
|
||||||
// Insert true color and pin to response
|
// Insert true color and pin to response
|
||||||
$newnote->setColor($hcolor->getColor());
|
$newnote->setColor($hcolor->getColor());
|
||||||
$newnote->setIsPinned($note->getPinned() ? true : false);
|
$newnote->setIsPinned($isPinned);
|
||||||
|
|
||||||
// Fill new tags
|
// Fill new tags
|
||||||
$newnote->setTags($this->tagmapper->getTagsForNote($userId, $newnote->getId()));
|
$newnote->setTags($this->tagmapper->getTagsForNote($userId, $newnote->getId()));
|
||||||
|
|||||||
Reference in New Issue
Block a user