Add product search (#64)

This commit is contained in:
Niklas Fondberg
2021-10-11 11:20:48 +02:00
committed by GitHub
parent 8b03ab8246
commit 08149c4a87
10 changed files with 168 additions and 4 deletions
+8
View File
@@ -55,6 +55,14 @@ ORDER BY keywords.value
.then((row) => this.getType(row));
}
async searchKeywords(name: string): Promise<Array<Keyword>> {
return this.knex
.select('*')
.from('keywords')
.leftJoin('keyword_type', 'keyword_type.keyword_id', 'keywords.id')
.whereRaw(`LOWER(value) LIKE ?`, [`${name}`]);
}
async setProductKeywords(
productId: number,
keywordIds: Array<number>,