Add: Edit Count
This commit is contained in:
@@ -15,6 +15,8 @@ function parseCommentFromRow(author, row) {
|
||||
author: author,
|
||||
parentCommentId: row['parent_comment_id'],
|
||||
content: row['latest_content'],
|
||||
edited: row['edit_count'] == 1,
|
||||
editCount: row['edit_count'] - 1,
|
||||
commentDate: row['created_date'],
|
||||
rating: {
|
||||
likes: BigInt(row['likes']),
|
||||
@@ -30,7 +32,7 @@ function parseCommentFromRow(author, row) {
|
||||
*/
|
||||
export async function getCommentsForPost(sql, post_id) {
|
||||
const query = sql`
|
||||
SELECT id, author_id, latest_content, parent_comment_id, created_date, likes, dislikes
|
||||
SELECT id, author_id, latest_content, edit_count, parent_comment_id, created_date, likes, dislikes
|
||||
FROM doki8902.message_comment
|
||||
WHERE post_id = ${ post_id };`;
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ function parsePostFromRow(author, category, row, withMetrics = false) {
|
||||
name: row['name'],
|
||||
category: category,
|
||||
content: row['latest_content'],
|
||||
edited: row['edit_count'] > 1,
|
||||
editCount: row['edit_count'] - 1,
|
||||
postDate: row['created_date'],
|
||||
rating: {
|
||||
likes: BigInt(row['likes']),
|
||||
@@ -66,7 +68,7 @@ export async function getPosts(sql, opts = {}) {
|
||||
const metrics = withMetrics ? sql`, comment_count, user_count, latest_activity, engagement, age, relevancy` : sql``;
|
||||
|
||||
const query = sql`
|
||||
SELECT id, author_id, name, category_id, latest_content, created_date, likes, dislikes ${ metrics }
|
||||
SELECT id, author_id, name, category_id, latest_content, edit_count, created_date, likes, dislikes ${ metrics }
|
||||
FROM doki8902.message_post
|
||||
${ filter }
|
||||
FETCH FIRST ${ limit } ROWS ONLY
|
||||
@@ -105,7 +107,7 @@ export async function getPost(sql, post_id, opts = {}) {
|
||||
const metrics = withMetrics ? sql`, comment_count, user_count, latest_activity, engagement, age, relevancy` : sql``;
|
||||
|
||||
const query = sql`
|
||||
SELECT id, author_id, name, category_id, latest_content, created_date, likes, dislikes ${ metrics }
|
||||
SELECT id, author_id, name, category_id, latest_content, edit_count, created_date, likes, dislikes ${ metrics }
|
||||
FROM doki8902.message_post
|
||||
WHERE id = ${ post_id };`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user