1
0
mirror of synced 2024-11-22 03:46:02 +03:00

fix for /chats request

This commit is contained in:
Pavel 2022-12-22 13:46:12 +03:00
parent 7a92435f9f
commit c931b2622c
4 changed files with 395 additions and 4 deletions

View File

@ -100,7 +100,7 @@ class Chat implements ModelInterface
/**
* @var ChatLastMessage $lastMessage
*
* @Type("ChatLastMessage")
* @Type("RetailCrm\Mg\Bot\Model\Entity\Chat\ChatLastMessage")
* @Accessor(getter="getLastMessage",setter="setLastMessage")
*/
private $lastMessage;

View File

@ -13,6 +13,7 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Chat;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\SkipWhenEmpty;
use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\Entity\Customer;
use RetailCrm\Mg\Bot\Model\ModelInterface;
/**
@ -34,7 +35,7 @@ class ChatLastMessage implements ModelInterface
/**
* @var \DateTime $time
*
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
* @Type("DateTime<'Y-m-d\TH:i:sP'>")
* @Accessor(getter="getTime",setter="setTime")
* @SkipWhenEmpty()
*/
@ -49,6 +50,77 @@ class ChatLastMessage implements ModelInterface
*/
private $type;
/**
* @var string $scope
*
* @Type("string")
* @Accessor(getter="getScope",setter="setScope")
* @SkipWhenEmpty()
*/
private $scope;
/**
* @var int $chatId
*
* @Type("int")
* @Accessor(getter="getChatId",setter="setChatId")
* @SkipWhenEmpty()
*/
private $chatId;
/**
* @var bool $isRead
*
* @Type("bool")
* @Accessor(getter="getIsRead",setter="setIsRead")
* @SkipWhenEmpty()
*/
private $isRead;
/**
* @var bool $isEdit
*
* @Type("bool")
* @Accessor(getter="getIsEdit",setter="setIsEdit")
* @SkipWhenEmpty()
*/
private $isEdit;
/**
* @var string $status
*
* @Type("string")
* @Accessor(getter="getStatus",setter="setStatus")
* @SkipWhenEmpty()
*/
private $status;
/**
* @var Customer $from
*
* @Type("RetailCrm\Mg\Bot\Model\Entity\Customer")
* @Accessor(getter="getFrom",setter="setFrom")
*/
private $from;
/**
* @var string $content
*
* @Type("string")
* @Accessor(getter="getContent",setter="setContent")
* @SkipWhenEmpty()
*/
private $content;
/**
* @var \RetailCrm\Mg\Bot\Model\Entity\Message\MessageQuote $quote
*
* @Type("RetailCrm\Mg\Bot\Model\Entity\Message\MessageQuote")
* @Accessor(getter="getQuote",setter="setQuote")
* @SkipWhenEmpty()
*/
private $quote;
/**
* @return int|null
*/
@ -96,4 +168,132 @@ class ChatLastMessage implements ModelInterface
{
$this->type = $type;
}
/**
* @return mixed
*/
public function getScope()
{
return $this->scope;
}
/**
* @param mixed $scope
*/
public function setScope($scope): void
{
$this->scope = $scope;
}
/**
* @return mixed
*/
public function getChatId()
{
return $this->chatId;
}
/**
* @param mixed $chatId
*/
public function setChatId($chatId): void
{
$this->chatId = $chatId;
}
/**
* @return mixed
*/
public function getIsRead()
{
return $this->isRead;
}
/**
* @param mixed $isRead
*/
public function setIsRead($isRead): void
{
$this->isRead = $isRead;
}
/**
* @return mixed
*/
public function getIsEdit()
{
return $this->isEdit;
}
/**
* @param mixed $isEdit
*/
public function setIsEdit($isEdit): void
{
$this->isEdit = $isEdit;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status): void
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getFrom()
{
return $this->from;
}
/**
* @param mixed $from
*/
public function setFrom($from): void
{
$this->from = $from;
}
/**
* @return mixed
*/
public function getContent()
{
return $this->content;
}
/**
* @param mixed $content
*/
public function setContent($content): void
{
$this->content = $content;
}
/**
* @return mixed
*/
public function getQuote()
{
return $this->quote;
}
/**
* @param mixed $quote
*/
public function setQuote($quote): void
{
$this->quote = $quote;
}
}

View File

@ -0,0 +1,172 @@
<?php
/**
* PHP version 7.3
*
* @category MessageQuote
* @package RetailCrm\Mg\Bot\Model\Entity\Message
*/
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\SkipWhenEmpty;
use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\Entity\User;
/**
* Class MessageQuote
*
* @category MessageQuote
* @package RetailCrm\Mg\Bot\Model\Entity\Message
*/
class MessageQuote
{
/**
* @var int $creating
*
* @Type("int")
* @Accessor(getter="getId",setter="setId")
* @SkipWhenEmpty()
*/
private $id;
/**
* @var string $type
*
* @Type("string")
* @Accessor(getter="getType",setter="setType")
* @SkipWhenEmpty()
*/
private $type;
/**
* @var User $from
*
* @Type("RetailCrm\Mg\Bot\Model\Entity\User")
* @Accessor(getter="getFrom",setter="setFrom")
* @SkipWhenEmpty()
*/
private $from;
/**
* @var \DateTime $time
*
* @Type("DateTime<'Y-m-d\TH:i:sP'>")
* @Accessor(getter="getTime",setter="setTime")
*/
private $time;
/**
* @var string $content
*
* @Type("string")
* @Accessor(getter="getContent",setter="setContent")
*/
private $content;
/**
* @var array $items
*
* @Type("array")
* @Accessor(getter="getItems",setter="setItems")
* @SkipWhenEmpty()
*/
private $items;
/**
* @return string|null
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
*/
public function setId(string $id)
{
$this->id = $id;
}
/**
* @return string|null
*/
public function getType(): ?string
{
return $this->type;
}
/**
* @param string $type
*/
public function setType(string $type)
{
$this->type = $type;
}
/**
* @return User|null
*/
public function getFrom(): ?User
{
return $this->from;
}
/**
* @param User $from
*/
public function setFrom(User $from)
{
$this->from = $from;
}
/**
* @return \DateTime
*/
public function getTime(): ?\DateTime
{
return $this->time;
}
/**
* @param \DateTime $time
*/
public function setTime(\DateTime $time)
{
$this->time = $time;
}
/**
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* @param string $content
*/
public function setContent(string $content): void
{
$this->content = $content;
}
/**
* @return array|null
*/
public function getItems(): ?array
{
return $this->items;
}
/**
* @param array $items
*/
public function setItems(array $items)
{
$this->items = $items;
}
}

View File

@ -108,7 +108,26 @@
"last_name": "Петрович"
},
"author_id": 0,
"last_message": null,
"last_message": {
"id": 1,
"time": "2022-12-21T17:15:54+01:00",
"type": "command",
"scope": "private",
"chat_id": 1053,
"is_read": false,
"is_edit": false,
"status": "received",
"from": {
"id": 2,
"external_id": "12",
"type": "user",
"avatar": null,
"name": "Cuenta Soporte",
"first_name": "Cuenta",
"last_name": "Soporte",
"is_technical_account": true
}
},
"last_activity": "2019-06-13T11:07:14+03:00",
"created_at": "2019-06-11T07:34:16.082957Z",
"updated_at": "2019-06-16T08:10:28.657972Z"