Added product admin features

This commit is contained in:
Niklas Fondberg
2021-07-26 10:35:52 +02:00
committed by GitHub
parent 32adee1bf4
commit d17df41d86
38 changed files with 1613 additions and 381 deletions
+3 -6
View File
@@ -28,10 +28,9 @@ WHERE product_keyword.product_id = ?
ORDER BY keywords.value
`;
const res = await this.knex
return this.knex
.raw(query, productId)
.then((data) => data.rows.map((row) => this.getType(row)));
return res;
}
async getKeywords(): Promise<Array<Keyword>> {
@@ -40,14 +39,13 @@ SELECT keywords.*, keyword_type.type_id FROM keywords
LEFT JOIN keyword_type ON keyword_type.keyword_id = keywords.id
ORDER BY keywords.value
`;
const res = await this.knex
return this.knex
.raw(query)
.then((data) => data.rows.map((row) => this.getType(row)));
return res;
}
async getKeywordById(id: number): Promise<Keyword> {
const res = await this.knex
return this.knex
.select('*')
.from('keywords')
.leftJoin('keyword_type', 'keyword_type.keyword_id', 'keywords.id')
@@ -55,7 +53,6 @@ ORDER BY keywords.value
.first()
.cache(MINUTE)
.then((row) => this.getType(row));
return res;
}
/**