File tree Expand file tree Collapse file tree 4 files changed +72
-7
lines changed
Services/Application/Api/Dealing Expand file tree Collapse file tree 4 files changed +72
-7
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,27 @@ public function delete(
136136 }
137137 }
138138
139- public function resume ()
140- {
139+ /**
140+ * @param \App\Infrastructures\Models\DomainDealing $domainDealing
141+ * @param \App\Services\Application\Api\Dealing\ResumeService $resumeService
142+ * @return \Illuminate\Http\JsonResponse
143+ */
144+ public function resume (
145+ \App \Infrastructures \Models \DomainDealing $ domainDealing ,
146+ \App \Services \Application \Api \Dealing \ResumeService $ resumeService
147+ ) {
148+ try {
149+ $ resumeService ->handle ($ domainDealing );
150+
151+ return response ()->json (
152+ $ resumeService ->getResponse (),
153+ Response::HTTP_OK
154+ );
155+ } catch (Exception $ e ) {
156+ return response ()->json (
157+ $ e ->getMessage (),
158+ Response::HTTP_INTERNAL_SERVER_ERROR
159+ );
160+ }
141161 }
142162}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace App \Services \Application \Api \Dealing ;
6+
7+ use App \Http \Resources \DomainDealingResource ;
8+ use Exception ;
9+
10+ final class ResumeService
11+ {
12+ private $ dealingRepository ;
13+
14+ private $ dealing ;
15+
16+ /**
17+ * @param \App\Infrastructures\Repositories\Domain\Dealing\DealingRepositoryInterface $dealingRepository
18+ */
19+ public function __construct (
20+ \App \Infrastructures \Repositories \Domain \Dealing \DealingRepositoryInterface $ dealingRepository
21+ ) {
22+ $ this ->dealingRepository = $ dealingRepository ;
23+ }
24+
25+ /**
26+ * @param \App\Services\Application\InputData\DealingUpdateRequest $dealingUpdateRequest
27+ *
28+ * @return void
29+ */
30+ public function handle (
31+ \App \Infrastructures \Models \DomainDealing $ domainDealing
32+ ): void {
33+ try {
34+ $ domainDealing ->is_halt = false ;
35+ $ this ->dealing = $ this ->dealingRepository ->save ($ domainDealing );
36+ } catch (Exception $ e ) {
37+ throw $ e ;
38+ }
39+ }
40+
41+ /**
42+ * @return \App\Http\Resources\DomainDealingResource
43+ */
44+ public function getResponse (): \App \Http \Resources \DomainDealingResource
45+ {
46+ return new DomainDealingResource ($ this ->dealing );
47+ }
48+ }
Original file line number Diff line number Diff line change 4848 >delete</v-btn
4949 >
5050 <v-btn
51- v-if =" item.is_halt"
51+ v-if =" canUpdate && item.is_halt"
5252 x-small
5353 color =" green"
5454 dark
@@ -187,7 +187,6 @@ export default {
187187 },
188188 resume (dealing ) {
189189 this .dealing = Object .assign ({}, dealing)
190- this .dealing .billing_date = this .$dateHyphen (this .dealing .billing_date )
191190 this .openResumeDialog ()
192191 },
193192 },
Original file line number Diff line number Diff line change @@ -88,9 +88,7 @@ export const actions = {
8888 } ,
8989
9090 async resumeDealing ( { dispatch } , payload ) {
91- const result = await this . $axios . patch ( '/api/dealing/' + payload . id + 'resume' , {
92- ...payload ,
93- } )
91+ const result = await this . $axios . patch ( '/api/dealing/' + payload . id + '/resume' )
9492 dispatch ( 'fetchDealings' )
9593
9694 return result
You can’t perform that action at this time.
0 commit comments