query/test/models/order_details.hpp

31 lines
772 B
C++

#ifndef QUERY_ORDER_DETAILS_HPP
#define QUERY_ORDER_DETAILS_HPP
#include "product.hpp"
#include "matador/object/object_ptr.hpp"
#include "matador/utils/foreign_attributes.hpp"
namespace matador::test {
struct order;
struct order_details
{
unsigned int order_details_id;
matador::object::object_ptr<order> order_;
matador::object::object_ptr<product> product_;
template<class Operator>
void process(Operator &op) {
namespace field = matador::access;
field::primary_key(op, "order_details_id", order_details_id);
field::belongs_to(op, "order_id", order_, utils::default_foreign_attributes);
field::has_one(op, "product_id", product_, utils::default_foreign_attributes);
}
};
}
#endif //QUERY_ORDER_DETAILS_HPP