migrate therinaldos.com data
Build & Deploy to DigitalOcean Space / build (push) Failing after 2m38s

This commit is contained in:
2024-05-05 15:50:45 -04:00
commit ef1ff240d4
23182 changed files with 3801898 additions and 0 deletions
@@ -0,0 +1,109 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class Calendar implements IQueryRow, JsonSerializable {
use TArrayTools;
private int $calendarId = 0;
private string $calendarName = '';
private string $calendarPrincipalUri = '';
private string $calendarUri = '';
public function __construct() {
}
public function getId(): string {
return $this->getCalendarPrincipalUri() . ':' . $this->getCalendarUri();
}
public function setCalendarId(int $calendarId): self {
$this->calendarId = $calendarId;
return $this;
}
public function getCalendarId(): int {
return $this->calendarId;
}
public function setCalendarName(string $calendarName): self {
$this->calendarName = $calendarName;
return $this;
}
public function getCalendarName(): string {
return $this->calendarName;
}
public function setCalendarPrincipalUri(string $calendarPrincipalUri): self {
$this->calendarPrincipalUri = $calendarPrincipalUri;
return $this;
}
public function getCalendarPrincipalUri(): string {
return $this->calendarPrincipalUri;
}
public function setCalendarUri(string $calendarUri): self {
$this->calendarUri = $calendarUri;
return $this;
}
public function getCalendarUri(): string {
return $this->calendarUri;
}
public function importFromDatabase(array $data): IQueryRow {
$this->setCalendarId($this->getInt('id', $data))
->setCalendarName($this->get('displayname', $data))
->setCalendarPrincipalUri($this->get('principaluri', $data))
->setCalendarUri($this->get('uri', $data));
return $this;
}
public function jsonSerialize(): array {
return [
'calendarName' => $this->getCalendarName(),
'calendarPrincipalUri' => $this->getCalendarPrincipalUri(),
'calendarUri' => $this->getCalendarUri()
];
}
}
@@ -0,0 +1,122 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class CalendarShare implements IQueryRow, JsonSerializable {
use TArrayTools;
private int $calendarId = 0;
private string $sharePrincipalUri = '';
private int $type = 0;
private string $user = '';
public function __construct() {
}
public function setCalendarId(int $calendarId): self {
$this->calendarId = $calendarId;
return $this;
}
public function getCalendarId(): int {
return $this->calendarId;
}
public function setSharePrincipalUri(string $sharePrincipalUri): self {
$this->sharePrincipalUri = $sharePrincipalUri;
return $this;
}
public function getSharePrincipalUri(): string {
return $this->sharePrincipalUri;
}
/**
* @param int $type
*
* @return CalendarShare
*/
public function setType(int $type): self {
$this->type = $type;
return $this;
}
/**
* @return int
*/
public function getType(): int {
return $this->type;
}
/**
* @param string $user
*
* @return CalendarShare
*/
public function setUser(string $user): self {
$this->user = $user;
return $this;
}
/**
* @return string
*/
public function getUser(): string {
return $this->user;
}
public function importFromDatabase(array $data): IQueryRow {
$this->setCalendarId($this->getInt('resourceid', $data))
->setSharePrincipalUri($this->get('principaluri', $data));
return $this;
}
public function jsonSerialize(): array {
return [
'id' => $this->getCalendarId(),
'sharePrincipalUri' => $this->getSharePrincipalUri(),
'type' => $this->getType(),
'user' => $this->getUser()
];
}
}
@@ -0,0 +1,149 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class DeckBoard implements IQueryRow, JsonSerializable {
use TArrayTools;
private int $boardId = 0;
private string $boardName = '';
private string $owner = '';
private int $lastModified = 0;
public function __construct() {
}
/**
* @param int $boardId
*
* @return DeckBoard
*/
public function setBoardId(int $boardId): self {
$this->boardId = $boardId;
return $this;
}
/**
* @return int
*/
public function getBoardId(): int {
return $this->boardId;
}
/**
* @param string $boardName
*
* @return DeckBoard
*/
public function setBoardName(string $boardName): self {
$this->boardName = $boardName;
return $this;
}
/**
* @return string
*/
public function getBoardName(): string {
return $this->boardName;
}
/**
* @param string $owner
*
* @return DeckBoard
*/
public function setOwner(string $owner): self {
$this->owner = $owner;
return $this;
}
/**
* @return string
*/
public function getOwner(): string {
return $this->owner;
}
/**
* @param int $lastModified
*
* @return DeckBoard
*/
public function setLastModified(int $lastModified): self {
$this->lastModified = $lastModified;
return $this;
}
/**
* @return int
*/
public function getLastModified(): int {
return $this->lastModified;
}
/**
* @param array $data
*
* @return IQueryRow
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setBoardId($this->getInt('id', $data))
->setBoardName($this->get('title', $data))
->setOwner($this->get('owner', $data))
->setLastModified($this->getInt('last_modified', $data));
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
return [
'boardId' => $this->getBoardId(),
'boardName' => $this->getBoardName(),
'owner' => $this->getOwner(),
'last_modified' => $this->getLastModified()
];
}
}
@@ -0,0 +1,130 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class DeckShare implements IQueryRow, JsonSerializable {
use TArrayTools;
private int $boardId = 0;
private int $recipientType = 0;
private string $recipientId = '';
public function __construct() {
}
/**
* @param int $boardId
*
* @return DeckShare
*/
public function setBoardId(int $boardId): self {
$this->boardId = $boardId;
return $this;
}
/**
* @return int
*/
public function getBoardId(): int {
return $this->boardId;
}
/**
* @param int $recipientType
*
* @return DeckShare
*/
public function setRecipientType(int $recipientType): self {
$this->recipientType = $recipientType;
return $this;
}
/**
* @return int
*/
public function getRecipientType(): int {
return $this->recipientType;
}
/**
* @param string $recipientId
*
* @return DeckShare
*/
public function setRecipientId(string $recipientId): self {
$this->recipientId = $recipientId;
return $this;
}
/**
* @return string
*/
public function getRecipientId(): string {
return $this->recipientId;
}
/**
* @param array $data
*
* @return IQueryRow
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setBoardId($this->getInt('board_id', $data))
->setRecipientType($this->getInt('type', $data))
->setRecipientId($this->get('participant', $data));
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
return [
'boardId' => $this->getBoardId(),
'recipientType' => $this->getRecipientType(),
'recipientId' => $this->getRecipientId()
];
}
}
@@ -0,0 +1,170 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\Circles\Model\FederatedUser;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class FilesShare implements IQueryRow, JsonSerializable {
use TArrayTools;
private string $sharedWith = '';
private int $shareType = 0;
private ?FederatedUser $entity = null;
private int $fileId = 0;
private string $fileTarget = '';
private string $fileOwner = '';
private int $fileLastUpdate = 0;
private int $shareTime = 0;
private string $shareCreator = '';
public function __construct() {
}
public function setSharedWith(string $sharedWith): self {
$this->sharedWith = $sharedWith;
return $this;
}
public function getSharedWith(): string {
return $this->sharedWith;
}
public function setShareType(int $shareType): self {
$this->shareType = $shareType;
return $this;
}
public function getShareType(): int {
return $this->shareType;
}
public function setFileId(int $fileId): self {
$this->fileId = $fileId;
return $this;
}
public function getFileId(): int {
return $this->fileId;
}
public function setEntity(FederatedUser $entity): self {
$this->entity = $entity;
return $this;
}
public function getEntity(): ?FederatedUser {
return $this->entity;
}
public function setFileTarget(string $fileTarget): self {
$this->fileTarget = $fileTarget;
return $this;
}
public function getFileTarget(): string {
return $this->fileTarget;
}
public function setFileOwner(string $fileOwner): self {
$this->fileOwner = $fileOwner;
return $this;
}
public function getFileOwner(): string {
return $this->fileOwner;
}
public function setFileLastUpdate(int $fileLastUpdate): self {
$this->fileLastUpdate = $fileLastUpdate;
return $this;
}
public function getFileLastUpdate(): int {
return $this->fileLastUpdate;
}
public function setShareTime(int $shareTime): self {
$this->shareTime = $shareTime;
return $this;
}
public function getShareTime(): int {
return $this->shareTime;
}
public function setShareCreator(string $shareCreator): self {
$this->shareCreator = $shareCreator;
return $this;
}
public function getShareCreator(): string {
return $this->shareCreator;
}
public function importFromDatabase(array $data): IQueryRow {
$this->setShareType($this->getInt('share_type', $data))
->setSharedWith($this->get('share_with', $data))
->setShareCreator($this->get('uid_initiator', $data))
->setFileId($this->getInt('file_source', $data))
->setFileOwner($this->get('uid_owner', $data))
->setFileTarget($this->get('file_target', $data))
->setShareTime($this->getInt('stime', $data));
return $this;
}
public function jsonSerialize(): array {
return [
'shareType' => $this->getShareType(),
'sharedWith' => $this->getSharedWith(),
'shareCreator' => $this->getShareCreator(),
'fileId' => $this->getFileId(),
'fileTarget' => $this->getFileTarget(),
'fileLastUpdate' => $this->getFileLastUpdate(),
'shareTime' => $this->getShareTime(),
'entity' => $this->getEntity()
];
}
}
@@ -0,0 +1,376 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\IRelatedResource;
use OCA\RelatedResources\Tools\IDeserializable;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
/**
* Class RelatedResource
*
* @package OCA\RelatedResources\Model
*/
class RelatedResource implements IRelatedResource, IDeserializable, JsonSerializable {
use TArrayTools;
public static float $IMPROVE_LOW_LINK = 1.1;
public static float $IMPROVE_MEDIUM_LINK = 1.3;
public static float $IMPROVE_HIGH_LINK = 1.8;
private static float $DIMINISHING_RETURN = 0.6;
public const ITEM_OWNER = 'itemOwner';
public const ITEM_CREATION = 'itemCreation';
public const ITEM_LAST_UPDATE = 'itemLastUpdate';
public const ITEM_KEYWORDS = 'itemKeywords';
public const LINK_CREATOR = 'linkCreator';
public const LINK_CREATION = 'linkCreation';
public const LINK_RECIPIENT = 'linkRecipient';
private string $providerId;
private string $itemId;
private string $title = '';
private string $subtitle = '';
private string $tooltip = '';
private string $icon = '';
private string $preview = '';
private string $url = '';
private int $range = 0;
private array $virtualGroup = [];
private array $recipients = [];
private bool $groupShared = false;
private float $score = 1;
private array $improvements = [];
private array $currentQuality = [];
private array $metas = [];
public function __construct(string $providerId = '', string $itemId = '') {
$this->providerId = $providerId;
$this->itemId = $itemId;
}
public function getProviderId(): string {
return $this->providerId;
}
public function setProviderId(string $providerId): self {
$this->providerId = $providerId;
return $this;
}
public function getItemId(): string {
return $this->itemId;
}
public function setItemId(string $itemId): self {
$this->itemId = $itemId;
return $this;
}
public function setTitle(string $title): IRelatedResource {
$this->title = $title;
return $this;
}
public function getTitle(): string {
return $this->title;
}
public function setSubtitle(string $subtitle): IRelatedResource {
$this->subtitle = $subtitle;
return $this;
}
public function getSubtitle(): string {
return $this->subtitle;
}
public function setTooltip(string $tooltip): self {
$this->tooltip = $tooltip;
return $this;
}
public function getTooltip(): string {
return $this->tooltip;
}
public function setIcon(string $icon): self {
$this->icon = $icon;
return $this;
}
public function getIcon(): string {
return $this->icon;
}
public function setPreview(string $preview): self {
$this->preview = $preview;
return $this;
}
public function getPreview(): string {
return $this->preview;
}
public function setUrl(string $url): IRelatedResource {
$this->url = $url;
return $this;
}
public function getUrl(): string {
return $this->url;
}
public function improve(
float $quality,
string $type,
bool $diminishingReturn = true
): IRelatedResource {
$quality = ($this->currentQuality[$type] ?? $quality);
$this->score = $this->score * $quality;
$this->improvements[] = [
'type' => $type,
'quality' => $quality
];
if ($diminishingReturn) {
$quality = 1 + (($quality - 1) * self::$DIMINISHING_RETURN);
}
$this->currentQuality[$type] = $quality;
return $this;
}
public function getScore(): float {
return $this->score;
}
public function setScore(int $score): self {
$this->score = $score;
return $this;
}
public function setVirtualGroup(array $virtualGroup): self {
$this->virtualGroup = $virtualGroup;
return $this;
}
public function getVirtualGroup(): array {
return $this->virtualGroup;
}
public function addToVirtualGroup(string $singleId): self {
if (!in_array($singleId, $this->virtualGroup)) {
$this->virtualGroup[] = $singleId;
}
return $this;
}
public function mergeVirtualGroup(array $virtualGroup): self {
$this->virtualGroup = array_values(array_unique(array_merge($this->virtualGroup, $virtualGroup)));
return $this;
}
public function setRecipients(array $recipients): self {
$this->recipients = $recipients;
return $this;
}
public function getRecipients(): array {
return $this->recipients;
}
public function addRecipient(string $singleId): self {
if (!in_array($singleId, $this->recipients)) {
$this->recipients[] = $singleId;
}
return $this;
}
public function mergeRecipients(array $recipients): self {
$this->recipients = array_values(array_unique(array_merge($this->recipients, $recipients)));
return $this;
}
public function setAsGroupShared(bool $groupShared = true): self {
$this->groupShared = $groupShared;
return $this;
}
public function isGroupShared(): bool {
return $this->groupShared;
}
public function getImprovements(): array {
return $this->improvements;
}
public function setImprovements(array $improvements): self {
$this->improvements = $improvements;
return $this;
}
public function setCurrentQuality(array $currentQuality): self {
$this->currentQuality = $currentQuality;
return $this;
}
public function getCurrentQuality(): array {
return $this->currentQuality;
}
public function import(array $data): IDeserializable {
$this->setProviderId($this->get('providerId', $data));
$this->setItemId($this->get('itemId', $data));
$this->setTitle($this->get('title', $data));
$this->setSubtitle($this->get('subtitle', $data));
$this->setTooltip($this->get('tooltip', $data));
$this->setIcon($this->get('icon', $data));
$this->setPreview($this->get('preview', $data));
$this->setUrl($this->get('url', $data));
$this->setScore($this->getInt('score', $data));
$this->setAsGroupShared($this->getBool('groupShared', $data));
$this->setRecipients($this->getArray('recipients', $data));
$this->setVirtualGroup($this->getArray('virtualGroup', $data));
$this->setImprovements($this->getArray('improvements', $data));
$this->setCurrentQuality($this->getArray('currentQuality', $data));
$this->setMetas($this->getArray('meta', $data));
return $this;
}
public function jsonSerialize(): array {
return [
'providerId' => $this->getProviderId(),
'itemId' => $this->getItemId(),
'title' => $this->getTitle(),
'subtitle' => $this->getSubtitle(),
'tooltip' => $this->getTooltip(),
'icon' => $this->getIcon(),
'preview' => $this->getPreview(),
'url' => $this->getUrl(),
'score' => $this->getScore(),
'groupShared' => $this->isGroupShared(),
'virtualGroup' => $this->getVirtualGroup(),
'recipients' => $this->getRecipients(),
'improvements' => $this->getImprovements(),
'currentQuality' => $this->getCurrentQuality(),
'meta' => $this->getMetas()
];
}
public static function cleanData(array $arr): array {
static $acceptedKeys = [
'providerId', 'itemId', 'title', 'subtitle', 'tooltip', 'url',
'icon', 'preview', 'score', 'improvements'
];
$new = [];
foreach (array_keys($arr) as $k) {
if (in_array($k, $acceptedKeys)) {
$new[$k] = $arr[$k];
}
}
return $new;
}
public function setMeta(string $k, string $v): IRelatedResource {
$this->metas[$k] = $v;
return $this;
}
public function setMetaInt(string $k, int $v): IRelatedResource {
$this->metas[$k] = $v;
return $this;
}
public function setMetaArray(string $k, array $v): IRelatedResource {
$this->metas[$k] = $v;
return $this;
}
public function setMetas(array $metas): IRelatedResource {
$this->metas = array_merge($this->metas, $metas);
return $this;
}
public function hasMeta(string $k): bool {
return $this->validKey($k, $this->metas);
}
public function getMeta(string $k): string {
return $this->get($k, $this->metas);
}
public function getMetaInt(string $k): int {
return $this->getInt($k, $this->metas);
}
public function getMetaArray(string $k): array {
return $this->getArray($k, $this->metas);
}
public function getMetas(): array {
return $this->metas;
}
}
@@ -0,0 +1,105 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class TalkActor implements IQueryRow, JsonSerializable {
use TArrayTools;
private string $actorType = '';
private string $actorId = '';
public function __construct() {
}
/**
* @param string $actorType
*
* @return TalkActor
*/
public function setActorType(string $actorType): self {
$this->actorType = $actorType;
return $this;
}
/**
* @return string
*/
public function getActorType(): string {
return $this->actorType;
}
/**
* @param string $actorId
*
* @return TalkActor
*/
public function setActorId(string $actorId): self {
$this->actorId = $actorId;
return $this;
}
/**
* @return string
*/
public function getActorId(): string {
return $this->actorId;
}
/**
* @param array $data
*
* @return IQueryRow
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setActorType($this->get('actor_type', $data))
->setActorId($this->get('actor_id', $data));
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
return [
'actorType' => $this->getActorType(),
'actorId' => $this->getActorId()
];
}
}
@@ -0,0 +1,148 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Related Resources
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2022
* @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\RelatedResources\Model;
use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;
class TalkRoom implements IQueryRow, JsonSerializable {
use TArrayTools;
private int $roomId = 0;
private string $roomName = '';
private int $roomType = 0;
private string $token = '';
public function __construct() {
}
/**
* @param int $roomId
*
* @return TalkRoom
*/
public function setRoomId(int $roomId): self {
$this->roomId = $roomId;
return $this;
}
/**
* @return int
*/
public function getRoomId(): int {
return $this->roomId;
}
/**
* @param string $roomName
*
* @return TalkRoom
*/
public function setRoomName(string $roomName): self {
$this->roomName = $roomName;
return $this;
}
/**
* @return string
*/
public function getRoomName(): string {
return $this->roomName;
}
/**
* @param int $roomType
*
* @return TalkRoom
*/
public function setRoomType(int $roomType): self {
$this->roomType = $roomType;
return $this;
}
/**
* @return int
*/
public function getRoomType(): int {
return $this->roomType;
}
/**
* @param string $token
*/
public function setToken(string $token): self {
$this->token = $token;
return $this;
}
/**
* @return string
*/
public function getToken(): string {
return $this->token;
}
/**
* @param array $data
*
* @return IQueryRow
*/
public function importFromDatabase(array $data): IQueryRow {
$this->setRoomId($this->getInt('id', $data))
->setRoomName($this->get('name', $data))
->setRoomType($this->getInt('type', $data))
->setToken($this->get('token', $data));
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
return [
'roomId' => $this->getRoomId(),
'roomName' => $this->getRoomName(),
'roomType' => $this->getRoomType(),
'token' => $this->getToken()
];
}
}