Fix SQL syntax error when using snippets

cshd
Dragory 2020-10-22 00:47:59 +03:00
parent 371c49981c
commit f4ced372ba
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@ const Snippet = require("./Snippet");
*/ */
async function getSnippet(trigger) { async function getSnippet(trigger) {
const snippet = await knex("snippets") const snippet = await knex("snippets")
.where(knex.raw("LOWER(trigger)"), trigger.toLowerCase()) .where(knex.raw("LOWER(`trigger`)"), trigger.toLowerCase())
.first(); .first();
return (snippet ? new Snippet(snippet) : null); return (snippet ? new Snippet(snippet) : null);
@ -36,7 +36,7 @@ async function addSnippet(trigger, body, createdBy = 0) {
*/ */
async function deleteSnippet(trigger) { async function deleteSnippet(trigger) {
return knex("snippets") return knex("snippets")
.where(knex.raw("LOWER(trigger)"), trigger.toLowerCase()) .where(knex.raw("LOWER(`trigger`)"), trigger.toLowerCase())
.delete(); .delete();
} }