adrienshen / eggroll-pos

Modern POS for Quick-Serve Restaurants in Typescript and React
https://eggrollpos.com
5 stars 8 forks source link

Geolocation and store data #12

Closed adrienshen closed 4 years ago

adrienshen commented 4 years ago

We can discuss more here.

adrienshen commented 4 years ago

Is Zomato available is Singapore? Because, we might want to limit the geographical area to Singapore when we pilot with a few Merchants.

KHvic commented 4 years ago

Yes, it is available in singapore. However to get the initial location of user, we might need facebook developer api and webhook from messenger. Is anyone working on this part?

johnbenedictyan commented 4 years ago

I'm not sure who is working on the messenger webhook.

adrienshen commented 4 years ago

@KHvic I'm working on the webhook entry point and should be ready in a couple days.

Are you able to mock the user's location? As long as the data type is correct, the backend should be independent from client right? You can test using a standard CURL request or express route.

I would start with creating a geolocation service or Zomato service if you're using that in /src/server/services

Actually, we have a model for merchants here:

  return knex.schema.createTable('merchants', t => {
    t.increments('id')
    t.string('business_name')
    t.string('postal_code')
    t.string('address')
    t.string('description')
    t.string('type') // cafe/burgers/asian/chinese/ect..
    t.timestamp('created_at').defaultTo(knex.fn.now())
  })

Will want to sign up our own merchants into the system, so would be nice to find out a way to integrate with external APIs, but still maintain our own database, if that makes sense. Because, for Merchants to take orders, they need to agree to be part of our system and be added to our database first.

I pushed an empty method: getNearbyShops in actions.js, maybe you can fill that in with your business logic. You'll need to figure out what params it'll receive as well as the returning data format.

Let me know if any questions.

KHvic commented 4 years ago

@KHvic I'm working on the webhook entry point and should be ready in a couple days.

Are you able to mock the user's location? As long as the data type is correct, the backend should be independent from client right? You can test using a standard CURL request or express route.

I would start with creating a geolocation service or Zomato service if you're using that in /src/server/services

Actually, we have a model for merchants here:

  return knex.schema.createTable('merchants', t => {
    t.increments('id')
    t.string('business_name')
    t.string('postal_code')
    t.string('address')
    t.string('description')
    t.string('type') // cafe/burgers/asian/chinese/ect..
    t.timestamp('created_at').defaultTo(knex.fn.now())
  })

Will want to sign up our own merchants into the system, so would be nice to find out a way to integrate with external APIs, but still maintain our own database, if that makes sense. Because, for Merchants to take orders, they need to agree to be part of our system and be added to our database first.

I pushed an empty method: getNearbyShops in actions.js, maybe you can fill that in with your business logic. You'll need to figure out what params it'll receive as well as the returning data format.

Let me know if any questions.

Cool, you just have to pass the long & latitude into this function & I am will return you a list of nearby restaurant

I can work on the sync, but this will also complicate the merchant signup process. I would need the merchant to supply their zomato restaurant id and persist that in db for filtering. (but I believe this signup process is like they fill up a form & we contact them for collaboration right? So this id could be hidden for now)

Also would like to keep in mind I only proposed the usage of zomato API because this is a hackathon and we are limited in time. I am open to using other approaches like hardcoding merchant location in our db. WDYT?

Also another question: Once the chatbot displays the list of nearby merchants, how do they actually order some food? The presentation slide isn't too clear on this. How do we get the list of menus, is this maintained in our db?

KHvic commented 4 years ago
    {
      "restaurant": {
        "R": {
          "has_menu_status": {
            "delivery": -1,
            "takeaway": -1
          },
          "res_id": 18485058
        },
        "apikey": "118f64801e68a449194b12893964eba7",
        "id": "18485058",
        "name": "KFC",
        "url": "https://www.zomato.com/singapore/kfc-choa-chu-kang?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1",
        "location": {
          "address": "21 Choa Chu Kang North 6, #01-19/20 Yew Tee Point 689578",
          "locality": "Yew Tee Point, Choa Chu Kang",
          "city": "Singapore",
          "city_id": 52,
          "latitude": "1.3968048061",
          "longitude": "103.7466213190",
          "zipcode": "689578",
          "country_id": 184,
          "locality_verbose": "Yew Tee Point, Choa Chu Kang, Singapore"
        },
        "switch_to_order_menu": 0,
        "cuisines": "Fast Food",
        "average_cost_for_two": 25,
        "price_range": 2,
        "currency": "$",
        "offers": [],
        "opentable_support": 0,
        "is_zomato_book_res": 0,
        "mezzo_provider": "OTHER",
        "is_book_form_web_view": 0,
        "book_form_web_view_url": "",
        "book_again_url": "",
        "thumb": "",
        "user_rating": {
          "aggregate_rating": "3.6",
          "rating_text": "Good",
          "rating_color": "9ACD32",
          "rating_obj": {
            "title": {
              "text": "3.6"
            },
            "bg_color": {
              "type": "lime",
              "tint": "600"
            }
          },
          "votes": "8"
        },
        "photos_url": "https://www.zomato.com/singapore/kfc-choa-chu-kang/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop",
        "menu_url": "https://www.zomato.com/singapore/kfc-choa-chu-kang/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop",
        "featured_image": "",
        "has_online_delivery": 0,
        "is_delivering_now": 0,
        "include_bogo_offers": true,
        "deeplink": "zomato://restaurant/18485058",
        "is_table_reservation_supported": 0,
        "has_table_booking": 0,
        "events_url": "https://www.zomato.com/singapore/kfc-choa-chu-kang/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"
      }
    }

Example of a zomato response regarding a restaurant, is there anything else we could use? like review etc.

adrienshen commented 4 years ago

How does the Menu data from Zomato look like?

Yeah, will need to think about how to integrate this data with our data models. We still need our tables because that's how the relational mapping works in the Ordering system. Tricky part would be how to use this external data where we can save time. My initial thoughts are that Menu API would be the most useful in terms of saving time from manually writing all the content.

Perhaps for the demo, since time is limited, we could scrape a few of those and store it in our DB when Customers ask for nearby shops?

Re: "ordering food" After showing the list of nearby shops, Customer will select, and we will render a webview menu of the select Merchant to show the MenuItems. Then any selected items gets added to the Order's LineItems. I think someone is already working on the Menu Webview for the Messenger app. But if not, perhaps you can after we figure out the Merchant data integration.

KHvic commented 4 years ago

How does the Menu data from Zomato look like?

Yeah, will need to think about how to integrate this data with our data models. We still need our tables because that's how the relational mapping works in the Ordering system. Tricky part would be how to use this external data where we can save time. My initial thoughts are that Menu API would be the most useful in terms of saving time from manually writing all the content.

Perhaps for the demo, since time is limited, we could scrape a few of those and store it in our DB when Customers ask for nearby shops?

Re: "ordering food" After showing the list of nearby shops, Customer will select, and we will render a webview menu of the select Merchant to show the MenuItems. Then any selected items gets added to the Order's LineItems. I think someone is already working on the Menu Webview for the Messenger app. But if not, perhaps you can after we figure out the Merchant data integration.

Unfortunately, menu for singapore restaurants doesn't work too well. We could only get an image of menu picture at best.

Agreed with storing menus in our db for simplicity. These are the things that I will work on now:

  1. Synchronizing our merchant by including zomato id for geolocation
  2. A quick way to store and get menu item of a restaurant (is item pricing and name enough? Not planning to add an image at this point)