#ifndef LIBREPOMGR_ROUTE_IDS_H #define LIBREPOMGR_ROUTE_IDS_H #include "../authentication.h" #include "./typedefs.h" #include #include namespace LibRepoMgr { namespace WebAPI { struct RouteId { boost::beast::http::verb method; std::string path; bool operator==(const RouteId &other) const; }; inline bool RouteId::operator==(const RouteId &other) const { return method == other.method && path == other.path; } struct Route { RouteHandler handler; UserPermissions permissions = UserPermissions::None; }; using Router = std::unordered_map; } // namespace WebAPI } // namespace LibRepoMgr namespace std { template <> struct hash { std::size_t operator()(const LibRepoMgr::WebAPI::RouteId &id) const { using VerbType = typename std::underlying_type::type; return std::hash()(static_cast(id.method)) ^ (std::hash()(id.path) << 1); } }; } // namespace std #endif // LIBREPOMGR_ROUTE_IDS_H