System logs

This commit is contained in:
David Bomba 2020-08-24 19:51:19 +10:00
parent eef91513d0
commit d7dd544271
4 changed files with 102 additions and 14 deletions

View File

@ -10,7 +10,7 @@
* @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="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

@ -72,7 +72,13 @@ class SystemLogController extends Controller
*/
public function create()
{
//
$error = [
'message' => 'Cannot create system log',
'errors' => new \stdClass
];
return response()->json($error, 400);
}
/**
@ -83,18 +89,72 @@ class SystemLogController extends Controller
*/
public function store(Request $request)
{
//
$error = [
'message' => 'Cannot store system log',
'errors' => new \stdClass
];
return response()->json($error, 400);
}
/**
* Display the specified resource.
*
* @param int $id
* @param \App\Http\Requests\Invoice\ShowInvoiceRequest $request The request
* @param \App\Models\SystemLog $system_logs The system logs
*
* @return \Illuminate\Http\Response
*
*
* @OA\Get(
* path="/api/v1/system_logs/{id}",
* operationId="showSystemLogs",
* tags={"system_logs"},
* summary="Shows a system_logs",
* description="Displays a system_logs by id",
* @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\Parameter(
* name="id",
* in="path",
* description="The system_logs Hashed ID",
* example="D2J234DFA",
* required=true,
* @OA\Schema(
* type="string",
* format="string",
* ),
* ),
* @OA\Response(
* response=200,
* description="Returns the system_logs object",
* @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 show($id)
public function show(Request $request, SystemLog $system_log)
{
//
return $this->itemResponse($system_log);
}
/**
@ -105,7 +165,13 @@ class SystemLogController extends Controller
*/
public function edit($id)
{
//
$error = [
'message' => 'Cannot edit system log',
'errors' => new \stdClass
];
return response()->json($error, 400);
}
/**
@ -117,7 +183,13 @@ class SystemLogController extends Controller
*/
public function update(Request $request, $id)
{
//
$error = [
'message' => 'Cannot update system log',
'errors' => new \stdClass
];
return response()->json($error, 400);
}
/**
@ -128,6 +200,12 @@ class SystemLogController extends Controller
*/
public function destroy($id)
{
//
$error = [
'message' => 'Cannot destroy system log',
'errors' => new \stdClass
];
return response()->json($error, 400);
}
}

View File

@ -54,4 +54,14 @@ class SystemLog extends Model
protected $casts = [
'log' => 'array'
];
public function resolveRouteBinding($value)
{
if (is_numeric($value)) {
throw new ModelNotFoundException("Record with value {$value} not found");
}
return $this
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
}
}

View File

@ -481,7 +481,7 @@ class CreateUsersTable extends Migration
$t->boolean('custom_surcharge_tax3')->default(false);
$t->boolean('custom_surcharge_tax4')->default(false);
$t->decimal('exchange_rate', 16, 4);
$t->decimal('exchange_rate', 13, 6)->default(1);
$t->decimal('amount', 16, 4);
$t->decimal('balance', 16, 4);
$t->decimal('partial', 16, 4)->nullable();
@ -559,7 +559,7 @@ class CreateUsersTable extends Migration
$t->boolean('custom_surcharge_tax3')->default(false);
$t->boolean('custom_surcharge_tax4')->default(false);
$t->decimal('exchange_rate', 16, 4);
$t->decimal('exchange_rate', 13, 6)->default(1);
$t->decimal('amount', 16, 4);
$t->decimal('balance', 16, 4);
$t->decimal('partial', 16, 4)->nullable();
@ -803,7 +803,7 @@ class CreateUsersTable extends Migration
$t->boolean('custom_surcharge_tax3')->default(false);
$t->boolean('custom_surcharge_tax4')->default(false);
$t->decimal('exchange_rate', 16, 4);
$t->decimal('exchange_rate', 13, 6)->default(1);
$t->decimal('amount', 16, 4);
$t->decimal('balance', 16, 4);
$t->decimal('partial', 16, 4)->nullable();
@ -964,7 +964,7 @@ class CreateUsersTable extends Migration
$t->softDeletes('deleted_at', 6);
$t->boolean('is_deleted')->default(false);
$t->boolean('is_manual')->default(false);
$t->decimal('exchange_rate', 16, 6)->default(1);
$t->decimal('exchange_rate', 13, 6)->default(1);
$t->unsignedInteger('currency_id');
$t->unsignedInteger('exchange_currency_id');
@ -1297,7 +1297,7 @@ class CreateUsersTable extends Migration
$table->boolean('is_deleted')->default(false);
$table->decimal('amount', 13, 2);
$table->decimal('foreign_amount', 13, 2);
$table->decimal('exchange_rate', 13, 4);
$table->decimal('exchange_rate', 13, 6)->default(1);
$table->string('tax_name1')->nullable();
$table->decimal('tax_rate1', 13, 3)->default(0);
$table->string('tax_name2')->nullable();