47 lines
1.3 KiB
C++
47 lines
1.3 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/Types.hpp"
|
|
#include "../core/UserInfo.hpp"
|
|
|
|
#include "matador/object/object_ptr.hpp"
|
|
|
|
#include "matador/utils/base_class.hpp"
|
|
|
|
namespace work::models::jobs {
|
|
|
|
struct Job : core::Model {
|
|
std::string name;
|
|
std::string description;
|
|
JobState state;
|
|
JobMode mode;
|
|
core::timestamp 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::default_foreign_attributes );
|
|
field::belongs_to( op, "task", task, matador::utils::default_foreign_attributes );
|
|
field::attribute( op, "user_info", user_info );
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif //JOB_HPP
|