|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
create or replace function public.register_user(_email text, _password_hash text)
|
|
|
|
|
returns setof public.user
|
|
|
|
|
create or replace function sos.register_user(_email text, _password_hash text)
|
|
|
|
|
returns setof "user"
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
declare
|
|
|
|
@ -16,8 +16,8 @@ begin
|
|
|
|
|
return query select * from "user" where user_uuid = _user_uuid;
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.validate_session(_session_uuid uuid)
|
|
|
|
|
returns setof public.v_session
|
|
|
|
|
create or replace function sos.validate_session(_session_uuid uuid)
|
|
|
|
|
returns setof sos.v_session
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
begin
|
|
|
|
@ -26,8 +26,8 @@ begin
|
|
|
|
|
and session_time_last_active + session_timeout_length > now();
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.update_session(_session_uuid uuid)
|
|
|
|
|
returns setof public.v_session
|
|
|
|
|
create or replace function sos.update_session(_session_uuid uuid)
|
|
|
|
|
returns setof sos.v_session
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
begin
|
|
|
|
@ -39,8 +39,8 @@ begin
|
|
|
|
|
return query select * from validate_session(_session_uuid);
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.login_user_session(_user_uuid uuid, _timeout_length interval, _ip_addr varchar(50), _user_agent varchar(500), _referer varchar(500), _link uuid)
|
|
|
|
|
returns setof public.v_session
|
|
|
|
|
create or replace function sos.login_user_session(_user_uuid uuid, _timeout_length interval, _ip_addr varchar(50), _user_agent varchar(500), _referer varchar(500), _link uuid)
|
|
|
|
|
returns setof sos.v_session
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
declare
|
|
|
|
@ -62,11 +62,11 @@ begin
|
|
|
|
|
_link
|
|
|
|
|
) returning session_uuid into _session_uuid;
|
|
|
|
|
|
|
|
|
|
return query select * from public.validate_session(_session_uuid);
|
|
|
|
|
return query select * from sos.validate_session(_session_uuid);
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.create_item(_name text, _urlslug citext, _description text, _price_cents integer, _published boolean)
|
|
|
|
|
returns setof public.v_item
|
|
|
|
|
create or replace function sos.create_item(_name text, _urlslug citext, _description text, _price_cents integer, _published boolean)
|
|
|
|
|
returns setof sos.v_item
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
declare
|
|
|
|
@ -86,11 +86,11 @@ begin
|
|
|
|
|
_published
|
|
|
|
|
) returning item_uuid into _item_uuid;
|
|
|
|
|
|
|
|
|
|
return query select * from public.v_item where item_uuid = _item_uuid;
|
|
|
|
|
return query select * from sos.v_item where item_uuid = _item_uuid;
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.add_image_to_item(_item_uuid uuid, _large_file bytea, _thumb_file bytea, _mime_type varchar, _uploader_uuid uuid)
|
|
|
|
|
returns setof public.v_item
|
|
|
|
|
create or replace function sos.add_image_to_item(_item_uuid uuid, _large_file bytea, _thumb_file bytea, _mime_type varchar, _uploader_uuid uuid)
|
|
|
|
|
returns setof sos.v_item
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
declare
|
|
|
|
@ -110,11 +110,11 @@ begin
|
|
|
|
|
_uploader_uuid
|
|
|
|
|
) returning image_uuid into _image_uuid;
|
|
|
|
|
|
|
|
|
|
return query select * from public.v_item where item_uuid = _item_uuid;
|
|
|
|
|
return query select * from sos.v_item where item_uuid = _item_uuid;
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.set_featured_image(_item_uuid uuid, _image_uuid uuid)
|
|
|
|
|
returns setof public.v_item
|
|
|
|
|
create or replace function sos.set_featured_image(_item_uuid uuid, _image_uuid uuid)
|
|
|
|
|
returns setof sos.v_item
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
begin
|
|
|
|
@ -127,10 +127,10 @@ begin
|
|
|
|
|
image_featured = true
|
|
|
|
|
where image_uuid = _image_uuid;
|
|
|
|
|
|
|
|
|
|
return query select * from public.v_item where item_uuid = _item_uuid;
|
|
|
|
|
return query select * from sos.v_item where item_uuid = _item_uuid;
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.get_image_large(_image_uuid uuid)
|
|
|
|
|
create or replace function sos.get_image_large(_image_uuid uuid)
|
|
|
|
|
returns table (image_uuid uuid, image_mime_type varchar, image_file bytea)
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
@ -143,7 +143,7 @@ begin
|
|
|
|
|
where "image".image_uuid = _image_uuid;
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.get_image_thumb(_image_uuid uuid)
|
|
|
|
|
create or replace function sos.get_image_thumb(_image_uuid uuid)
|
|
|
|
|
returns table (image_uuid uuid, image_mime_type varchar, image_file bytea)
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
@ -156,8 +156,8 @@ begin
|
|
|
|
|
where "image".image_uuid = _image_uuid;
|
|
|
|
|
end; $function$;
|
|
|
|
|
|
|
|
|
|
create or replace function public.create_category(_category_name text, _category_urlslug citext, _category_description text)
|
|
|
|
|
returns setof public.v_category
|
|
|
|
|
create or replace function sos.create_category(_category_name text, _category_urlslug citext, _category_description text)
|
|
|
|
|
returns setof sos.v_category
|
|
|
|
|
language plpgsql
|
|
|
|
|
as $function$
|
|
|
|
|
declare
|
|
|
|
|