Member Contribution Report (Hüseyin Çivi) - bounswe/bounswe2023group6 GitHub Wiki

Important Issues Related to the Practice Application

  • Learning Flask framework and Git #154
  • Researching about to Google Maps API #163
  • Implementing Google Maps API #163
  • Creating unit tests on Google Maps API #202

The name, route, and description of utilized third-party URIs

The API name used is Google Maps API, which provides location information about any address. Users of this API can quickly get location data with the help of this API and easily get all the information about the location of the relevant place. While doing this, latitude and longitude values are obtained and displayed on the map by using the gmaps.geocode() function of the googlemaps library.

The name, route, and description of the created API functions

I wrote 3 endpoints. Thanks to these endpoints, I was able to access my application, search for any address, save any address to favorites and access favorite addresses.

  • The first is the endpoint named "/show_map". I can search any address with this endpoint. If there is an address I am looking for, it shows this address on the map, if it is an invalid address, it informs the user that there is no such address.
  • My second endpoint is the endpoint named "/add_location_to_favorites". Thanks to this endpoint, I can save the address I am looking for in my favorites.
  • My third endpoint is the endpoint named "/show_all_favorite_locations". Thanks to this endpoint, I can access the addresses I added to my favorites before.

I will introduce my application with photos below.

After logging into the web application, please register if you do not have an account; If using the endpoint named "/show_map" the following page will appear. Here is a text box that needs to be filled. image

After typing the address you want to search in the relevant text box, you can access the map equivalent of the address you typed by clicking the "show map" button. image

If you want to add any address to your favorites and then access this address easily, you can save the relevant address to your favorites by clicking the "add to location to favorites" button. This button directs you to the "/add_location_to_favorites" endpoint and saves the relevant address in the database. image

Then, when you click on the "show all favorite locations" button to access your favorite addresses, you will be directed to the "/show_all_favorite_locations" endpoint and you can access your favorites quickly. image

Here are the main codes I wrote for Google Maps API:

This is my database table for recording favorite locations.

image

These are the my application's codes.

image image image image image image

Description of the unit tests

In test_location_api.py, the functions relating to login operation was prepared by Erkam. I used those codes because I need to use a user id when I want to CRUD operations on LocationTable in the database for unique users. Below images are test codes for searching for correct and incorrect addresses, accessing favorite addresses, adding addresses to favorites. These tests make requests to the endpoints, respectively, and distinguish whether there is an error according to the status of the returned response.

image

Sample Calls

I'm using Postman to display requests and responses. image image

Describe any challenges you met during the implementation

Since I did not know the Flask framework before, I had a hard time with this at first. I also had difficulties because I did not have experience in the testing part.