1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Change invoice -> entity

This commit is contained in:
David Bomba 2020-08-12 10:41:26 +10:00
parent ee0aa891bb
commit bcd69dadc8
3 changed files with 44 additions and 4 deletions

View File

@ -11,7 +11,7 @@
namespace App\Http\Controllers;
use App\Http\Requests\Activity\DownloadHistoricalInvoiceRequest;
use App\Http\Requests\Activity\DownloadHistoricalEntityRequest;
use App\Models\Activity;
use App\Transformers\ActivityTransformer;
use App\Utils\Traits\Pdf\PdfMaker;
@ -85,7 +85,47 @@ class ActivityController extends BaseController
return $this->listResponse($activities);
}
public function downloadHistoricalInvoice(DownloadHistoricalInvoiceRequest $request, Activity $activity)
/**
* @OA\Get(
* path="/api/v1/actvities/download_entity/{activity_id}",
* operationId="getActivityHistoricalEntityPdf",
* tags={"actvities"},
* summary="Gets a PDF for the given activity",
* description="Gets a PDF for the given activity",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
* name="activity_id",
* in="path",
* description="The Activity Hashed ID",
* example="D2J234DFA",
* required=true,
* @OA\Schema(
* type="string",
* format="string",
* ),
* ),
* @OA\Response(
* response=200,
* description="PDF File",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* ),
* @OA\Response(
* response=404,
* description="No file exists for the given record",
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*
*/
public function downloadHistoricalEntity(DownloadHistoricalEntityRequest $request, Activity $activity)
{
$backup = $activity->backup;

View File

@ -14,7 +14,7 @@ namespace App\Http\Requests\Activity;
use App\Http\Requests\Request;
use App\Models\Activity;
class DownloadHistoricalInvoiceRequest extends Request
class DownloadHistoricalEntityRequest extends Request
{
/**
* Determine if the user is authorized to make this request.

View File

@ -28,7 +28,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
Route::get('activities', 'ActivityController@index');
Route::get('activities/download_invoice/{activity}', 'ActivityController@downloadHistoricalInvoice');
Route::get('activities/download_entity/{activity}', 'ActivityController@downloadHistoricalEntity');
Route::resource('clients', 'ClientController');// name = (clients. index / create / show / update / destroy / edit