Penambahan Fitur Schedule

This commit is contained in:
Ariyutta
2026-11-24 11:42:12 +07:00
parent a0dc32df23
commit d6779af7c6
19 changed files with 332 additions and 154 deletions
+32
View File
@@ -194,6 +194,38 @@ class SiskaService
return false;
}
/**
* Jadwalkan SK di SISKA (POST api/schedule).
*/
public function schedule(int|string $id_sk, bool $schedule = true): bool
{
try {
$response = $this->client->post('api/schedule', [
'headers' => ['Accept' => 'application/json'],
'json' => [
'id' => (int) $id_sk,
'schedule' => $schedule,
],
]);
$data = json_decode($response->getBody()->getContents(), true);
// Berhasil bila HTTP 2xx dan, jika ada, meta.code bernilai 200
return ! isset($data['meta']['code']) || $data['meta']['code'] === 200;
} catch (Throwable $th) {
Log::error('SISKA: '.$th->getMessage());
if ($th instanceof ClientException) {
throw new NotFoundHttpException('SISKA : SK tidak ditemukan');
}
if ($th instanceof ServerException) {
throw new Error('SISKA : Server sedang mengalami gangguan', 500);
}
}
return false;
}
public function pilihRubrik(int $id_anggota, int $kategori_id, ?int $rubrik_id): bool
{
try {