/watchly

Watchly is a virtual town watch tool

Primary LanguageJavaScript

Watchly

Social Virtual Town Watch

Team

  • Product Owner: Zachary Lester
  • Scrum Master: Brian Loughnane
  • Development Team Members: John Mai, Zachary Lester, Brian Loughnane

Table of Contents

  1. Usage
  2. Requirements
  3. Development
    1. Installing Dependencies
    2. Setting up the database environemnt
    3. Database development support
    4. Working with the database
    5. Emulating in the browser
    6. Emulating for iOS
    7. Emulating for Android
  4. Contributing
  5. API Documentation

Usage

Use watchly to protect yourself from dangers in your vicinity. Watchly maps user-sourced crime, hazard, and danger reports, providing vital safety information. Each submitted report provides a message thread where other watchly members can respond with helpful information and engage in fruitful discussions.

Requirements

  • Node 0.12.x
  • Express 4.x
  • MySQL 5.6.x
  • Ionic 1.0.x
  • Angular 1.4.x

Development

Installing Dependencies

From within the root directory:

* npm install
* bower install
* gulp

Database Development Support

alt tag In the server/db/dev-support-assets directory, developers may access the following items:

  1. Schema visualization image
  2. schema.sql file which is unused in production but may be useful for creating schema during development
  3. testdata.sql file which is unused in production but may be useful for inserting sample data during development

Setting up a development database environment

  1. Start mysql and sign in (we default to no password, remember to change this in server/config/knex-config.js if you do):
mysql.server start
mysql -u [your username] -p
Enter Password:  [your password]
  1. In server/db/knex-config.js, set your mysql username and password in the configuration object
  2. Create and use database "watchly"
create database watchly;
use watchly;

When the app is started (node index.js, run nodemon index.js to auto restart on saving files server side), the schema will be created so long as this setup has been performed.

Emulating in the browser

  1. Start server From root directory:
node index.js
  1. Open browser and navigate to http://localhost:3000

Emulating for iOS:

* npm install -g cordova ionic ios-sim
* ionic platform add ios
* ionic build ios
* ionic emulate ios

Emulating for Android:

* download the android sdk from google
* install the android sdk
* download jre from oracle
* install jre
* add into your .bash_profile ANDROID_HOME and JAVA_HOME
* rerun your .bash_profile
* npm install -g cordova ionic
* ionic platform add android
* ionic build android
* ionic emulate android

Roadmap

View the project roadmap here

Contributing

See CONTRIBUTING.md for contribution guidelines.

API Documentation

Incidents

  • Get all incidents
$http.get('api/incidents/');
  • Post a new incident by passing an incident object in your request:
var data = { 
   description: description,
   latitude: latitude, 
   longitude: longitude,
   address: address,
   fuzzyAddress: fuzzyAddress,
   occurred_at: occurred_at
 }

$http.post('api/incidents/', data);
  • Post the top and bottom of a map as min and max latitudes(x) and longitudes(y) to get incidents within map
var data = {xMin: 0, xMax: 100, yMin: -200, yMax: 100} 
$http.post('api/incidents/nearby', data);
  • get all incident types
$http.get('api/incidents/incidentType');

Messages

  • Post a new message by passing an incidentId and a description
var data = { incidentsId: 1, description: 'There are lots of bikes stolen in that area, be careful' };
$http.post('api/messages/', data);
  • Get thread of messages about an incident by posting an incidentId to thread endpoint
var data = { incidentsId: 1 };
$http.post('api/messages/thread', data);

Local Testing

  • Reseting your Databases
* Run the app localy at localhost:3000 in your browser
* Click the Head Icon on the top Right
* Enter Username 'reset' and click Sign In
* An Ionic Modal popup should confirm a full database reset

Project Notes (by LeftHandedWhisperers)

Legacy Features

  • Added pictures to incidents! Can now add and view pictures related (or unrelated) to the incident
  • Added comments on incidents! Can now visibly gasp in horror at all the crime around you
  • Added votes on incidents! Can now like or dislike criminal activity. -3 Votes and the incident is auto deleted
  • Added profile editing! Can now edit your profile by clicking on the Person Icon after signing in
  • Added sustained sessions! When you log in your session will last for an hour and reset/autologin on refreshing the page
  • Changed incident views! Incident views are Ionic Modals and not silly google maps popups
  • Changed mobile formating! It works now! What was GreenField doing?!?
  • Changed incident icons! Ours are better