HOTFIX: fixed room2 to room02 (#49)
* HOTFIX: fixed room2 to room02 * typescript
This commit is contained in:
@@ -87,10 +87,18 @@ export class InteriorAPI extends BaseSQLDataSource {
|
||||
const validUris = await this.imageServerApi.getInteriorsForProduct(
|
||||
filter.productId,
|
||||
);
|
||||
|
||||
const addZero = (number: number): string => {
|
||||
if (number < 10) {
|
||||
return `0${number}`;
|
||||
}
|
||||
return `${number}`;
|
||||
};
|
||||
|
||||
return allInteriors.filter((i: Interior) => {
|
||||
const it = i.type.toString().replace('_', '-').toLowerCase();
|
||||
const or = i.orientation.toString().toLocaleLowerCase();
|
||||
const uriMatch = `${or}/${it}/room${i.roomNumber}.`;
|
||||
const uriMatch = `${or}/${it}/room${addZero(i.roomNumber)}.`;
|
||||
const foundUri = validUris.find(({ uri }) => uri.includes(uriMatch));
|
||||
if (foundUri) {
|
||||
i.uri = foundUri.uri;
|
||||
|
||||
Reference in New Issue
Block a user