Add last_remark() method

This commit is contained in:
swagg boi 2022-08-29 10:14:50 -04:00
parent e62c29462f
commit 2331110768

View file

@ -72,4 +72,19 @@ sub get_last_page_by_thread_id($self, $thread_id) {
$last_page;
}
sub last_remark($self, $thread_id) {
my $date_format = $self->{'date_format'};
$self->pg->db->query(<<~'END_SQL', $date_format, $thread_id)->hash();
SELECT remark_id AS id,
TO_CHAR(remark_date, ?) AS date,
remark_author AS author,
remark_body AS body
FROM remarks
WHERE thread_id = ?
ORDER BY remark_date
DESC LIMIT 1;
END_SQL
}
1;