51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#ifndef JOB_HPP
|
|
#define JOB_HPP
|
|
|
|
#include "JobMode.hpp"
|
|
#include "JobState.hpp"
|
|
#include "Payload.hpp"
|
|
#include "Task.hpp"
|
|
|
|
#include "../core/Model.hpp"
|
|
#include "../core/UserInfo.hpp"
|
|
|
|
#include "matador/object/object_ptr.hpp"
|
|
|
|
#include "matador/query/meta_table_macro.hpp"
|
|
|
|
#include "matador/utils/base_class.hpp"
|
|
#include "matador/utils/foreign_attributes.hpp"
|
|
|
|
namespace work::models::jobs {
|
|
|
|
struct Job : core::Model {
|
|
std::string name;
|
|
std::string description;
|
|
JobState state;
|
|
JobMode mode;
|
|
matador::utils::timestamp_type_t created_at;
|
|
matador::object::object_ptr<Payload> payload;
|
|
matador::object::object_ptr<Task> task;
|
|
core::UserInfo user_info;
|
|
|
|
template<typename Operator>
|
|
void process( Operator& op ) {
|
|
namespace field = matador::access;
|
|
field::process( op, *matador::base_class<Model>( this ) );
|
|
field::attribute( op, "name", name, 511 );
|
|
field::attribute( op, "description", description, 511 );
|
|
field::attribute( op, "state", state );
|
|
field::attribute( op, "mode", mode );
|
|
field::attribute( op, "created_at", created_at );
|
|
field::has_one(op, "payload", payload, matador::utils::CascadeAllFetchLazy );
|
|
field::belongs_to( op, "task", task, matador::utils::CascadeAllFetchLazy );
|
|
field::attribute( op, "user_info", user_info );
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
META_TABLE(jobs, JOB, id, version, name, description, state, mode, created_at, payload, task, user_info)
|
|
|
|
#endif //JOB_HPP
|