 
 
 
-
 (def product-query-sql
 "SELECT
 now() AS 'updated-at',

 FROM `category_hierarchies`
 GROUP BY 1
 HAVING MAX(`category_hierarchies`.`generations`) = 0
 )
AS `leaves`
ON (`categories`.`id` = `leaves`.`ancestor_id`)
INNER JOIN
(
 SELECT MAX(`stock_statuses`.`product_id`) as `product_id`, SUM(`stock_statuses`.`eod_qty`) as `eod_qty`
 FROM `stock_statuses`
 GROUP BY `stock_statuses`.`product_id`
 )
AS `ss`
ON (`products`.`id` = `ss`.`product_id`)
;
")

(defn clean-product-plus [m]
  (cond-> m

`products`.`product_class_id` AS `product-class-id`,
`categories_products`.`category_id` AS `category-id`,
`categories`.`parent_id` AS `category-parent-id`,
`search_categories`.`category_ids` AS `category-ids`,
`search_categories`.`category_path` AS `category-path`,
`search_service_centers`.`service_center_ids` AS `service-center-ids`,
IFNULL(`products`.`step_title`,`products`.`name`) AS `name`,
IFNULL(`products`.`step_description`,`products`.`long_description`) AS `description`,
`products`.`upc` AS `upc`,
