diff --git a/src/datasources/product-api.ts b/src/datasources/product-api.ts index b1b37d3..e241766 100644 --- a/src/datasources/product-api.ts +++ b/src/datasources/product-api.ts @@ -245,25 +245,6 @@ export class ProductAPI extends BaseSQLDataSource { return res.find(Boolean); } - async getListPrice( - printId: number, - marketId: number, - ): Promise> { - ScopeAccess.validate(this.user).some([ - Scopes.PRODUCTS_READ, - Scopes.PRODUCTS_PUBLIC_READ, - ]); - const query = sql.getProductListPrice(); - try { - const res = await this.knex.raw(query, [marketId, printId]); - return res.rows[0].listprice; - } catch (error) { - throw new GraphQLError('No listprice found', { - extensions: { code: ApolloServerErrorCode.BAD_USER_INPUT }, - }); - } - } - async getProductByPath(path: string): Promise> { ScopeAccess.validate(this.user).some([ Scopes.PRODUCTS_READ, diff --git a/src/datasources/sql/products-sql.ts b/src/datasources/sql/products-sql.ts index 50b7849..1a29950 100644 --- a/src/datasources/sql/products-sql.ts +++ b/src/datasources/sql/products-sql.ts @@ -223,19 +223,3 @@ export function searchByFieldValue(fieldid: number) { ` ); } - -export function getProductListPrice() { - // Temporary solution during partial release of new pricing system. - // Wallpapers read price from new pricing system's listprice view, external products use the old view. - return ` - SELECT CASE - WHEN groupid IN (1,3) THEN new.listprice - ELSE old.listprice - END AS listprice - FROM v_listprices_new new - JOIN "product-printproducts" pp ON new.printproduct_id = printid - JOIN v_listprices old USING (market_id, printproduct_id) - WHERE new.market_id = ? AND new.printproduct_id = ? - `; - // return 'SELECT listprice FROM v_listprices WHERE market_id = ? AND printproduct_id = ?'; -} diff --git a/src/resolvers/products-resolver.ts b/src/resolvers/products-resolver.ts index e61f090..552035b 100644 --- a/src/resolvers/products-resolver.ts +++ b/src/resolvers/products-resolver.ts @@ -108,12 +108,6 @@ const PrintProduct = { dataSources.printProductDefaultsApi )).getDefaults(id); }, - async listprice({ id }, input: MarketInput, { dataSources }) { - return (dataSources.productApi).getListPrice( - id, - input.marketId, - ); - }, }; async function getProductsResult( diff --git a/src/schema.graphql b/src/schema.graphql index b51795c..4bf40c9 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -351,7 +351,6 @@ type PrintProduct { updated: DateTime interiors: [Interior] defaults: PrintProductDefaults - listprice(marketId: Int!): Float! } enum InteriorType {