Add arguments
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
PrintProduct,
|
||||
ProductBlacklist,
|
||||
} from './product-types';
|
||||
import { Maybe } from './types';
|
||||
|
||||
const MINUTE = 60;
|
||||
|
||||
@@ -34,17 +35,22 @@ export class ProductAPI extends SQLDataSource {
|
||||
});
|
||||
}
|
||||
|
||||
async getProducts(args: any): Promise<Product> {
|
||||
const query = sql.products(true, true, 10);
|
||||
// console.log(query);
|
||||
const data = await this.knex.raw(query).then((data) => {
|
||||
// console.log(data);
|
||||
return data.rows.map((row) => {
|
||||
async getProducts(
|
||||
limit: Maybe<number>,
|
||||
visible: Maybe<boolean>,
|
||||
browsable: Maybe<boolean>,
|
||||
): Promise<Product> {
|
||||
// console.log(limit, browsable, visible);
|
||||
limit = limit ?? 100;
|
||||
const query = sql.products(limit, visible, browsable);
|
||||
|
||||
const data = await this.knex.raw(query).then((data) =>
|
||||
data.rows.map((row) => {
|
||||
row.blacklisting = this.getBlacklisting(row);
|
||||
row.printProducts = this.getPrintProducts(row);
|
||||
return row;
|
||||
});
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
// console.log(JSON.stringify(data, null, 2));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user