Skip to content

Commit 4e2f0b5

Browse files
authored
Merge pull request #21 from landofcoder/update1.0.2
update1.0.2
2 parents c4891c1 + 8d18fc9 commit 4e2f0b5

File tree

5 files changed

+86
-3
lines changed

5 files changed

+86
-3
lines changed

Model/Resolver/Customer/ReplyMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* version in the future.
1616
*
1717
* @category Landofcoder
18-
* @package Lof_SellerMessageGraphQl
18+
* @package Lof_MarketplaceGraphQl
1919
* @copyright Copyright (c) 2021 Landofcoder (https://www.landofcoder.com/)
2020
* @license https://landofcoder.com/terms
2121
*/

Model/Resolver/MessageDetail.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public function resolve(
7070
$collection = $this->detailCollectionFactory->create()
7171
->addFieldToFilter('message_id', (int)$value['message_id'])
7272
->setPageSize($args['pageSize'])
73-
->setCurPage($args['currentPage']);
73+
->setCurPage($args['currentPage'])
74+
->setOrder('created_at', 'DESC');
7475

7576
$totalPages = $args['pageSize'] ? ((int)ceil($collection->getSize() / $args['pageSize'])) : 0;
7677

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
/**
4+
* Landofcoder
5+
*
6+
* NOTICE OF LICENSE
7+
*
8+
* This source file is subject to the Landofcoder.com license that is
9+
* available through the world-wide-web at this URL:
10+
* https://landofcoder.com/terms
11+
*
12+
* DISCLAIMER
13+
*
14+
* Do not edit or add to this file if you wish to upgrade this extension to newer
15+
* version in the future.
16+
*
17+
* @category Landofcoder
18+
* @package Lof_MarketplaceGraphQl
19+
* @copyright Copyright (c) 2021 Landofcoder (https://www.landofcoder.com/)
20+
* @license https://landofcoder.com/terms
21+
*/
22+
23+
declare(strict_types=1);
24+
25+
namespace Lof\MarketplaceGraphQl\Model\Resolver\Seller;
26+
27+
use Magento\Framework\GraphQl\Config\Element\Field;
28+
use Magento\Framework\GraphQl\Query\ResolverInterface;
29+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
30+
use Lof\MarketPlace\Api\SellerMessageRepositoryInterface;
31+
use Magento\Customer\Model\Session;
32+
33+
34+
class ReplyMessage implements ResolverInterface
35+
{
36+
37+
/**
38+
* @var SellerMessageRepositoryInterface
39+
*/
40+
private $sellerMessageRepository;
41+
42+
/**
43+
* @var Session
44+
*/
45+
protected $customerSession;
46+
47+
/**
48+
* @param SellerMessageRepositoryInterface $sellerMessageRepository
49+
* @param Session $customerSession
50+
*/
51+
52+
public function __construct(
53+
SellerMessageRepositoryInterface $sellerMessageRepository,
54+
Session $customerSession
55+
) {
56+
$this->sellerMessageRepository = $sellerMessageRepository;
57+
$this->customerSession = $customerSession;
58+
}
59+
60+
/**
61+
* @inheritdoc
62+
*/
63+
public function resolve(
64+
Field $field,
65+
$context,
66+
ResolveInfo $info,
67+
array $value = null,
68+
array $args = null
69+
) {
70+
$input = $args['input'];
71+
$customerId = $this->customerSession->getCustomer()->getId();
72+
73+
return $this->sellerMessageRepository->sellerReplyMessage((int) $customerId, $input['message_id'], $input['content'] );
74+
75+
}
76+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"minimum-stability": "dev",
14-
"version": "1.0.1",
14+
"version": "1.0.2",
1515
"require": {
1616
"landofcoder/module-marketplace": "*"
1717
},

etc/schema.graphqls

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ type Mutation {
127127

128128
customerDeleteMessage(message_id: Int!): MarketplaceOuput @resolver(class:"\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\Customer\\DeleteMessage") @doc(description: "Customer delete Messaage by id")
129129

130+
sellerReplyMessage(input: SellerReplyMessageInput!): SellerMessageDetail @resolver(class:"\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\Seller\\ReplyMessage") @doc(description: "Seller reply Messaage")
130131
}
131132

132133
type Customer {
@@ -372,6 +373,11 @@ input AddressInput {
372373
custom_attributes: [CustomerAddressAttributeInput] @doc(description: "Deprecated: Custom attributes should not be put into container.")
373374
}
374375

376+
input SellerReplyMessageInput {
377+
message_id: Int! @doc(description: "Current message_id")
378+
content: String! @doc(description: "Message Content.")
379+
}
380+
375381
input SellerCustomerInput {
376382
seller: SellerInput!
377383
customer: CustomerDataInput!

0 commit comments

Comments
 (0)