Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce CreateMessage command #11

Merged
merged 7 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/backend-routes/messaging/messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'messages' => RouteConfig::getRouteConfig(
'messages',
[
'POST' => CommandConfig::getPostConfig(Command\Messaging\Message\Create::class),
'by-conversation' => RouteConfig::getRouteConfig(
'by-conversation',
[
Expand Down
18 changes: 18 additions & 0 deletions src/Command/Messaging/Message/Create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Dvsa\Olcs\Transfer\Command\Messaging\Message;

use Dvsa\Olcs\Transfer\Command\AbstractCommand;
use Dvsa\Olcs\Transfer\FieldType\Traits\Messaging\Conversation;
use Dvsa\Olcs\Transfer\FieldType\Traits\Messaging\MessageContent;
use Dvsa\Olcs\Transfer\Util\Annotation as Transfer;

/**
* @Transfer\RouteName("backend/messaging/messages")
* @Transfer\Method("POST")
*/
final class Create extends AbstractCommand
{
use Conversation;
use MessageContent;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Dvsa\Olcs\Transfer\FieldType\Traits;
namespace Dvsa\Olcs\Transfer\FieldType\Traits\Messaging;

/**
* Trait Conversation
Expand Down
22 changes: 22 additions & 0 deletions src/FieldType/Traits/Messaging/MessageContent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Dvsa\Olcs\Transfer\FieldType\Traits\Messaging;

/**
* Trait Conversation
*
* @package Dvsa\Olcs\Transfer\FieldType\Traits
*/
trait MessageContent
{
/**
* @Transfer\Filter("Laminas\Filter\StringTrim")
* @Transfer\Validator("Laminas\Validator\StringLength", options={"max":3000})
*/
protected $messageContent;

public function getMessageContent()
{
return $this->messageContent;
}
}
2 changes: 1 addition & 1 deletion src/Query/Messaging/Messages/ByConversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Dvsa\Olcs\Transfer\Query\Messaging\Messages;

use Dvsa\Olcs\Transfer\FieldType\Traits\Conversation;
use Dvsa\Olcs\Transfer\FieldType\Traits\Messaging\Conversation;
use Dvsa\Olcs\Transfer\Query\PagedQueryInterface;
use Dvsa\Olcs\Transfer\Query\PagedTrait;
use Dvsa\Olcs\Transfer\Query\AbstractQuery;
Expand Down
Loading