aboutsummaryrefslogtreecommitdiffstats
path: root/include/GetEssen.hpp
blob: b53c0284b259944f0c113c3823f0e5913075d442 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once

#include <queue>
#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};
            std::queue<crow::json::wvalue> Message;
            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);

        std::vector<crow::json::wvalue> getEssenOnline(int mensa_ID, boost::posix_time::ptime datumEssen);

        std::vector<crow::json::wvalue> getEssen(int mensa_ID, int offset);

        std::vector<crow::json::wvalue> parseEssen(MensaEssen Essen);

        std::vector<crow::json::wvalue> read_mensa_message_from_file(const int &mensa_id_file);
    }

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