Remove listprice (#166)

This commit is contained in:
Anders Gustafsson
2024-10-02 12:49:48 +02:00
committed by GitHub
parent 5db5d82d39
commit 3101e04b66
4 changed files with 0 additions and 42 deletions
-19
View File
@@ -245,25 +245,6 @@ export class ProductAPI extends BaseSQLDataSource {
return res.find(Boolean); return res.find(Boolean);
} }
async getListPrice(
printId: number,
marketId: number,
): Promise<Maybe<number>> {
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<Maybe<Product>> { async getProductByPath(path: string): Promise<Maybe<Product>> {
ScopeAccess.validate(this.user).some([ ScopeAccess.validate(this.user).some([
Scopes.PRODUCTS_READ, Scopes.PRODUCTS_READ,
-16
View File
@@ -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 = ?';
}
-6
View File
@@ -108,12 +108,6 @@ const PrintProduct = {
dataSources.printProductDefaultsApi dataSources.printProductDefaultsApi
)).getDefaults(id); )).getDefaults(id);
}, },
async listprice({ id }, input: MarketInput, { dataSources }) {
return (<ProductAPI>dataSources.productApi).getListPrice(
id,
input.marketId,
);
},
}; };
async function getProductsResult( async function getProductsResult(
-1
View File
@@ -351,7 +351,6 @@ type PrintProduct {
updated: DateTime updated: DateTime
interiors: [Interior] interiors: [Interior]
defaults: PrintProductDefaults defaults: PrintProductDefaults
listprice(marketId: Int!): Float!
} }
enum InteriorType { enum InteriorType {