Implement backend code to update shares with others

This commit is contained in:
Matias De lellis committed 2020-06-15 23:52:24 -03:00
1 parent c7a29e51f9
commit 8f88f88dcb
4 files changed
+63 -21

No files matched your search

+10
View File
@@ -45,4 +45,14 @@ class NoteShareMapper extends Mapper {
$sql = 'DELETE FROM *PREFIX*quicknotes_shares WHERE note_id = ?';
$this->execute($sql, [$noteId]);
}
public function existsByNoteAndUser($noteId, $userId) {
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_user = ? AND note_id = ?';
try {
return $this->findEntities($sql, [$userId, $noteId]);
} catch (DoesNotExistException $e) {
return false;
}
return true;
}
}