added a bigger real-life demo

This commit is contained in:
Sascha Kühl
2025-06-25 15:57:02 +02:00
parent e72733d37e
commit 4dcbf009da
15 changed files with 500 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#ifndef USER_SESSION_HPP
#define USER_SESSION_HPP
#include "CollectionCenter.hpp"
#include "Scenario.hpp"
#include "User.hpp"
#include "../core/Model.hpp"
#include "../core/Types.hpp"
#include "matador/object/object_ptr.hpp""
#include "matador/utils/base_class.hpp"
namespace work::models::admin {
struct UserSession : core::Model {
matador::object::object_ptr<User> user;
matador::object::object_ptr<Scenario> scenario;
matador::object::object_ptr<CollectionCenter> collection_center;
core::timestamp offline_since;
template<typename Operator>
void process( Operator& op ) {
namespace field = matador::access;
field::process( op, *matador::base_class<Model>( this ) );
field::belongs_to( op, "user", user, matador::utils::default_foreign_attributes );
field::belongs_to( op, "scenario", scenario, matador::utils::default_foreign_attributes );
field::belongs_to( op, "collection_center", collection_center, matador::utils::default_foreign_attributes );
field::attribute( op, "offline_since", offline_since );
}
};
}
#endif //USER_SESSION_HPP