diff --git a/lib/Model/Attachment.php b/lib/Model/Attachment.php index c4d98595924..2a0977c76ca 100644 --- a/lib/Model/Attachment.php +++ b/lib/Model/Attachment.php @@ -9,6 +9,7 @@ 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); } /** diff --git a/lib/Model/Attendee.php b/lib/Model/Attendee.php index 74527b32632..02ce13bcae2 100644 --- a/lib/Model/Attendee.php +++ b/lib/Model/Attendee.php @@ -9,6 +9,7 @@ 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 { diff --git a/lib/Model/Ban.php b/lib/Model/Ban.php index 6feaa19cb02..0159aa891be 100644 --- a/lib/Model/Ban.php +++ b/lib/Model/Ban.php @@ -10,6 +10,7 @@ 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); } /** diff --git a/lib/Model/BotConversation.php b/lib/Model/BotConversation.php index 958173f9155..83e34ef8266 100644 --- a/lib/Model/BotConversation.php +++ b/lib/Model/BotConversation.php @@ -9,6 +9,7 @@ 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 { diff --git a/lib/Model/BotServer.php b/lib/Model/BotServer.php index dd57fa6512e..1bebf557c93 100644 --- a/lib/Model/BotServer.php +++ b/lib/Model/BotServer.php @@ -10,6 +10,7 @@ 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); } /** diff --git a/lib/Model/Consent.php b/lib/Model/Consent.php index 26009a2e6e4..16ce6c3a48b 100644 --- a/lib/Model/Consent.php +++ b/lib/Model/Consent.php @@ -9,6 +9,7 @@ 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 { diff --git a/lib/Model/Invitation.php b/lib/Model/Invitation.php index 77456b25537..07534720ec3 100644 --- a/lib/Model/Invitation.php +++ b/lib/Model/Invitation.php @@ -9,6 +9,7 @@ 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); } /** diff --git a/lib/Model/Poll.php b/lib/Model/Poll.php index d53c0b05d45..7a1cc8f4a96 100644 --- a/lib/Model/Poll.php +++ b/lib/Model/Poll.php @@ -11,6 +11,7 @@ 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); } /** diff --git a/lib/Model/ProxyCacheMessage.php b/lib/Model/ProxyCacheMessage.php index 2fd58ee665a..42683a6c1cb 100644 --- a/lib/Model/ProxyCacheMessage.php +++ b/lib/Model/ProxyCacheMessage.php @@ -11,6 +11,7 @@ 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 { diff --git a/lib/Model/Reminder.php b/lib/Model/Reminder.php index f910446316d..25326cff5c9 100644 --- a/lib/Model/Reminder.php +++ b/lib/Model/Reminder.php @@ -10,6 +10,7 @@ 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); } /** diff --git a/lib/Model/RetryNotification.php b/lib/Model/RetryNotification.php index a80b216826b..2e2eab008fd 100644 --- a/lib/Model/RetryNotification.php +++ b/lib/Model/RetryNotification.php @@ -9,6 +9,7 @@ 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); } } diff --git a/lib/Model/Session.php b/lib/Model/Session.php index f5eb517363a..4a7a66b146a 100644 --- a/lib/Model/Session.php +++ b/lib/Model/Session.php @@ -9,6 +9,7 @@ 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); } /** diff --git a/lib/Model/Vote.php b/lib/Model/Vote.php index 87f0dbdaefd..7398d68dbdd 100644 --- a/lib/Model/Vote.php +++ b/lib/Model/Vote.php @@ -11,6 +11,7 @@ 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); } /**