Stabilize legacy Steven API endpoints and add OpenAPI spec

This commit is contained in:
Power BI Dev
2026-05-07 14:50:31 +07:00
parent f1c1f42a4c
commit e7b07a3cfd
17 changed files with 2755 additions and 0 deletions

57
steven/API/getListKK.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
include '../conf/class.server.php';
include '../conf/koneksiPDO.php';
include '../conf/function.php';
header('Content-Type: application/json');
$server = new Server();
$conn = new createCon();
$dbh = $conn->connect();
checkKey('GET', 'secret');
requireRobotSecret();
$sql = 'SELECT * FROM tb_kelompok_keahlian LEFT JOIN tbdosen ON tb_kelompok_keahlian.ketuaKK = tbdosen.iddosen';
$stmt = $dbh->prepare($sql);
$stmt->execute();
$data = [];
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$idKK = $row['idKK'];
$listAnggotaKK = [];
array_push($listAnggotaKK, [
'status' => 'ketua',
'id' => $row['iddosen'],
'nama' => $row['nmLengkap'],
]);
$sql = 'SELECT * FROM tbdosen WHERE kelompokKeahlian = :kk';
$stmt1 = $dbh->prepare($sql);
$stmt1->bindParam(':kk', $idKK);
$stmt1->execute();
while ($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)) {
if ($row1['iddosen'] == $row['iddosen']) {
continue;
}
array_push($listAnggotaKK, [
'status' => 'anggota',
'id' => $row1['iddosen'],
'nama' => $row1['nmLengkap'],
]);
}
array_push($data, [
'id' => $row['idKK'],
'nama' => $row['namaKK'],
'anggotaKK' => $listAnggotaKK,
]);
}
echo json_encode(utf8ize(['status' => 1, 'data' => $data]));