Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Model
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-12-03 17:17:53 +0300
committerJoas Schilling <coding@schilljs.com>2022-02-17 18:31:00 +0300
commit4eb1f73ca1170329d80a6f040461fb7ac7be4ecc (patch)
tree9f93aaabf76f047ad8caa9ce3babd81d1687c962 /lib/Model
parent55121e46170af29d752eece2b99cc72bb8b6f1e2 (diff)
Add an API endpoint to get all invites
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Model')
-rw-r--r--lib/Model/InvitationMapper.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Model/InvitationMapper.php b/lib/Model/InvitationMapper.php
index f54cbafd8..01f288678 100644
--- a/lib/Model/InvitationMapper.php
+++ b/lib/Model/InvitationMapper.php
@@ -32,6 +32,7 @@ use OCP\AppFramework\Db\QBMapper;
use OCP\DB\Exception as DBException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
+use OCP\IUser;
/**
* Class InvitationMapper
@@ -78,6 +79,21 @@ class InvitationMapper extends QBMapper {
}
/**
+ * @param IUser $user
+ * @return Invitation[]
+ * @throws DBException
+ */
+ public function getInvitationsForUser(IUser $user): array {
+ $qb = $this->db->getQueryBuilder();
+
+ $qb->select('*')
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($user->getUID())));
+
+ return $this->findEntities($qb);
+ }
+
+ /**
* @throws DBException
*/
public function countInvitationsForRoom(Room $room): int {