2019-07-12 19:05:56 +00:00
|
|
|
#ifndef EMGAUWA_CORE_SCHEDULE_DBO_H
|
|
|
|
#define EMGAUWA_CORE_SCHEDULE_DBO_H
|
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
#include <string>
|
|
|
|
#include <sqlite3.h>
|
2020-02-23 19:06:14 +00:00
|
|
|
#include <uuid/uuid.h>
|
2019-07-19 09:41:39 +00:00
|
|
|
#include <json/value.h>
|
2019-07-20 22:29:05 +00:00
|
|
|
#include <helpers.h>
|
2019-07-19 09:41:39 +00:00
|
|
|
#include "period.h"
|
|
|
|
#include "period_list.h"
|
2019-07-12 19:05:56 +00:00
|
|
|
|
|
|
|
class schedule_dbo
|
|
|
|
{
|
2019-07-19 09:41:39 +00:00
|
|
|
public:
|
|
|
|
|
2020-04-19 00:44:35 +00:00
|
|
|
int id;
|
|
|
|
uuid_t uid;
|
2019-07-19 09:41:39 +00:00
|
|
|
char name[128];
|
|
|
|
period_list *periods;
|
|
|
|
|
|
|
|
bool
|
|
|
|
update();
|
|
|
|
|
|
|
|
bool
|
|
|
|
insert();
|
|
|
|
|
|
|
|
bool
|
|
|
|
remove();
|
|
|
|
|
2019-07-19 12:42:36 +00:00
|
|
|
~schedule_dbo();
|
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
Json::Value
|
|
|
|
to_json();
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_list(schedule_dbo **schedules_list);
|
|
|
|
|
2019-07-20 21:33:17 +00:00
|
|
|
static schedule_dbo**
|
2020-02-23 19:06:14 +00:00
|
|
|
get_by_simple(const char *key, const void *value, intptr_t bind_func, int bind_func_param);
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2020-04-23 15:00:12 +00:00
|
|
|
static schedule_dbo*
|
2020-04-28 19:50:19 +00:00
|
|
|
get_by_id_or_off(int id);
|
|
|
|
|
|
|
|
static schedule_dbo*
|
|
|
|
get_by_id(int id);
|
2020-04-23 15:00:12 +00:00
|
|
|
|
2019-07-20 22:29:05 +00:00
|
|
|
static schedule_dbo**
|
|
|
|
get_by(helpers::sql_filter_builder **filters);
|
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
static schedule_dbo**
|
|
|
|
get_all();
|
2020-02-23 19:06:14 +00:00
|
|
|
|
|
|
|
static int
|
2020-04-19 00:44:35 +00:00
|
|
|
parse_uid(const char *uid_str, uuid_t result);
|
2020-02-23 19:06:14 +00:00
|
|
|
|
|
|
|
static void
|
2020-04-19 00:44:35 +00:00
|
|
|
unparse_uid(const uuid_t uid, char *result);
|
2019-07-12 19:05:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //EMGAUWA_CORE_SCHEDULE_DBO_H
|