Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Properly handle when column name is nondefault
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Castle <[email protected]>
  • Loading branch information
Kas-tle committed Apr 21, 2023
1 parent 87c1f25 commit c0d311e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enjinscraper",
"version": "1.0.1",
"version": "1.0.2",
"description": "Scrapes an Enjin site via the Enjin API",
"repository": "https://github.com/Kas-tle/EnjinScraper.git",
"author": "Joshua Castle <[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions src/scrapers/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ function flattenComments(comments: Comment[], commentsDB: CommentsDB[]) {
}
}

async function getColumnCommentCids(database: Database, table: string, coulumn='comment_cid'): Promise<string[]> {
async function getColumnCommentCids(database: Database, table: string, column='comment_cid'): Promise<string[]> {
return new Promise((resolve, reject) => {
const query = `SELECT ${coulumn} FROM ${table} WHERE ${coulumn} IS NOT NULL`;
database.all(query, (err, rows: { comment_cid: string; }[]) => {
const query = `SELECT ${column} FROM ${table} WHERE ${column} IS NOT NULL`;
database.all(query, (err, rows: { [key: string]: string; }[]) => {
if (err) {
reject(err);
} else {
const commentCids = rows.map(row => row.comment_cid);
const commentCids = rows.map(row => row[column]);
resolve(commentCids);
}
});
Expand Down

0 comments on commit c0d311e

Please sign in to comment.