<?php

require_once '../../core/api_bootstrap.php';
require_once '../../core/employee_auth.php';

EmployeeAuth::check('manage_ads');

try {

$db = new Database();
$conn = $db->connect();

$stmt = $conn->prepare("

SELECT *
FROM ads
ORDER BY priority DESC,id DESC

");

$stmt->execute();

$ads = $stmt->fetchAll();

Response::success($ads);

}
catch(Exception $e){

Logger::log("system.log",$e->getMessage());

Response::error("Server error",500);

}
