2019-07-19 09:41:39 +00:00
|
|
|
#pragma once
|
|
|
|
#include <drogon/HttpController.h>
|
|
|
|
using namespace drogon;
|
2019-09-08 21:24:31 +00:00
|
|
|
namespace api::v1
|
2019-07-19 09:41:39 +00:00
|
|
|
{
|
|
|
|
class schedules:public drogon::HttpController<schedules>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
METHOD_LIST_BEGIN
|
2019-09-08 21:24:31 +00:00
|
|
|
METHOD_ADD(schedules::post_new, "/", Post, Options, "filters::json_required", "filters::schedules::valid_json");
|
2020-04-30 09:19:18 +00:00
|
|
|
METHOD_ADD(schedules::post_list, "/list", Post, Options, "filters::json_required");
|
2019-09-08 21:24:31 +00:00
|
|
|
METHOD_ADD(schedules::get_all, "/", Get, Options);
|
|
|
|
METHOD_ADD(schedules::get_one_by_id, "/{1}", Get, Options);
|
|
|
|
METHOD_ADD(schedules::delete_one_by_id, "/{1}", Delete, Options);
|
|
|
|
METHOD_ADD(schedules::put_one_by_id, "/{1}", Put, Options, "filters::json_required", "filters::schedules::valid_json");
|
2020-04-28 19:50:19 +00:00
|
|
|
METHOD_ADD(schedules::get_by_tag, "/tag/{1}", Get, Options);
|
2019-07-22 20:06:13 +00:00
|
|
|
//METHOD_ADD(controllers::get_relays_all,"/{1}/relays",Get);
|
|
|
|
//METHOD_ADD(controllers::get_relays_one,"/{1}/relays/{2}",Get);
|
2019-07-19 09:41:39 +00:00
|
|
|
METHOD_LIST_END
|
|
|
|
|
2019-07-20 12:51:45 +00:00
|
|
|
static void post_new(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
|
2020-04-30 09:19:18 +00:00
|
|
|
static void post_list(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
|
2019-07-20 12:51:45 +00:00
|
|
|
static void get_all(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
|
|
|
|
static void get_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& schedule_id);
|
|
|
|
static void delete_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& schedule_id);
|
|
|
|
static void put_one_by_id(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& schedule_id);
|
2020-04-28 19:50:19 +00:00
|
|
|
static void get_by_tag(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, const std::string& tag);
|
2019-07-19 09:41:39 +00:00
|
|
|
//void get_relays_all(const HttpRequestPtr& req,std::function<void (const HttpResponsePtr &)> &&callback,std::string schedule_id);
|
|
|
|
//void get_relays_one(const HttpRequestPtr& req,std::function<void (const HttpResponsePtr &)> &&callback,std::string schedule_id,std::string relay_id);
|
|
|
|
};
|
|
|
|
}
|