feat: tambah endpoint frontend dan field camera di gate
- Tambah endpoint GET /tariffs (list tariffs)
- Tambah endpoint GET /locations/{code} (detail location)
- Tambah endpoint GET /gates/{location_code}/{gate_code} (detail gate)
- Tambah endpoint GET /tariffs/{location_code}/{gate_code}/{category} (detail tariff)
- Tambah endpoint GET /audit-logs (audit trail history)
- Tambah endpoint GET /entry-events (raw entry events)
- Tambah endpoint GET /realtime/events (realtime events list)
- Tambah field camera di gates (support HLS, RTSP, HTTP streaming)
- Migration 004: add camera column to gates table
- Update validasi dan service untuk support camera field
This commit is contained in:
@@ -52,6 +52,45 @@ class LocationController
|
||||
);
|
||||
}
|
||||
|
||||
public function getLocation(
|
||||
ServerRequestInterface $request,
|
||||
ResponseInterface $response,
|
||||
array $args
|
||||
): ResponseInterface {
|
||||
$code = $args['code'] ?? null;
|
||||
if ($code === null || !is_string($code)) {
|
||||
return ResponseHelper::json(
|
||||
$response,
|
||||
[
|
||||
'error' => 'validation_error',
|
||||
'fields' => ['code' => 'Invalid location code']
|
||||
],
|
||||
422
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->writeService->getLocation($code);
|
||||
if ($data === null) {
|
||||
return ResponseHelper::json(
|
||||
$response,
|
||||
[
|
||||
'error' => 'not_found',
|
||||
'message' => 'Location not found'
|
||||
],
|
||||
404
|
||||
);
|
||||
}
|
||||
|
||||
return ResponseHelper::json(
|
||||
$response,
|
||||
[
|
||||
'success' => true,
|
||||
'data' => $data,
|
||||
'timestamp' => time()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function createLocation(
|
||||
ServerRequestInterface $request,
|
||||
ResponseInterface $response
|
||||
|
||||
Reference in New Issue
Block a user