mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:07:32 -05:00 
			
		
		
		
	
							parent
							
								
									712fe3f03a
								
							
						
					
					
						commit
						fa39434ac9
					
				@ -1,5 +1,6 @@
 | 
			
		||||
<?php namespace App\Http\Controllers;
 | 
			
		||||
 | 
			
		||||
use App\Http\Requests\UpdateTaskRequest;
 | 
			
		||||
use Auth;
 | 
			
		||||
use Response;
 | 
			
		||||
use Input;
 | 
			
		||||
@ -84,4 +85,38 @@ class TaskApiController extends BaseAPIController
 | 
			
		||||
        return $this->response($data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @SWG\Put(
 | 
			
		||||
     *   path="/task/{task_id}",
 | 
			
		||||
     *   tags={"task"},
 | 
			
		||||
     *   summary="Update a task",
 | 
			
		||||
     *   @SWG\Parameter(
 | 
			
		||||
     *     in="body",
 | 
			
		||||
     *     name="body",
 | 
			
		||||
     *     @SWG\Schema(ref="#/definitions/Task")
 | 
			
		||||
     *   ),
 | 
			
		||||
     *   @SWG\Response(
 | 
			
		||||
     *     response=200,
 | 
			
		||||
     *     description="Update task",
 | 
			
		||||
     *      @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Task"))
 | 
			
		||||
     *   ),
 | 
			
		||||
     *   @SWG\Response(
 | 
			
		||||
     *     response="default",
 | 
			
		||||
     *     description="an ""unexpected"" error"
 | 
			
		||||
     *   )
 | 
			
		||||
     * )
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public function update(UpdateTaskRequest $request)
 | 
			
		||||
    {
 | 
			
		||||
        $task = $request->entity();
 | 
			
		||||
 | 
			
		||||
        $task = $this->taskRepo->save($task->public_id, \Illuminate\Support\Facades\Input::all());
 | 
			
		||||
 | 
			
		||||
        return $this->itemResponse($task);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,14 @@ class TaskTransformer extends EntityTransformer
 | 
			
		||||
        return array_merge($this->getDefaults($task), [
 | 
			
		||||
            'id' => (int) $task->public_id,
 | 
			
		||||
            'description' => $task->description,
 | 
			
		||||
            'duration' => $task->getDuration()
 | 
			
		||||
            'duration' => $task->getDuration(),
 | 
			
		||||
            'updated_at' => (int) $this->getTimestamp($task->updated_at),
 | 
			
		||||
            'archived_at' => (int) $this->getTimestamp($task->deleted_at),
 | 
			
		||||
            'invoice_id' => (int) $task->invoice->public_id,
 | 
			
		||||
            'client_id' => (int) $task->client->public_id,
 | 
			
		||||
            'is_deleted' => (bool) $task->is_deleted,
 | 
			
		||||
            'time_log' => $task->time_log,
 | 
			
		||||
            'is_running' => (bool) $task->is_running,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user