<?php
require_once __DIR__ . "/../auth/require-auth.php";
require_once __DIR__ . "/../services/db.php";

$projectId = $_GET["project"];

$sql = "SELECT * FROM custom_fields
        WHERE project_id = ?
        ORDER BY id ASC";
$stmt = sqlsrv_query($conn, $sql, [$projectId]);

$fields = [];
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    $fields[] = $row;
}

echo json_encode($fields);
