-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fes 63 improve the search api with filter (#103)
* add search logic * add command to allow create function in mysql --------- Co-authored-by: NHT <[email protected]>
- Loading branch information
1 parent
4a52c78
commit 3d79bbf
Showing
5 changed files
with
321 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export enum ResultType { | ||
FOOD = 'FOOD', | ||
RESTAURANT = 'RESTAURANT', | ||
} | ||
export enum SortType { | ||
RELEVANCE = 'RELEVANCE', | ||
PRICE_ASC = 'PRICE_ASC', | ||
PRICE_DESC = 'PRICE_DESC', | ||
} | ||
export enum Filter { | ||
FROM_4STAR = 'FROM_4STAR', | ||
VEG = 'VEG', | ||
UPTO_500KCAL = 'UPTO_500KCAL', | ||
} | ||
|
||
enum IsoLangCode { | ||
VIE = 'vie', | ||
ENG = 'eng', | ||
} | ||
|
||
export class SearchFoodRequest { | ||
keyword: string; //REQUIRED | ||
ISO_language_code: IsoLangCode; //REQUIRED | ||
lat: string; //REQUIRED | ||
long: string; //REQUIRED | ||
result_type: ResultType; //REQUIRED - FOOD | RESTAURANT | ||
sort_type: SortType; //REQUIRED - RELEVANCE | PRICE_ASC | PRICE_DESC | ||
filter: Filter[]; //OPTIONAL - FROM_4STAR | VEG | UPTO_500KCAL | ||
offset: number; //REQUIRED | ||
page_size: number; //REQUIRED | ||
distance_limit_m: number; //OPTIONAL - DEFAULT: 10;000 | ||
base_distance_for_grouping_m: number; //OPTIONAL - DEFAUL: 200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
export class SearchFoodResponse { | ||
results: FoodDTO[] | SrestaurantDTO[]; | ||
keyword: string; | ||
ISO_language_code: string; | ||
lat: string; | ||
long: string; | ||
result_type: string; | ||
sort_type: string; | ||
filter: string[]; | ||
offset: number; | ||
total: number; | ||
distance_limit_m: number; | ||
base_distance_for_grouping_m: number; | ||
} | ||
|
||
export interface FoodDTO { | ||
id: number; | ||
image: string; | ||
top_label: string; | ||
bottom_label: string; | ||
name: TextByLang[]; | ||
restaurant_name: TextByLang[]; | ||
restaurant_id: number; | ||
calorie_kcal: number; | ||
rating: number; | ||
distance_km: number; | ||
delivery_time_s: number; | ||
main_cooking_method: TextByLang[]; | ||
ingredient_brief_vie: string; | ||
ingredient_brief_eng: string; | ||
price: number; | ||
price_after_discount: number; | ||
promotion: string; | ||
preparing_time_s: number; | ||
cooking_time_s: number; | ||
quantity_available: number; | ||
is_vegetarian: boolean; | ||
cooking_schedule: string; | ||
units_sold: number; | ||
is_advanced_customizable: boolean; | ||
} | ||
export interface SrestaurantDTO { | ||
id: number; | ||
intro_video: string; | ||
logo_img: string; | ||
name: TextByLang[]; | ||
rating: number; | ||
distance_km: number; | ||
delivery_time_s: number; | ||
specialty: TextByLang[]; | ||
top_food: string; | ||
promotion: string; | ||
having_vegeterian_food: boolean; | ||
max_price: number; | ||
min_price: number; | ||
unit: string; | ||
is_advanced_customizable: boolean; | ||
food_result: string[]; | ||
} | ||
interface TextByLang { | ||
ISO_language_code: string; | ||
text: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters