Simplify interiors api for product (#33)

* Simplify interiors api for product

* removed console

Co-authored-by: Arwid Thornström <arwidt@gmail.com>
This commit is contained in:
Niklas Fondberg
2021-09-07 15:38:03 +02:00
committed by GitHub
co-authored by Arwid Thornström
parent f73cc8be5f
commit 3f5a1b9169
4 changed files with 1 additions and 19 deletions
+1 -9
View File
@@ -11,18 +11,10 @@ export class ImageServerApi extends RESTDataSource {
: 'http://images-dev.photowall.com';
}
willSendRequest(request) {
request.headers.set('X-Photowall', 'pele');
}
async getInteriorsForProduct(
productId: number,
type: InteriorType,
orientation: Orientation,
): Promise<Array<{ uri: string }>> {
const it = type.toString().toLowerCase();
const or = orientation.toString().toLowerCase();
return this.get(`/rooms/${productId}/${or}/${it}/`, null, {
return this.get(`/rooms/${productId}/`, null, {
cacheOptions: { ttl: 5 },
});
}
-3
View File
@@ -51,7 +51,6 @@ export class InteriorAPI extends BaseSQLDataSource {
}
decorateRow(row: any): Interior {
console.log('row', row);
if (row.roomName) {
const parts = row.roomName.split('_');
row.roomNumber = this.getInteriorRoomNumber(parts[0]);
@@ -86,8 +85,6 @@ export class InteriorAPI extends BaseSQLDataSource {
if (filter) {
const validUris = await this.imageServerApi.getInteriorsForProduct(
filter.productId,
filter.type,
filter.orientation,
);
return allInteriors.filter((i: Interior) => {
const it = i.type.toString().toLowerCase();
-5
View File
@@ -64,13 +64,8 @@ type ProductsResult {
items: [Product]
}
"""
Only return valid interiors for product, type and orientation
"""
input InteriorsFilterInput {
productId: Int!
type: InteriorType!
orientation: Orientation!
}
type Market {
-2
View File
@@ -20,8 +20,6 @@ export enum InteriorType {
export interface InteriorsFilter {
productId: number;
type: InteriorType;
orientation: Orientation;
}
export interface InteriorsFilterInput {