diff options
author | Marco Nassabain <marco.nassabain@hotmail.com> | 2021-02-24 23:23:29 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 22:31:21 +0200 |
commit | 0f6ec7c99ca43da46766ca6126ae20d280e9b662 (patch) | |
tree | 6335999fb503cbebe5d5670801ae79b12a4aad6f /lib/Service | |
parent | 7e1a0b47cf369f33eedfbd628dea40fd8589a97b (diff) |
✨ Implementer shared getter + add count in request
- ItemServiceV2: added sharedWithUser - returns unread shared items
- ItemController & FeedController - returning shared count
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ItemServiceV2.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php index 442fcc1ce..10463b13a 100644 --- a/lib/Service/ItemServiceV2.php +++ b/lib/Service/ItemServiceV2.php @@ -460,5 +460,18 @@ class ItemServiceV2 extends Service return $this->mapper->insert($sharedItem); } - // TODO: implement shared() -> return all items shared with user + /** + * Return all items shared with a given user + * + * @param string $userId + * + * @return Item[] + */ + public function sharedWithUser(string $userId): array + { + return $this->findAllForUser($userId, [ + 'shared_with' => $userId, + 'unread' => true + ]); + } } |