126: upgrade libs for graphql major versions (#127)

* upgraded minor and patch libraries

* upgrade lock file for tests

* 126: upgraded all major versions in package.json

* removed unused import
This commit is contained in:
Arwid Thornström
2022-11-01 12:43:18 +01:00
committed by GitHub
parent 08c6e5718b
commit 72f2e0cb56
7 changed files with 1406 additions and 2523 deletions
+10 -6
View File
@@ -29,6 +29,7 @@ WHERE product_category.product_id = ?
}
async getCategories(): Promise<Array<Category>> {
// @ts-ignore
return this.knex.select('*').from('v_categorytree').cache(MINUTE);
}
@@ -40,12 +41,15 @@ WHERE product_category.product_id = ?
}
async getCategoryById(id: number): Promise<Category> {
return this.knex
.select('*')
.from('v_categorytree')
.where('id', id)
.first()
.cache(MINUTE);
return (
this.knex
.select('*')
.from('v_categorytree')
.where('id', id)
.first()
// @ts-ignore
.cache(MINUTE)
);
}
async getLocaleNameForId(id: number): Promise<JSON> {
+34 -28
View File
@@ -9,19 +9,22 @@ export class DesignerAPI extends BaseSQLDataSource {
}
async getDesignerById(id: number): Promise<Designer> {
return this.knex
.select('*')
.from('designers')
.where('designerid', id)
.first()
.cache(MINUTE)
.then((row) => {
return {
...row,
id: row.designerid,
excludeFromSearch: !row.visibleSearch || !row.visibleDesignerpage,
};
});
return (
this.knex
.select('*')
.from('designers')
.where('designerid', id)
.first()
// @ts-ignore
.cache(MINUTE)
.then((row) => {
return {
...row,
id: row.designerid,
excludeFromSearch: !row.visibleSearch || !row.visibleDesignerpage,
};
})
);
}
async searchDesigners(name: string): Promise<Array<Designer>> {
@@ -42,20 +45,23 @@ export class DesignerAPI extends BaseSQLDataSource {
async getDesigners(limit: Maybe<number>): Promise<Array<Designer>> {
limit = limit ?? 5000;
return this.knex
.select('*')
.from('designers')
.limit(limit)
.orderBy('name')
.cache(MINUTE)
.then((rows) => {
return rows.map((row) => {
return {
...row,
id: row.designerid,
excludeFromSearch: !row.visibleSearch || !row.visibleDesignerpage,
};
});
});
return (
this.knex
.select('*')
.from('designers')
.limit(limit)
.orderBy('name')
// @ts-ignore
.cache(MINUTE)
.then((rows) => {
return rows.map((row) => {
return {
...row,
id: row.designerid,
excludeFromSearch: !row.visibleSearch || !row.visibleDesignerpage,
};
});
})
);
}
}
+11 -8
View File
@@ -48,14 +48,17 @@ ORDER BY keywords.value
}
async getKeywordById(id: number): Promise<Keyword> {
return this.knex
.select('*')
.from('keywords')
.leftJoin('keyword_type', 'keyword_type.keyword_id', 'keywords.id')
.where('id', id)
.first()
.cache(MINUTE)
.then((row) => this.getType(row));
return (
this.knex
.select('*')
.from('keywords')
.leftJoin('keyword_type', 'keyword_type.keyword_id', 'keywords.id')
.where('id', id)
.first()
// @ts-ignore
.cache(MINUTE)
.then((row) => this.getType(row))
);
}
async searchKeywords(name: string): Promise<Array<Keyword>> {
+50 -32
View File
@@ -10,52 +10,70 @@ export class MarketLocaleAPI extends SQLDataSource {
}
async getMarketById(id: number): Promise<Market> {
return this.knex
.select('*')
.from('markets')
.where('id', id)
.first()
.cache(MINUTE * 5);
return (
this.knex
.select('*')
.from('markets')
.where('id', id)
.first()
// @ts-ignore
.cache(MINUTE * 5)
);
}
async getMarketByName(name: string): Promise<Market> {
return this.knex
.select('*')
.from('markets')
.where('name', name)
.first()
.cache(MINUTE * 5);
return (
this.knex
.select('*')
.from('markets')
.where('name', name)
.first()
// @ts-ignore
.cache(MINUTE * 5)
);
}
async getMarkets(): Promise<Array<Market>> {
return this.knex
.select('*')
.from('markets')
.cache(MINUTE * 5);
return (
this.knex
.select('*')
.from('markets')
// @ts-ignore
.cache(MINUTE * 5)
);
}
async getLocaleById(id: number): Promise<Locale> {
return this.knex
.select('*')
.from('locales')
.where('id', id)
.first()
.cache(MINUTE * 5);
return (
this.knex
.select('*')
.from('locales')
.where('id', id)
.first()
// @ts-ignore
.cache(MINUTE * 5)
);
}
async getLocaleByValue(value: string): Promise<Locale> {
return this.knex
.select('*')
.from('locales')
.where('value', value)
.first()
.cache(MINUTE * 5);
return (
this.knex
.select('*')
.from('locales')
.where('value', value)
.first()
// @ts-ignore
.cache(MINUTE * 5)
);
}
async getLocales(): Promise<Array<Locale>> {
return this.knex
.select('*')
.from('locales')
.cache(MINUTE * 5);
return (
this.knex
.select('*')
.from('locales')
// @ts-ignore
.cache(MINUTE * 5)
);
}
}
+13 -7
View File
@@ -14,6 +14,7 @@ export class OrderAPI extends BaseSQLDataSource {
.from('addresses')
.where('id', addressId)
.first()
// @ts-ignore
.cache(MINUTE);
return row
@@ -34,6 +35,7 @@ export class OrderAPI extends BaseSQLDataSource {
.clone()
.count()
.first()
// @ts-ignore
.cache(MINUTE * 5);
return res['count'] as number; // Optimize later to return Promise
}
@@ -44,6 +46,7 @@ export class OrderAPI extends BaseSQLDataSource {
let query = this.getOrdersQuery(input).limit(limit).offset(offset);
query = query.orderBy('inserted', 'ASC');
// @ts-ignore
return query.cache(MINUTE);
}
@@ -73,13 +76,16 @@ export class OrderAPI extends BaseSQLDataSource {
: 'klarna_order_id';
const value = paypalTransactionId ?? klarnaOrderId;
return this.knex
.select('*')
.from('orders')
.where(column, value)
.orderBy('id')
.first()
.cache(MINUTE);
return (
this.knex
.select('*')
.from('orders')
.where(column, value)
.orderBy('id')
.first()
// @ts-ignore
.cache(MINUTE)
);
}
async getOrderRowsByOrderId(orderId: number): Promise<Array<OrderRow>> {