diff --git a/lib/Db/Subscription.php b/lib/Db/Subscription.php new file mode 100644 index 0000000..2f47c06 --- /dev/null +++ b/lib/Db/Subscription.php @@ -0,0 +1,31 @@ +addType('creationTimestamp','integer'); + $this->addType('expirationTimestamp','integer'); + } + + public function jsonSerialize(): array { + return [ + 'id' => $this->id, + 'userId' => $this->userId, + 'collectionName' => $this->collectionName, + 'data' => $this->data, + 'creationTimestamp' => $this->creationTimestamp, + 'expirationTimestamp' => $this->expirationTimestampv + ]; + } +} \ No newline at end of file diff --git a/lib/Db/SubscriptionMapper.php b/lib/Db/SubscriptionMapper.php new file mode 100644 index 0000000..00e10dd --- /dev/null +++ b/lib/Db/SubscriptionMapper.php @@ -0,0 +1,35 @@ +db->getQueryBuilder(); + $qb->select('*') + ->from(self::TABLENAME) + ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))) + ->andWhere($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); + + return $this->findEntity($qb); + } +} \ No newline at end of file