#include "../http.hpp"
#include "../tls_server.hpp"
#include "../router.hpp"
#include "../queries/product_list.hpp"

void handle_product(HttpRequest& req, HttpResponse& resp, RouteContext& /*ctx*/) {
    int64_t cursor = std::stoll(req.get_query_param("lastChangedProduct", "0"));
    int limit = std::stoi(req.get_query_param("limit", "20"));
    auto products = get_product_list(cursor, limit);
    resp.send_json(200, products);
}
