ORE Studio 0.0.4
Loading...
Searching...
No Matches
job_definition.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_SCHEDULER_DOMAIN_JOB_DEFINITION_HPP
21#define ORES_SCHEDULER_DOMAIN_JOB_DEFINITION_HPP
22
23#include <chrono>
24#include <optional>
25#include <string>
26#include <boost/uuid/uuid.hpp>
27#include "ores.scheduler.api/domain/cron_expression.hpp"
28
29namespace ores::scheduler::domain {
30
38struct job_definition final {
42 boost::uuids::uuid id;
43
47 std::optional<boost::uuids::uuid> tenant_id;
48
52 std::optional<boost::uuids::uuid> party_id;
53
57 std::string job_name;
58
62 std::string description;
63
67 std::string command;
68
73
77 std::string action_type = "execute_sql"; // "execute_sql" | "send_mq_message"
78
83 std::string action_payload = "{}";
84
88 bool is_active = false;
89
93 int version = 0;
94
98 std::string modified_by;
99
103 std::string performed_by;
104
111
115 std::string change_commentary;
116
120 std::chrono::system_clock::time_point recorded_at;
121};
122
123}
124
125#endif
Strongly-typed, validated cron expression.
Definition cron_expression.hpp:44
Persistent plan for an in-process scheduled job.
Definition job_definition.hpp:38
std::string modified_by
Username of the person who last modified this job definition.
Definition job_definition.hpp:98
std::string action_type
Type of action to execute on each firing.
Definition job_definition.hpp:77
std::string change_commentary
Free-text commentary explaining the change.
Definition job_definition.hpp:115
std::string description
Human-readable label for UI.
Definition job_definition.hpp:62
bool is_active
False = paused (not scheduled).
Definition job_definition.hpp:88
std::chrono::system_clock::time_point recorded_at
Timestamp when this version of the record was recorded.
Definition job_definition.hpp:120
boost::uuids::uuid id
UUID primary key for the job definition.
Definition job_definition.hpp:42
int version
Version number for optimistic locking and change tracking.
Definition job_definition.hpp:93
cron_expression schedule_expression
Validated cron expression.
Definition job_definition.hpp:72
std::string action_payload
JSON payload for the action. For send_mq_message: {"queue_id":"<uuid>","message_type":"<str>",...
Definition job_definition.hpp:83
std::optional< boost::uuids::uuid > tenant_id
Tenant identifier for multi-tenancy isolation. Null for system jobs.
Definition job_definition.hpp:47
std::string job_name
Unique name for this job.
Definition job_definition.hpp:57
std::string performed_by
Username of the account that performed this action.
Definition job_definition.hpp:103
std::string command
SQL command to execute.
Definition job_definition.hpp:67
std::optional< boost::uuids::uuid > party_id
Party that owns this job definition. Null for system jobs.
Definition job_definition.hpp:52
std::string change_reason_code
Code identifying the reason for the change.
Definition job_definition.hpp:110