Skip to content

Commit

Permalink
fix relationship dto product
Browse files Browse the repository at this point in the history
  • Loading branch information
skript023 committed Apr 18, 2024
1 parent 3d2d281 commit 5187774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/module/product/dto/product.dto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ namespace gaboot
{
for (const auto& res : args)
{
this->push(res.getProduct_images(DATABASE_CLIENT));
id = res.getValueOfId();
name = res.getValueOfName();
description = res.getValueOfDescription();
Expand All @@ -174,6 +175,7 @@ namespace gaboot
template<typename U>
std::enable_if<std::is_same<U, MasterProducts>::value, void>::type operator=(const U& args)
{
this->push(args.getProduct_images(DATABASE_CLIENT));
id = args.getValueOfId();
name = args.getValueOfName();
description = args.getValueOfDescription();
Expand All @@ -192,6 +194,7 @@ namespace gaboot
template<typename U>
std::enable_if<std::is_same<U, MasterProducts*>::value, void>::type operator=(U args)
{
this->push(args->getProduct_images(DATABASE_CLIENT));
id = args->getValueOfId();
name = args->getValueOfName();
description = args->getValueOfDescription();
Expand Down
4 changes: 4 additions & 0 deletions src/module/product/services/product_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ namespace gaboot

const size_t lastPage = (products.size() / (limit + (products.size() % limit))) == 0 ? 0 : 1;

std::ranges::for_each(products.begin(), products.end(), [this](MasterProducts product) {
auto images = product.getProduct_images(DATABASE_CLIENT);
m_response.m_data.push(images);
});
m_response.m_message = "Success retreive products data";
m_response.m_data = products;
m_response.m_success = true;
Expand Down

0 comments on commit 5187774

Please sign in to comment.