From 6ccbaf2245406e1678e7f6ccaa4945e34a98fab5 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Mon, 22 Aug 2022 20:42:41 -0400 Subject: [PATCH] Added create_remark() method --- lib/PostText/Model/Remark.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/PostText/Model/Remark.pm b/lib/PostText/Model/Remark.pm index 6976a74..7f06cfb 100644 --- a/lib/PostText/Model/Remark.pm +++ b/lib/PostText/Model/Remark.pm @@ -33,4 +33,26 @@ sub remarks_per_page($self, $value = undef) { $self->{'remarks_per_page'} = $value // $self->{'remarks_per_page'}; } +sub create_remark( + $self, + $thread_id, + $author, + $body, + $hidden = 0, + $flagged = 0 + ) +{ + $self->pg->db + ->query(<<~'END_SQL', $thread_id, $author, $body, $hidden, $flagged) + INSERT INTO remarks ( + thread_id, + remark_author, + remark_body, + hidden_status, + flagged_status + ) + VALUES (?, ?, ?, ?, ?); + END_SQL +} + 1;