finished relation completer

This commit is contained in:
Sascha Kühl
2025-07-07 15:50:09 +02:00
parent c974628bee
commit e85543719c
17 changed files with 396 additions and 142 deletions
+2 -1
View File
@@ -4,6 +4,7 @@
#include "../core/Model.hpp"
#include "matador/object/collection.hpp"
#include "matador/object/object_ptr.hpp"
#include "matador/utils/base_class.hpp"
#include "matador/utils/enum_mapper.hpp"
@@ -29,7 +30,7 @@ struct CollectionCenter : core::Model {
std::string name;
matador::utils::blob symbol;
CollectionCenterType type{CollectionCenterType::NoType};
matador::object::collection<User> users;
matador::object::collection<matador::object::object_ptr<User>> users;
template<typename Operator>
void process( Operator& op ) {
+1 -1
View File
@@ -7,7 +7,7 @@
#include "../core/Model.hpp"
#include "matador/object/object_ptr.hpp""
#include "matador/object/object_ptr.hpp"
#include "matador/utils/base_class.hpp"
#include "matador/utils/enum_mapper.hpp"
+1 -1
View File
@@ -42,7 +42,7 @@ struct Scenario : core::Model {
std::string description;
matador::utils::blob symbol;
ScenarioState state{ScenarioState::InvalidState};
matador::object::collection<CollectionCenter> collection_center;
matador::object::collection<matador::object::object_ptr<CollectionCenter>> collection_center;
template<typename Operator>
void process( Operator& op ) {
+1 -1
View File
@@ -6,7 +6,7 @@
#include "../core/Model.hpp"
#include "../core/Types.hpp"
#include "matador/object/object_ptr.hpp""
#include "matador/object/object_ptr.hpp"
#include "matador/utils/base_class.hpp"
#include "matador/utils/types.hpp"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "../core/Model.hpp"
#include "../core/Types.hpp"
#include "matador/object/object_ptr.hpp""
#include "matador/object/object_ptr.hpp"
#include "matador/utils/base_class.hpp"
+3 -1
View File
@@ -5,6 +5,8 @@
#include "matador/object/collection.hpp"
#include "matador/utils/foreign_attributes.hpp"
namespace work::models::jobs {
struct IdListPayload : Payload {
matador::object::collection<unsigned long long> ids;
@@ -12,7 +14,7 @@ struct IdListPayload : Payload {
void process( Operator& op ) {
namespace field = matador::access;
field::process( op, *matador::base_class<Payload>( this ) );
field::has_many( op, "payload_ids", ids );
field::has_many( op, "payload_ids", ids, "payload_id", matador::utils::default_foreign_attributes );
}
};
}
+1 -1
View File
@@ -35,7 +35,7 @@ struct Job : core::Model {
field::attribute( op, "state", state );
field::attribute( op, "mode", mode );
field::attribute( op, "created_at", created_at );
field::belongs_to( op, "payload", payload, matador::utils::default_foreign_attributes );
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 );
}
+4
View File
@@ -6,13 +6,17 @@
#include "matador/utils/base_class.hpp"
namespace work::models::jobs {
struct Job;
struct Payload : core::Model {
std::string type;
matador::object::object_ptr<Job> job;
template<typename Operator>
void process( Operator& op ) {
namespace field = matador::access;
field::process( op, *matador::base_class<Model>( this ) );
field::attribute( op, "type", type, 255 );
field::belongs_to( op, "job", job, matador::utils::default_foreign_attributes );
}
};
}