Browse Source

fix(entity): Migrate types to OCP\DB\Types

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/13596/head
Joas Schilling 1 year ago
parent
commit
d5fdbcdf5a
No known key found for this signature in database GPG Key ID: F72FA5B49FFA96B0
  1. 13
      lib/Model/Attachment.php
  2. 49
      lib/Model/Attendee.php
  3. 21
      lib/Model/Ban.php
  4. 7
      lib/Model/BotConversation.php
  5. 21
      lib/Model/BotServer.php
  6. 9
      lib/Model/Consent.php
  7. 21
      lib/Model/Invitation.php
  8. 23
      lib/Model/Poll.php
  9. 29
      lib/Model/ProxyCacheMessage.php
  10. 9
      lib/Model/Reminder.php
  11. 15
      lib/Model/RetryNotification.php
  12. 11
      lib/Model/Session.php
  13. 13
      lib/Model/Vote.php

13
lib/Model/Attachment.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setRoomId(int $roomId)
@ -54,12 +55,12 @@ class Attachment extends Entity {
protected $actorId;
public function __construct() {
$this->addType('roomId', 'int');
$this->addType('messageId', 'int');
$this->addType('messageTime', 'int');
$this->addType('objectType', 'string');
$this->addType('actorType', 'string');
$this->addType('actorId', 'string');
$this->addType('roomId', Types::BIGINT);
$this->addType('messageId', Types::BIGINT);
$this->addType('messageTime', Types::BIGINT);
$this->addType('objectType', Types::STRING);
$this->addType('actorType', Types::STRING);
$this->addType('actorId', Types::STRING);
}
/**

49
lib/Model/Attendee.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setRoomId(int $roomId)
@ -127,30 +128,30 @@ class Attendee extends Entity {
protected int $lastAttendeeActivity = 0;
public function __construct() {
$this->addType('roomId', 'int');
$this->addType('actorType', 'string');
$this->addType('actorId', 'string');
$this->addType('displayName', 'string');
$this->addType('pin', 'string');
$this->addType('participantType', 'int');
$this->addType('favorite', 'bool');
$this->addType('archived', 'bool');
$this->addType('notificationLevel', 'int');
$this->addType('notificationCalls', 'int');
$this->addType('lastJoinedCall', 'int');
$this->addType('lastReadMessage', 'int');
$this->addType('lastMentionMessage', 'int');
$this->addType('lastMentionDirect', 'int');
$this->addType('readPrivacy', 'int');
$this->addType('permissions', 'int');
$this->addType('accessToken', 'string');
$this->addType('remoteId', 'string');
$this->addType('invitedCloudId', 'string');
$this->addType('phoneNumber', 'string');
$this->addType('callId', 'string');
$this->addType('state', 'int');
$this->addType('unreadMessages', 'int');
$this->addType('lastAttendeeActivity', 'int');
$this->addType('roomId', Types::BIGINT);
$this->addType('actorType', Types::STRING);
$this->addType('actorId', Types::STRING);
$this->addType('displayName', Types::STRING);
$this->addType('pin', Types::STRING);
$this->addType('participantType', Types::SMALLINT);
$this->addType('favorite', Types::BOOLEAN);
$this->addType('archived', Types::BOOLEAN);
$this->addType('notificationLevel', Types::INTEGER);
$this->addType('notificationCalls', Types::INTEGER);
$this->addType('lastJoinedCall', Types::INTEGER);
$this->addType('lastReadMessage', Types::INTEGER);
$this->addType('lastMentionMessage', Types::INTEGER);
$this->addType('lastMentionDirect', Types::BIGINT);
$this->addType('readPrivacy', Types::SMALLINT);
$this->addType('permissions', Types::INTEGER);
$this->addType('accessToken', Types::STRING);
$this->addType('remoteId', Types::STRING);
$this->addType('invitedCloudId', Types::STRING);
$this->addType('phoneNumber', Types::STRING);
$this->addType('callId', Types::STRING);
$this->addType('state', Types::SMALLINT);
$this->addType('unreadMessages', Types::BIGINT);
$this->addType('lastAttendeeActivity', Types::BIGINT);
}
public function getDisplayName(): string {

21
lib/Model/Ban.php

@ -10,6 +10,7 @@ namespace OCA\Talk\Model;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @psalm-import-type TalkBan from ResponseDefinitions
@ -49,16 +50,16 @@ class Ban extends Entity implements \JsonSerializable {
protected ?string $internalNote = null;
public function __construct() {
$this->addType('id', 'int');
$this->addType('moderatorActorType', 'string');
$this->addType('moderatorActorId', 'string');
$this->addType('moderatorDisplayname', 'string');
$this->addType('roomId', 'int');
$this->addType('bannedActorType', 'string');
$this->addType('bannedActorId', 'string');
$this->addType('bannedDisplayname', 'string');
$this->addType('bannedTime', 'datetime');
$this->addType('internalNote', 'string');
$this->addType('id', Types::BIGINT);
$this->addType('moderatorActorType', Types::STRING);
$this->addType('moderatorActorId', Types::STRING);
$this->addType('moderatorDisplayname', Types::STRING);
$this->addType('roomId', Types::BIGINT);
$this->addType('bannedActorType', Types::STRING);
$this->addType('bannedActorId', Types::STRING);
$this->addType('bannedDisplayname', Types::STRING);
$this->addType('bannedTime', Types::DATETIME);
$this->addType('internalNote', Types::TEXT);
}
/**

7
lib/Model/BotConversation.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setBotId(int $botId)
@ -24,9 +25,9 @@ class BotConversation extends Entity implements \JsonSerializable {
protected int $state = Bot::STATE_DISABLED;
public function __construct() {
$this->addType('bot_id', 'int');
$this->addType('token', 'string');
$this->addType('state', 'int');
$this->addType('bot_id', Types::BIGINT);
$this->addType('token', Types::STRING);
$this->addType('state', Types::SMALLINT);
}
public function jsonSerialize(): array {

21
lib/Model/BotServer.php

@ -10,6 +10,7 @@ namespace OCA\Talk\Model;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setName(string $name)
@ -48,16 +49,16 @@ class BotServer extends Entity implements \JsonSerializable {
protected int $features = Bot::FEATURE_NONE;
public function __construct() {
$this->addType('name', 'string');
$this->addType('url', 'string');
$this->addType('url_hash', 'string');
$this->addType('description', 'string');
$this->addType('secret', 'string');
$this->addType('error_count', 'int');
$this->addType('last_error_date', 'datetime');
$this->addType('last_error_message', 'string');
$this->addType('state', 'int');
$this->addType('features', 'int');
$this->addType('name', Types::STRING);
$this->addType('url', Types::STRING);
$this->addType('url_hash', Types::STRING);
$this->addType('description', Types::STRING);
$this->addType('secret', Types::STRING);
$this->addType('error_count', Types::BIGINT);
$this->addType('last_error_date', Types::DATETIME);
$this->addType('last_error_message', Types::STRING);
$this->addType('state', Types::SMALLINT);
$this->addType('features', Types::INTEGER);
}
/**

9
lib/Model/Consent.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setToken(string $token)
@ -27,10 +28,10 @@ class Consent extends Entity implements \JsonSerializable {
protected ?\DateTime $dateTime = null;
public function __construct() {
$this->addType('token', 'string');
$this->addType('actorType', 'string');
$this->addType('actorId', 'string');
$this->addType('dateTime', 'datetime');
$this->addType('token', Types::STRING);
$this->addType('actorType', Types::STRING);
$this->addType('actorId', Types::STRING);
$this->addType('dateTime', Types::DATETIME);
}
public function jsonSerialize(): array {

21
lib/Model/Invitation.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setUserId(string $userId)
@ -48,16 +49,16 @@ class Invitation extends Entity implements \JsonSerializable {
protected string $localCloudId = '';
public function __construct() {
$this->addType('userId', 'string');
$this->addType('state', 'int');
$this->addType('localRoomId', 'int');
$this->addType('accessToken', 'string');
$this->addType('remoteServerUrl', 'string');
$this->addType('remoteToken', 'string');
$this->addType('remoteAttendeeId', 'int');
$this->addType('inviterCloudId', 'string');
$this->addType('inviterDisplayName', 'string');
$this->addType('localCloudId', 'string');
$this->addType('userId', Types::STRING);
$this->addType('state', Types::SMALLINT);
$this->addType('localRoomId', Types::BIGINT);
$this->addType('accessToken', Types::STRING);
$this->addType('remoteServerUrl', Types::STRING);
$this->addType('remoteToken', Types::STRING);
$this->addType('remoteAttendeeId', Types::BIGINT);
$this->addType('inviterCloudId', Types::STRING);
$this->addType('inviterDisplayName', Types::STRING);
$this->addType('localCloudId', Types::STRING);
}
/**

23
lib/Model/Poll.php

@ -11,6 +11,7 @@ namespace OCA\Talk\Model;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @psalm-method int<1, max> getId()
@ -70,17 +71,17 @@ class Poll extends Entity {
protected int $maxVotes = self::MAX_VOTES_UNLIMITED;
public function __construct() {
$this->addType('roomId', 'int');
$this->addType('question', 'string');
$this->addType('options', 'string');
$this->addType('votes', 'string');
$this->addType('numVoters', 'int');
$this->addType('actorType', 'string');
$this->addType('actorId', 'string');
$this->addType('displayName', 'string');
$this->addType('status', 'int');
$this->addType('resultMode', 'int');
$this->addType('maxVotes', 'int');
$this->addType('roomId', Types::BIGINT);
$this->addType('question', Types::TEXT);
$this->addType('options', Types::TEXT);
$this->addType('votes', Types::TEXT);
$this->addType('numVoters', Types::BIGINT);
$this->addType('actorType', Types::STRING);
$this->addType('actorId', Types::STRING);
$this->addType('displayName', Types::STRING);
$this->addType('status', Types::SMALLINT);
$this->addType('resultMode', Types::SMALLINT);
$this->addType('maxVotes', Types::INTEGER);
}
/**

29
lib/Model/ProxyCacheMessage.php

@ -11,6 +11,7 @@ namespace OCA\Talk\Model;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setLocalToken(string $localToken)
@ -66,20 +67,20 @@ class ProxyCacheMessage extends Entity implements \JsonSerializable {
protected ?string $metaData = null;
public function __construct() {
$this->addType('localToken', 'string');
$this->addType('remoteServerUrl', 'string');
$this->addType('remoteToken', 'string');
$this->addType('remoteMessageId', 'int');
$this->addType('actorType', 'string');
$this->addType('actorId', 'string');
$this->addType('actorDisplayName', 'string');
$this->addType('messageType', 'string');
$this->addType('systemMessage', 'string');
$this->addType('expirationDatetime', 'datetime');
$this->addType('message', 'string');
$this->addType('messageParameters', 'string');
$this->addType('creationDatetime', 'datetime');
$this->addType('metaData', 'string');
$this->addType('localToken', Types::STRING);
$this->addType('remoteServerUrl', Types::STRING);
$this->addType('remoteToken', Types::STRING);
$this->addType('remoteMessageId', Types::BIGINT);
$this->addType('actorType', Types::STRING);
$this->addType('actorId', Types::STRING);
$this->addType('actorDisplayName', Types::STRING);
$this->addType('messageType', Types::STRING);
$this->addType('systemMessage', Types::STRING);
$this->addType('expirationDatetime', Types::DATETIME);
$this->addType('message', Types::TEXT);
$this->addType('messageParameters', Types::TEXT);
$this->addType('creationDatetime', Types::DATETIME);
$this->addType('metaData', Types::TEXT);
}
public function getParsedMessageParameters(): array {

9
lib/Model/Reminder.php

@ -10,6 +10,7 @@ namespace OCA\Talk\Model;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setUserId(string $userId)
@ -30,10 +31,10 @@ class Reminder extends Entity implements \JsonSerializable {
protected ?\DateTime $dateTime = null;
public function __construct() {
$this->addType('userId', 'string');
$this->addType('token', 'string');
$this->addType('messageId', 'int');
$this->addType('dateTime', 'datetime');
$this->addType('userId', Types::STRING);
$this->addType('token', Types::STRING);
$this->addType('messageId', Types::BIGINT);
$this->addType('dateTime', Types::DATETIME);
}
/**

15
lib/Model/RetryNotification.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setRemoteServer(string $remoteServer)
@ -38,12 +39,12 @@ class RetryNotification extends Entity {
protected string $notification = '';
public function __construct() {
$this->addType('remoteServer', 'string');
$this->addType('numAttempts', 'int');
$this->addType('nextRetry', 'datetime');
$this->addType('notificationType', 'string');
$this->addType('resourceType', 'string');
$this->addType('providerId', 'string');
$this->addType('notification', 'string');
$this->addType('remoteServer', Types::STRING);
$this->addType('numAttempts', Types::INTEGER);
$this->addType('nextRetry', Types::DATETIME);
$this->addType('notificationType', Types::STRING);
$this->addType('resourceType', Types::STRING);
$this->addType('providerId', Types::STRING);
$this->addType('notification', Types::TEXT);
}
}

11
lib/Model/Session.php

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* A session is the "I'm online in this conversation" state of Talk, you get one
@ -49,11 +50,11 @@ class Session extends Entity {
protected $state;
public function __construct() {
$this->addType('attendeeId', 'int');
$this->addType('sessionId', 'string');
$this->addType('inCall', 'int');
$this->addType('lastPing', 'int');
$this->addType('state', 'int');
$this->addType('attendeeId', Types::BIGINT);
$this->addType('sessionId', Types::STRING);
$this->addType('inCall', Types::INTEGER);
$this->addType('lastPing', Types::INTEGER);
$this->addType('state', Types::SMALLINT);
}
/**

13
lib/Model/Vote.php

@ -11,6 +11,7 @@ namespace OCA\Talk\Model;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method void setPollId(int $pollId)
@ -37,12 +38,12 @@ class Vote extends Entity {
protected ?int $optionId = null;
public function __construct() {
$this->addType('pollId', 'int');
$this->addType('roomId', 'int');
$this->addType('actorType', 'string');
$this->addType('actorId', 'string');
$this->addType('displayName', 'string');
$this->addType('optionId', 'int');
$this->addType('pollId', Types::BIGINT);
$this->addType('roomId', Types::BIGINT);
$this->addType('actorType', Types::STRING);
$this->addType('actorId', Types::STRING);
$this->addType('displayName', Types::STRING);
$this->addType('optionId', Types::INTEGER);
}
/**

Loading…
Cancel
Save