<?php
include_once 'model/posts_model.php';

// Check if the post ID is set
if (isset($_GET['id'])) {
    $postId = $_GET['id'];

    // Instantiate the posts model
    $posts_model = new posts_model();

    // Update the post's status to 'deleted'
    $result = $posts_model->mark_post_as_deleted($postId);

    if ($result) {
        echo json_encode(['success' => true]);
    } else {
        echo json_encode(['success' => false]);
    }
}
?>
