mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
29 lines
797 B
PHP
29 lines
797 B
PHP
<?php
|
|
namespace OCA\QuickNotes\Db;
|
|
|
|
use OCP\IDb;
|
|
use OCP\AppFramework\Db\Mapper;
|
|
use OCP\AppFramework\Db\DoesNotExistException;
|
|
|
|
class ShareMapper extends Mapper {
|
|
|
|
public function __construct(IDb $db) {
|
|
parent::__construct($db, 'quicknotes_notes', '\OCA\QuickNotes\Db\Share');
|
|
}
|
|
|
|
/*public function find($id, $userId) {
|
|
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE id = ? AND user_id = ?';
|
|
return $this->findEntity($sql, [$id, $userId]);
|
|
}*/
|
|
|
|
public function findForUser($userId) {
|
|
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_user = ?';
|
|
return $this->findEntities($sql, [$userId]);
|
|
}
|
|
|
|
public function findForGroup($groupId) {
|
|
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_group = ?';
|
|
return $this->findEntities($sql, [$groupId]);
|
|
}
|
|
}
|