System Logs

This commit is contained in:
David Bomba 2020-08-24 15:08:49 +10:00
parent ffdfaefd80
commit 66499a9a31
4 changed files with 64 additions and 2 deletions

View File

@ -38,6 +38,11 @@ class SystemLogFilters extends QueryFilters
return $this->builder->where('event_id', $event_id);
}
public function client_id(int $client_id) :Builder
{
return $this->builder->where('client_id', $client_id);
}
/**
* Filter based on search text
*

View File

@ -0,0 +1,17 @@
<?php
/**
* @OA\Schema(
* schema="SystemLog",
* type="object",
* @OA\Property(property="id", type="string", example="AS3df3A", description="The account hashed id"),
* @OA\Property(property="company_id", type="string", example="AS3df3A", description="The company hashed id"),
* @OA\Property(property="user_id", type="string", example="AS3df3A", description="The user_id hashed id"),
* @OA\Property(property="client_id", type="string", example="AS3df3A", description="The client_id hashed id"),
* @OA\Property(property="event_id", type="int", example="1", description="The Log Type ID"),
* @OA\Property(property="category_id", type="int", example="1", description="The Category Type ID"),
* @OA\Property(property="type_id", type="int", example="1", description="The Type Type ID"),
* @OA\Property(property="log", type="object", example="{"key":"value"}", description="The json object of the error"),
* @OA\Property(property="updated_at", type="string", example="2", description="______"),
* @OA\Property(property="created_at", type="string", example="2", description="______"),
* )
*/

View File

@ -18,13 +18,51 @@ class SystemLogController extends Controller
protected $entity_transformer = SystemLogTransformer::class;
/**
* Display a listing of the resource.
* Show the list of Invoices
*
* @param \App\Filters\InvoiceFilters $filters The filters
*
* @return \Illuminate\Http\Response
*
* @OA\Get(
* path="/api/v1/system_logs",
* operationId="getSystemLogs",
* tags={"system_logs"},
* summary="Gets a list of system logs",
* description="Lists system logs, search and filters allow fine grained lists to be generated.
*
* Query parameters can be added to performed more fine grained filtering of the system logs, these are handled by the SystemLogFilters class which defines the methods available",
* @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(ref="#/components/parameters/include"),
* @OA\Response(
* response=200,
* description="A list of system logs",
* @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\JsonContent(ref="#/components/schemas/SystemLog"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*
*/
public function index(SystemLogFilters $filters)
{
//
$system_logs = SystemLog::filter($filters);
return $this->listResponse($system_logs);
}
/**

View File

@ -146,6 +146,8 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
// Route::delete('hooks/{subscription_id}', 'SubscriptionController@unsubscribe')->name('hooks.unsubscribe');
Route::resource('webhooks', 'WebhookController');
Route::resource('system_logs', 'SystemLogController');
Route::post('webhooks/bulk', 'WebhookController@bulk')->name('webhooks.bulk');
/*Company Ledger */