summaryrefslogtreecommitdiff
path: root/sql/functions
diff options
context:
space:
mode:
authorckonstanski <kostcarl@isu.edu>2026-08-18 20:00:23 -0600
committerckonstanski <kostcarl@isu.edu>2026-08-18 20:00:23 -0600
commit26a106b0d9687be8448e37658887c8bc2937804e (patch)
treec13e2b04583802f7e3c407dc9a7c9f945cc15bfb /sql/functions
parentc3b8f1326a874ae08b394020c6279237b0413293 (diff)
notification cleanup and message marking
Diffstat (limited to 'sql/functions')
-rw-r--r--sql/functions/contact.mark_contact_us_post.sql33
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/functions/contact.mark_contact_us_post.sql b/sql/functions/contact.mark_contact_us_post.sql
index 7bcc001..2329f26 100644
--- a/sql/functions/contact.mark_contact_us_post.sql
+++ b/sql/functions/contact.mark_contact_us_post.sql
@@ -36,3 +36,36 @@ begin
end if;
end;
$$ language plpgsql;
+
+
+
+
+do $$declare
+ l_id bigint;
+ p_contact_us_post_id int := 1;
+ p_user_id int := 1;
+ p_read_p bool := 't';
+begin
+ if(p_read_p) then
+ select id into l_id
+ from contact.contact_us_posts_read
+ where contact_us_post_id = p_contact_us_post_id
+ and user_id = p_user_id;
+
+ if(l_id is null) then
+ insert into contact.contact_us_posts_read (
+ contact_us_post_id,
+ user_id
+ ) values (
+ p_contact_us_post_id,
+ p_user_id
+ );
+ end if;
+ else
+ delete from contact.contact_us_posts_read
+ where contact_us_post_id = p_contact_us_post_id
+ and user_id = p_user_id;
+ end if;
+end$$;
+
+