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

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Db
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2019-12-23 00:21:23 +0300
committerdartcafe <github@dartcafe.de>2019-12-23 00:21:23 +0300
commit66f8977b374ec8ee6caa87bc912550db0630c447 (patch)
tree939a61ee7c780cf854aa030f7f1d8fbaa6cf6cdf /lib/Db
parent923fe1897f3f6962d95a94577b2d03ae5bc512ad (diff)
logging for scheduled mails
Diffstat (limited to 'lib/Db')
-rw-r--r--lib/Db/Log.php64
-rw-r--r--lib/Db/LogMapper.php59
-rw-r--r--lib/Db/NoticeMapper.php3
3 files changed, 124 insertions, 2 deletions
diff --git a/lib/Db/Log.php b/lib/Db/Log.php
new file mode 100644
index 00000000..5ca6b89d
--- /dev/null
+++ b/lib/Db/Log.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
+ *
+ * @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
+ * @author Kai Schröer <git@schroeer.co>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Polls\Db;
+
+use JsonSerializable;
+
+use OCP\AppFramework\Db\Entity;
+
+/**
+ * @method integer getPollId()
+ * @method void setPollId(integer $value)
+ * @method integer getCreated()
+ * @method void setCreated(integer $value)
+ * @method integer getUserId()
+ * @method void setUserId(integer $value)
+ * @method integer getDisplayName()
+ * @method void setDisplayName(integer $value)
+ * @method integer getMessageId()
+ * @method void setMessageId(integer $value)
+ * @method string getMessage()
+ * @method void setMessage(string $value)
+ */
+class Log extends Entity implements JsonSerializable {
+ protected $pollId;
+ protected $created;
+ protected $userId;
+ protected $displayName;
+ protected $messageId;
+ protected $message;
+
+ public function jsonSerialize() {
+ return [
+ 'id' => $this->id,
+ 'created' => $this->created,
+ 'pollId' => $this->pollId,
+ 'userId' => $this->userId,
+ 'displayName' => $this->displayName,
+ 'message_id' => $this->messageId,
+ 'message' => $this->message
+ ];
+ }
+}
diff --git a/lib/Db/LogMapper.php b/lib/Db/LogMapper.php
new file mode 100644
index 00000000..12b9cc44
--- /dev/null
+++ b/lib/Db/LogMapper.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
+ *
+ * @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
+ * @author René Gieling <github@dartcafe.de>
+*
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Polls\Db;
+
+use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IDBConnection;
+use OCP\AppFramework\Db\QBMapper;
+
+class LogMapper extends QBMapper {
+
+ /**
+ * LogMapper constructor.
+ * @param IDBConnection $db
+ */
+ public function __construct(IDBConnection $db) {
+ parent::__construct($db, 'polls_log', '\OCA\Polls\Db\Log');
+ }
+
+ /**
+ * @param int $pollId
+ * @throws \OCP\AppFramework\Db\DoesNotExistException if not found
+ * @return array
+ */
+
+ public function findByProcessed($switch = false) {
+ $qb = $this->db->getQueryBuilder();
+
+ $qb->select('*')
+ ->from($this->getTableName())
+ ->where(
+ $qb->expr()->eq('processed', $qb->createNamedParameter($switch, IQueryBuilder::PARAM_BOOL))
+ );
+
+ return $this->findEntities($qb);
+ }
+
+}
diff --git a/lib/Db/NoticeMapper.php b/lib/Db/NoticeMapper.php
index 0b75edb1..fa89afb0 100644
--- a/lib/Db/NoticeMapper.php
+++ b/lib/Db/NoticeMapper.php
@@ -31,7 +31,7 @@ use OCP\AppFramework\Db\QBMapper;
class NoticeMapper extends QBMapper {
/**
- * NotificationMapper constructor.
+ * NoticeMapper constructor.
* @param IDBConnection $db
*/
public function __construct(IDBConnection $db) {
@@ -41,7 +41,6 @@ class NoticeMapper extends QBMapper {
/**
* @param int $pollId
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
- * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return array
*/