Added product admin features
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user