aboutsummaryrefslogblamecommitdiffstats
path: root/include/GetEssen.hpp
blob: ff750296a1a5619e8c42bf65bc10765475f7c065 (plain) (tree)














































                                                                                                         
#pragma once

#include <iostream>
#include <sys/stat.h>

#include <curl/curl.h>

#include <boost/date_time/date_formatting.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

#include "Handler.hpp"
#include "Response.hpp"

namespace Handler {
    namespace MensaHandler {
        using std::string;
        using boost::posix_time::ptime;

        struct MensaEssen {
            int ID{191};
            string Message{"nothing got back! There was an error!!"};
            ptime Datum;
            ptime LastModified;
        };

        enum mensa {
            Adlershof = 191, Nord = 147, Sued = 367
        };


        bool db_update_mensa_message(const int &mensaID, const ptime &mensaDatum, const string &message);

        bool db_insert_mensa_message(const int &mensaID, const ptime &mensaDatum, const string &message);

        MensaEssen db_get_mensa_message(const int &mensaID, const ptime &mensaDatum);

        string getEssen(const int mensa_ID, const int offset);

        string read_mensa_message_from_file(const int &mensa_id_file);
    }

    json mensaHandler(std::string const &arguments, std::string const &session, void *payload);
}