Skip to content

Our project for "Reti di Calcolatori", made by Giovanni Roma, Marco Musciaglia, Gianmarco Montillo. Feel free to leave any bug or suggestion in the Issues page, as we will continue to develop the project. The site is now hosted on Heroku. Enjoy!

Notifications You must be signed in to change notification settings

JoGist/RC-VGDatabase

Repository files navigation

logo/logo-normal.png VGDatabase (VGDB) is a platform designed and built for gamers by gamers.

The site consists of a video game collection / sale platform. For each game you can view different information such as genre, developer, release date, score and reviews written by other users, and an additional external link for purchase on Amazon. Each game can be added to an user collection and possibly sell it, specifying its condition and price. The platform also offers a search function for games by title or genre, and a search for users. There is also a real time chat between users, to get in touch with them. The site is updated periodically, always showing the most popular games on the homepage at the moment. Each registered user therefore owns his own collection of owned games, games for sale and a list of friends (and a sub-list of favorite friends). Enjoy!

The site is now live, check it out!

Project overview (slides)

Authors

Technologies used

  • Ruby/Rails - for the base server and infrastructure
  • Google Maps API - for the map which show where each game is sold
  • Google OAuth - for autenticating with Google into the site
  • Steam OAuth - for autenticating with Steam into the site
  • IGDB API - for retreiving all games information and cover art
  • Redis-server - to establish the action cable and manage the WebSockets across chatrooms
  • PostgreSQL - relational database in which we save all data
  • Heroku - application hosting
  • Swagger - REST API documentation

Dependencies

In order to build and run the Rails server in your machine, you must have already installed and configured:

  • Ruby 2.4
  • Rails 6
  • Bundler 2
  • Redis server (any version)
  • Postgres 9 or above
  • JavaScript (any version)

Rails app setup

In order to successfully run the project, you have to obtain a valid API key on these services:

To build and run the Rails app, go into the root folder of the repo and run the following commands:

  • Build and install all required Gems included in Gemfile:

    Bundle install
  • Initialize Figaro gem, to store securely store your OAuth credentials:

    figaro install
  • To show your secret key, copy it as you will use it later:

    rake secret
  • To enter your OAuth credentials and API keys, open the file /config/application.yml created with 'Figaro install', and append at the end of file as following:

    STEAM_WEB_API_KEY: '[your-steam-api-key-here]'
    SECRET_TOKEN: '[your-rake-secret-key-here]'
    
    GOOGLE_CLIENT_ID: '[your-google-client-id-here].apps.googleusercontent.com'
    GOOGLE_CLIENT_SECRET: '[your-google-api-key-here]'
  • Insert your IGDB API key in the credentials file with:

    EDITOR='[any-IDE-here] --wait' rails credentials:edit

    And append at the end of the file that opens up the following code:

    maps:
      igdb: '[your-igdb-api-key-here]'
  • Edit in config/database.yml the username and password with the one you have set in your local machine.

  • Ensure that the Postgres service is started:

    sudo service postgresql start
  • Initialize the db:

    rake db:reset
  • Execute database migrations:

    rake db:migrate

Rails app usage

After the first setup, execute these commmands to start the server and deploy the application:

  • Start Redis server:

    redis-server
  • Start the rails server:

    rails server
  • Then simply go on this page with your browser of choice and you're done!

    localhost:3000

REST API

This Rails server also provides some REST API method, the documentation can be found here. For some methods, an API KEY is needed in order to increase security and prevent. For this project, the API KEY is a proof-of-concept, in the future it will be fully implemented with a request form and a key generation method. Any method listed here is fully functional and implemented, and in the future we'll plan to add every other API method, in order to be able to create other client or apps that can work and can be integrated with the site. The default key is '123456789'.

  • Search game by title
  • Search user by user_id, user_email, user_username
  • Search review of specific user or game by user_id or game_id
  • Search user friends by user_id
  • Search user's game collection by user_id
  • New user registration
  • Delete user
  • Edit user attributes

RSpec testing

This project also includes four test cases to test the main functions of the site. The test are:

  1. Test login of an user
  2. Add a friend to an user
  3. Delete an user by admin
  4. Delete a review by admin
  • To launch them all at once, run:

    bundle exec rspec ./spec/*_spec.rb
    • To launch them individually, run:
    bundle exec rspec ./spec/1_addUser_spec.rb
    bundle exec rspec ./spec/2_addFriend_spec.rb
    bundle exec rspec ./spec/3_adminDeleteUser_spec.rb
    bundle exec rspec ./spec/4_adminDeleteReview_spec.rb

Other useful command

  • Run the integrated Rails console

    rails console
  • View all the routes created in the project

    rails routes
  • Drop and recreate the schema and the tables

    rake db:reset
  • Execute database table migrations that are pending

    rake db:migrate

Known issues

Unbfortunately, because the site is still under development and always expanding, there are current things that didn't work as we expected. Those are the currently known issues, feel free to report any other issue, feature or suggestion in the Issue tab.

  • Sometimes when logging in with Google or Steam, the site will redirect you to an error page instead of homepage, just close the pop-up and you will be redirected

About

Our project for "Reti di Calcolatori", made by Giovanni Roma, Marco Musciaglia, Gianmarco Montillo. Feel free to leave any bug or suggestion in the Issues page, as we will continue to develop the project. The site is now hosted on Heroku. Enjoy!

Topics

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •