From efd67cd6e68935c6cd60a4adcbe68c8c13b8f0e6 Mon Sep 17 00:00:00 2001 From: Oliver Swienty Date: Fri, 14 Jun 2024 21:09:12 +0200 Subject: [PATCH 1/3] feat: added kitchens & subkitchens to country --- src/api.ts | 8 +++++++- src/config.ts | 2 +- src/models/Country.ts | 13 +++++++++++++ src/models/Restaurant.ts | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/api.ts b/src/api.ts index c18aa2a..27e22cb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -29,7 +29,13 @@ export class Takeaway { async getCountries(): Promise { const data = await this.getClient().getCountries(); - return data.config.countries.map((country: any) => new Country(this, country)); + const kitchens = data.config.kitchens.kitchens.map((kitchen: any) => { + return { + ...kitchen, + subKitchens: kitchen.subKitchens.subKitchens + }; + }); + return data.config.countries.map((country: any) => new Country(this, { ...country, kitchens: kitchens })); } async getCountryById(id: string): Promise { diff --git a/src/config.ts b/src/config.ts index bbebee4..653d702 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,7 +13,7 @@ export class TakeawayConfig { password = '4ndro1d', version = '5.7', systemVersion = '29', - appVersion = '8.29.0', + appVersion = '9999.9999.9999', appName = 'Takeaway.com' } = {}) { this.language = language; diff --git a/src/models/Country.ts b/src/models/Country.ts index 08d2d4b..ccf6b4f 100644 --- a/src/models/Country.ts +++ b/src/models/Country.ts @@ -23,6 +23,18 @@ interface Translations { vi?: string; } +interface Kitchen { + id: string; + descriptions: Translations; + imageUrl: string; + subKitchens: SubKitchen[]; +} + +interface SubKitchen { + id: string; + descriptions: Translations; +} + @Model export class Country extends BaseModel { static relationships = []; @@ -52,6 +64,7 @@ export class Country extends BaseModel { enabledRecurringPayments?: { methods?: string[]; }; + kitchens?: Kitchen[]; autoComplete?: { gp: { id?: string; diff --git a/src/models/Restaurant.ts b/src/models/Restaurant.ts index 177b407..c74750d 100644 --- a/src/models/Restaurant.ts +++ b/src/models/Restaurant.ts @@ -97,10 +97,10 @@ export class Restaurant extends BaseModel { }[]; }; kitchens?: { - ids: string[]; + ids: number[]; }; subKitchens?: { - ids: string[]; + ids: number[]; }; popularDishes?: { ids: string[]; From 7199c8568d7892d22df83dba55ba4f63ab25449c Mon Sep 17 00:00:00 2001 From: Oliver Swienty Date: Fri, 14 Jun 2024 23:00:05 +0200 Subject: [PATCH 2/3] feat: added eta to restaurant --- src/models/Restaurant.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/models/Restaurant.ts b/src/models/Restaurant.ts index c74750d..a4b680c 100644 --- a/src/models/Restaurant.ts +++ b/src/models/Restaurant.ts @@ -63,6 +63,10 @@ export class Restaurant extends BaseModel { }[]; }; estimatedDeliveryTime?: string; + eta?: { + min?: number; + max?: number; + }; polygonStatus?: string; deliveryMethods?: { orderMethods?: string; From 9dcb915c9152a222dd648b16616f12e12b2d4764 Mon Sep 17 00:00:00 2001 From: Oliver Swienty Date: Fri, 14 Jun 2024 23:14:30 +0200 Subject: [PATCH 3/3] feat: added rating to restaurant --- src/models/Restaurant.ts | 1 + src/requests/getRestaurants.ts | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/Restaurant.ts b/src/models/Restaurant.ts index a4b680c..307f281 100644 --- a/src/models/Restaurant.ts +++ b/src/models/Restaurant.ts @@ -123,6 +123,7 @@ export class Restaurant extends BaseModel { information?: string; grade?: number; ratingCount?: number; + rating?: string; logoUrl?: string; headerImageUrl?: string; cacheKey?: string; diff --git a/src/requests/getRestaurants.ts b/src/requests/getRestaurants.ts index 45c5013..3807e0a 100644 --- a/src/requests/getRestaurants.ts +++ b/src/requests/getRestaurants.ts @@ -95,8 +95,7 @@ export default { min: '#min', max: '#max' }, - // Unknown attributes - rvd: 'rvd' + rating: 'rvd' } ], weekday: 'wd',