|
|
|
@ -56,7 +56,7 @@ create or replace view sos.v_category as
|
|
|
|
|
"child_category".category_name as child_category_name,
|
|
|
|
|
"child_category".category_urlslug as child_category_urlslug,
|
|
|
|
|
"child_category".category_description as child_category_description,
|
|
|
|
|
coalesce("child_item_counts".category_item_count, 0)::int4 as child_category_item_count,
|
|
|
|
|
coalesce("child_item_counts".category_item_count, 0)::int4 as child_category_item_count,
|
|
|
|
|
"parent_category".category_uuid as parent_category_uuid,
|
|
|
|
|
"parent_category".category_name as parent_category_name,
|
|
|
|
|
"parent_category".category_urlslug as parent_category_urlslug,
|
|
|
|
@ -70,7 +70,7 @@ create or replace view sos.v_category as
|
|
|
|
|
category_item_category_uuid as category_uuid,
|
|
|
|
|
count(category_item_item_uuid) as category_item_count
|
|
|
|
|
from sos."category_item"
|
|
|
|
|
group by category_uuid
|
|
|
|
|
group by category_uuid
|
|
|
|
|
) child_item_counts on "child_category".category_uuid = "child_item_counts".category_uuid
|
|
|
|
|
left join sos."category" "parent_category" on "parent_category_link".category_category_parent_uuid = "parent_category".category_uuid
|
|
|
|
|
left join sos."category_item" on "category".category_uuid = "category_item".category_item_category_uuid
|
|
|
|
@ -199,4 +199,13 @@ create or replace view sos.v_user as
|
|
|
|
|
from sos."session"
|
|
|
|
|
where session_cart is not null
|
|
|
|
|
order by session_user_uuid, session_time_last_active desc
|
|
|
|
|
) "last_cart" on "user".user_uuid = "last_cart".session_user_uuid;
|
|
|
|
|
) "last_cart" on "user".user_uuid = "last_cart".session_user_uuid;
|
|
|
|
|
|
|
|
|
|
create or replace view sos.v_order_recipient as
|
|
|
|
|
select distinct on (order_uuid)
|
|
|
|
|
order_uuid,
|
|
|
|
|
payment_recipient_email as order_recipient_email
|
|
|
|
|
from
|
|
|
|
|
sos.v_order
|
|
|
|
|
where payment_time is not null
|
|
|
|
|
order by order_uuid, payment_time desc;
|