Git Product home page Git Product logo

tavoo-api's Introduction

TAVOO API

Current repository contains the files for the API of TAVOO. Calling those "API" may be an overkill, as the above are (mostly) simple PHP files that handle the communication with the database on the server. But still, it is the communication layer between the mobile application and the database.

Database

The structure of the database is pretty simple, too. It consists of 5 tables, with a few interconnections among them. There is a table called users (that stores the basic information about the registered users), a table called locations (that stores the basic information about the locations that are suitable for meetings and play), a table called ratings (which contains a user's rating for a location), a table called checked (that contains information on the location of a user who has performed check-in), and finally, a table called logs (which is used for storing various information about the activity of the users in the pre-alpha version of the application).

users
id* username password
int(11) varchar(64) varchar(64)
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(64) COLLATE utf8_bin NOT NULL,
  `password` varchar(256) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`,`username`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ;
locations
id* name address lat lng
int(11) varchar(64) varchar(128) float(10,6) float(10,6)
CREATE TABLE IF NOT EXISTS `locations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) COLLATE utf8_bin NOT NULL,
  `address` varchar(128) COLLATE utf8_bin NOT NULL,
  `lat` float(10,6) NOT NULL,
  `lng` float(10,6) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=13 ;
ratings
user_id location_id rating
int(11) int(11) int(2)
CREATE TABLE IF NOT EXISTS `ratings` (
  `user_id` int(11) NOT NULL,
  `location_id` int(11) NOT NULL,
  `rating` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
checked
user_id location_id
int(11) int(11)
CREATE TABLE IF NOT EXISTS `checked` (
  `user_id` int(11) NOT NULL,
  `location_id` int(11) NOT NULL,
  UNIQUE KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
logs
user_id activity_tag action_tag related_id action_timestamp
int(11) varchar(64) varchar(64) int(11) timestamp
CREATE TABLE IF NOT EXISTS `logs` (
  `user_id` int(11) NOT NULL,
  `activity_tag` varchar(64) COLLATE utf8_bin NOT NULL,
  `action_tag` varchar(64) COLLATE utf8_bin NOT NULL,
  `related_id` int(11) NOT NULL,
  `action_timestamp` timestamp NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Functionalities

Each file is used for a different function of the application. More particularly:

<tr>
  <td><b>checked_users.php</b></td>
</tr>
<tr>
  <td><i>This file returns the number of the users that have checked-in a specific location.</i></td>
</tr>

<tr>
  <td><b>checkin.php</b></td>
</tr>
<tr>
  <td><i>This file checks a user in a location.</i></td>
</tr>

<tr>
  <td><b>checkout.php</b></td>
</tr>
<tr>
  <td><i>This file checks a user out of a location.</i></td>
</tr>

<tr>
  <td><b>db_connect.php</b></td>
</tr>
<tr>
  <td><i>This file is responsible for the connection to the database, includes the necessary connection information.</i></td>
</tr>

<tr>
  <td><b>logging.php</b></td>
</tr>
<tr>
  <td><i>This file is used for registering the users' logs.</i></td>
</tr>

<tr>
  <td><b>login.php</b></td>
</tr>
<tr>
  <td><i>This file manages the login process of a user.</i></td>
</tr>

<tr>
  <td><b>play_locations.php</b></td>
</tr>
<tr>
  <td><i>This file returns all the locations that are stored in the respective table, in XML form.</i></td>
</tr>

<tr>
  <td><b>rate.php</b></td>
</tr>
<tr>
  <td><i>This file registers a rating for a location in the respective table.</i></td>
</tr>

<tr>
  <td><b>rating.php</b></td>
</tr>
<tr>
  <td><i>This file returns the rating (mean of all ratings) of a specific location.</i></td>
</tr>

<tr>
  <td><b>register.php</b></td>
</tr>
<tr>
  <td><i>This file handles the registration of a new user of the application to the database.</i></td>
</tr>

<tr>
  <td><b>vets.json</b></td>
</tr>
<tr>
  <td><i>This is a simple JSON file, containing information about the vets in an area (here, in <a href="https://en.wikipedia.org/wiki/Patras">Patras</a>).</i></td>
</tr>
add_play_location.php
This file is used for inserting a new location to the respective table.

Instructions

In order to have this API set on a server, two things need to be taken care of first. Assuming you have available space on a server (or a virtual server, like WampServer), place the current repository in a folder there. You also have to create the database and the forementioned tables. Then, you have to add the necessary information (username, password, host, database name) in the files db_connect.php and play_locations.php, so that the API can connect with the database.

Licence

GNU General Public License version 3.

tavoo-api's People

Contributors

gkffzs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.