Skip to content

Commit

Permalink
created basic documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MelonSmasher committed Jun 8, 2017
1 parent 9bbb3ca commit 33a58c5
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 141 deletions.
159 changes: 19 additions & 140 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,146 +23,25 @@ ORM Core is a REST API designed to house institutional data and act as an interm

##### Features

* REST API interface - `Implemented`
* API manager front end - `Implemented`
* API manager admin back end - `Implemented`
* API Accounts for different applications - `Implemented`
* Account permissions and access control - `Implemented`
* JWT authentication - `Implemented`
* API rate limit/throttle - `Implemented`
* API event history - `Implemented`
* Log viewer - `Implemented`
* Mobile Phone and Email verification - `Implemented`
* API metrics and statistics - `Implemented`
* API Event broadcast to event manager for 3rd party applications - `Implemented`
* Interactive documentation using OpenAPI fka(Swagger) - `Implemented`

## Documentation

* [API Documentation](https://demo-orm.sage.edu/api/documentation)

## Requirements:

* php >= 7.0.0
* Redis
* MariaDB/MySQL (tested on MariaDB 10.1)
* [Yarn](https://yarnpkg.com/) -- For development*
* [composer](https://getcomposer.org/)
* NGINX or Apache (tested on NGINX)

PHP Packages:

* php-pecl-redis
* php-pdo
* php-mysqlnd
* php-mcrypt
* php-mbstring
* php-gd
* php-xml
* php-fpm (NGINX only)

## Install

* Step 1: [Install NGINX](https://github.com/MelonSmasher/NginxInstaller)

* Step 2: Install MariaDB

* Step 3: Install Redis

* Step 4: Install PHP and extensions

* Step 5: Initialize the DB

```mysql
create database orm;
CREATE USER 'orm'@'localhost' IDENTIFIED BY 'SOMESTRONGPASSWORD';
GRANT ALL PRIVILEGES ON orm.* To 'orm'@'localhost';
FLUSH PRIVILEGES;
```

* Step 6: Initialize ORM

```bash
# change dir the NGINX web root
cd /usr/share/nginx/html/

# Create a vendor dir
mkdir OpenResourceManager/; cd OpenResourceManager;

# Clone Repo
git clone https://github.com/OpenResourceManager/Core.git; cd Core;

# Check out to the latest tag
git checkout $(git describe --tags $(git rev-list --tags --max-count=1));

# Create a new envorinment file
cp .env.example .env;

# Install composer dependancies
composer install --no-interaction --no-scripts --no-dev;

# Generate optimaized class loader
composer dump-autoload -o;

# Generate a new application key
php artisan key:generate;

# Generate a boradcast key
php artisan orm:bckey;

# Generate a new JWT key
bash generate_jwt_key.sh;

# Run DB Migrations
php artisan migrate --force;

# Seed DB With Default Assets
php artisan db:seed --force;

# Clear any compiled assets
php artisan clear-compiled;

# Compile and optomize
php artisan optimize;

# Cache normal routes
php artisan route:cache;

# Cache API routes
php artisan api:cache;
```

* Step 7: Open the `.env` file in your favorite editor and configure it.

---

## Update

```bash
# Pull the latest code
git pull;

# Check out to the latest tag
git checkout $(git describe --tags $(git rev-list --tags --max-count=1));

# Install composer dependancies
composer install --no-interaction --no-dev;

# Run DB Migrations
php artisan migrate --force;

# Clear any compiled assets
php artisan clear-compiled;

# Compile and optomize
php artisan optimize;

# Cache normal routes
php artisan route:cache;

# Cache API routes
php artisan api:cache;
```
* REST API interface
* API manager front end
* API manager admin back end
* API Accounts for different applications
* Account permissions and access control
* JWT authentication
* API rate limit/throttle
* API event history
* Log viewer
* Mobile Phone and Email verification
* API metrics and statistics
* API Event broadcast to event manager for 3rd party applications
* Interactive documentation using OpenAPI fka(Swagger)

# Documentation

For installation, update, and API spec documentation:

* [Read the docs here](https://openresourcemanagercore.readthedocs.io/en/latest/)

# Related Software

Expand Down
7 changes: 7 additions & 0 deletions docs/API_Specification.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# API Specification

Below is a breakdown of ORM Core API spec.

Be sure to check out the [Swagger docs](https://demo-orm.sage.edu/api/documentation) for interactive documentation.

---
<table><tr><td>Path</td><td>Method</td><td>Summary</td></tr><tr><td>/accounts</td><td>GET</td><td>List accounts in a paginated format.</td></tr><tr><td>/accounts</td><td>DELETE</td><td>Delete an account.</td></tr><tr><td>/accounts</td><td>PATCH</td><td>Update an account.</td></tr><tr><td>/accounts</td><td>POST</td><td>Create/Update/Restore account.</td></tr><tr><td>/accounts/course</td><td>DELETE</td><td>Detach Course from Account.</td></tr><tr><td>/accounts/course</td><td>POST</td><td>Assign Course to Account.</td></tr><tr><td>/accounts/department</td><td>POST</td><td>Assign Department to Account.</td></tr><tr><td>/accounts/department</td><td>DELETE</td><td>Detach Department from Account.</td></tr><tr><td>/accounts/duty</td><td>POST</td><td>Assign Duty to Account.</td></tr><tr><td>/accounts/duty</td><td>DELETE</td><td>Detach Duty from Account.</td></tr><tr><td>/accounts/identifier/{identifier}</td><td>GET</td><td>Show an Account by Identifier</td></tr><tr><td>/accounts/load-status/code/{code}</td><td>GET</td><td>List accounts with the specified load status code in a paginated format.</td></tr><tr><td>/accounts/load-status/{id}</td><td>GET</td><td>List accounts with the specified load status in a paginated format.</td></tr><tr><td>/accounts/room</td><td>POST</td><td>Assign Room to Account.</td></tr><tr><td>/accounts/room</td><td>DELETE</td><td>Detach Room from Account.</td></tr><tr><td>/accounts/school</td><td>DELETE</td><td>Detach Account from School.</td></tr><tr><td>/accounts/school</td><td>POST</td><td>Assign Account to School.</td></tr><tr><td>/accounts/username/{username}</td><td>GET</td><td>Show an Account by Username</td></tr><tr><td>/accounts/{id}</td><td>GET</td><td>Show an Account by ID</td></tr><tr><td>/addresses</td><td>DELETE</td><td>Delete an Address.</td></tr><tr><td>/addresses</td><td>POST</td><td>Create Address.</td></tr><tr><td>/addresses</td><td>GET</td><td>List Addresses in a paginated format.</td></tr><tr><td>/addresses/{id}</td><td>GET</td><td>Show an Address by ID.</td></tr><tr><td>/alias-accounts</td><td>DELETE</td><td>Delete an alias account.</td></tr><tr><td>/alias-accounts</td><td>POST</td><td>Create/Update/Restore alias account.</td></tr><tr><td>/alias-accounts</td><td>GET</td><td>List alias accounts in a paginated format.</td></tr><tr><td>/alias-accounts/username/{username}</td><td>GET</td><td>Show an alias account by Username</td></tr><tr><td>/alias-accounts/{id}</td><td>GET</td><td>Show an alias account by ID</td></tr><tr><td>/auth</td><td>POST</td><td>Authenticate with API using Secret.</td></tr><tr><td>/auth/login</td><td>POST</td><td>Authenticate with API using credentials.</td></tr><tr><td>/auth/validate</td><td>GET</td><td>Verify authenticated session.</td></tr><tr><td>/buildings</td><td>GET</td><td>List Buildings in a paginated format.</td></tr><tr><td>/buildings</td><td>DELETE</td><td>Delete a building.</td></tr><tr><td>/buildings</td><td>POST</td><td>Create/Update/Restore Building.</td></tr><tr><td>/buildings/code/{code}</td><td>GET</td><td>Show a Building by Code.</td></tr><tr><td>/buildings/{id}</td><td>GET</td><td>Show a Building by ID.</td></tr><tr><td>/campuses</td><td>GET</td><td>List campuses in a paginated format.</td></tr><tr><td>/campuses</td><td>POST</td><td>Create/Update/Restore Campus.</td></tr><tr><td>/campuses</td><td>DELETE</td><td>Delete a Campus.</td></tr><tr><td>/campuses/code/{code}</td><td>GET</td><td>Show a Campus by Code.</td></tr><tr><td>/campuses/{id}</td><td>GET</td><td>Show a Campus by ID.</td></tr><tr><td>/countries</td><td>GET</td><td>List Countries in a paginated format.</td></tr><tr><td>/countries</td><td>DELETE</td><td>Delete a Country.</td></tr><tr><td>/countries</td><td>POST</td><td>Create/Update/Restore Country.</td></tr><tr><td>/countries/code/{code}</td><td>GET</td><td>Show a Country by Code.</td></tr><tr><td>/countries/{id}</td><td>GET</td><td>Show a Country by ID.</td></tr><tr><td>/courses</td><td>POST</td><td>Create/Update/Restore Course.</td></tr><tr><td>/courses</td><td>GET</td><td>List Courses in a paginated format.</td></tr><tr><td>/courses</td><td>DELETE</td><td>Delete a Course.</td></tr><tr><td>/courses/code/{code}</td><td>GET</td><td>Show a Course by Code.</td></tr><tr><td>/courses/{id}</td><td>GET</td><td>Show a Course by ID.</td></tr><tr><td>/departments</td><td>GET</td><td>List Departments in a paginated format.</td></tr><tr><td>/departments</td><td>POST</td><td>Create/Update/Restore Department.</td></tr><tr><td>/departments</td><td>DELETE</td><td>Delete a Department.</td></tr><tr><td>/departments/code/{code}</td><td>GET</td><td>Show a Department by Code.</td></tr><tr><td>/departments/{id}</td><td>GET</td><td>Show a Department by ID.</td></tr><tr><td>/duties</td><td>POST</td><td>Create/Update/Restore Duty.</td></tr><tr><td>/duties</td><td>GET</td><td>List Duties in a paginated format.</td></tr><tr><td>/duties</td><td>DELETE</td><td>Delete a Duty.</td></tr><tr><td>/duties/account/{id}</td><td>GET</td><td>Show a list of Duties that an account is a member of.</td></tr><tr><td>/duties/code/{code}</td><td>GET</td><td>Show a Duty by Code.</td></tr><tr><td>/duties/identifier/{identifier}</td><td>GET</td><td>Show a list of Duties that an account is a member of.</td></tr><tr><td>/duties/username/{username}</td><td>GET</td><td>Show a list of Duties that an account is a member of.</td></tr><tr><td>/duties/{id}</td><td>GET</td><td>Show a Duty by ID.</td></tr><tr><td>/emails</td><td>GET</td><td>List Emails in a paginated format.</td></tr><tr><td>/emails</td><td>POST</td><td>Create/Update/Restore Email.</td></tr><tr><td>/emails</td><td>DELETE</td><td>Delete an Email.</td></tr><tr><td>/emails/account/{id}</td><td>GET</td><td>Show all Email's owned by Account.</td></tr><tr><td>/emails/address/{address}</td><td>GET</td><td>Show a Email by Address.</td></tr><tr><td>/emails/identifier/{identifier}</td><td>GET</td><td>Show all Email's owned by Account by Identifier.</td></tr><tr><td>/emails/unverified</td><td>GET</td><td>List of unverified Emails in a paginated format.</td></tr><tr><td>/emails/unverified/account/{id}</td><td>GET</td><td>List of unverified Emails in a paginated format that are owned by the specified account.</td></tr><tr><td>/emails/username/{username}</td><td>GET</td><td>Show all Email's owned by Account by Username.</td></tr><tr><td>/emails/verified</td><td>GET</td><td>List of verified Emails in a paginated format.</td></tr><tr><td>/emails/verified/account/{id}</td><td>GET</td><td>List of verified Emails in a paginated format that are owned by the specified account.</td></tr><tr><td>/emails/{id}</td><td>GET</td><td>Show an Email by ID.</td></tr><tr><td>/load-status/code/{code}</td><td>GET</td><td>Show a Load Status by Code.</td></tr><tr><td>/load-statuses</td><td>DELETE</td><td>Delete a Load Status type.</td></tr><tr><td>/load-statuses</td><td>POST</td><td>Create/Update/Restore Load Status.</td></tr><tr><td>/load-statuses</td><td>GET</td><td>List the available Load Status types.</td></tr><tr><td>/load-statuses/{id}</td><td>GET</td><td>Show a Load Status by ID.</td></tr><tr><td>/mobile-carriers</td><td>POST</td><td>Create/Update/Restore Mobile Carrier.</td></tr><tr><td>/mobile-carriers</td><td>GET</td><td>List MobileCarriers in a paginated format.</td></tr><tr><td>/mobile-carriers</td><td>DELETE</td><td>Delete a Mobile Carrier.</td></tr><tr><td>/mobile-carriers/code/{code}</td><td>GET</td><td>Show a Mobile Carrier by Code.</td></tr><tr><td>/mobile-carriers/{id}</td><td>GET</td><td>Show a Mobile Carrier by ID.</td></tr><tr><td>/mobile-phones</td><td>POST</td><td>Create/Update/Restore Mobile Phone.</td></tr><tr><td>/mobile-phones</td><td>DELETE</td><td>Delete an Mobile Phone.</td></tr><tr><td>/mobile-phones</td><td>GET</td><td>List Mobile Phones in a paginated format.</td></tr><tr><td>/mobile-phones/account/{id}</td><td>GET</td><td>Show all Mobile Phone's owned by Account.</td></tr><tr><td>/mobile-phones/identifier/{identifier}</td><td>GET</td><td>Show all Mobile Phone's owned by Account by Identifier.</td></tr><tr><td>/mobile-phones/mobile-carrier/code/{code}</td><td>GET</td><td>List of Mobile Phones by Mobile Carrier Code.</td></tr><tr><td>/mobile-phones/mobile-carrier/id/{id}</td><td>GET</td><td>List of Mobile Phones by Mobile Carrier ID.</td></tr><tr><td>/mobile-phones/unverified</td><td>GET</td><td>List of unverified Mobile Phones in a paginated format.</td></tr><tr><td>/mobile-phones/unverified/account/{id}</td><td>GET</td><td>List of unverified Mobile Phones in a paginated format owned by an account.</td></tr><tr><td>/mobile-phones/username/{username}</td><td>GET</td><td>Show all Mobile Phone's owned by Account by Username.</td></tr><tr><td>/mobile-phones/verified</td><td>GET</td><td>List of verified Mobile Phones in a paginated format.</td></tr><tr><td>/mobile-phones/verified/account/{id}</td><td>GET</td><td>List of verified Mobile Phones that an account owns in a paginated format.</td></tr><tr><td>/mobile-phones/{id}</td><td>GET</td><td>Show an Mobile Phone by ID.</td></tr><tr><td>/rooms</td><td>GET</td><td>List Rooms in a paginated format.</td></tr><tr><td>/rooms</td><td>DELETE</td><td>Delete a Room.</td></tr><tr><td>/rooms</td><td>POST</td><td>Create/Update/Restore Room.</td></tr><tr><td>/rooms/code/{code}</td><td>GET</td><td>Show a Room by Code.</td></tr><tr><td>/rooms/{id}</td><td>GET</td><td>Show a Room by ID.</td></tr><tr><td>/school/code/{code}</td><td>GET</td><td>Show a School by Code.</td></tr><tr><td>/schools</td><td>GET</td><td>List Schools in a paginated format.</td></tr><tr><td>/schools</td><td>POST</td><td>Create/Update/Restore School.</td></tr><tr><td>/schools</td><td>DELETE</td><td>Delete a School.</td></tr><tr><td>/schools/{id}</td><td>GET</td><td>Show a School by ID.</td></tr><tr><td>/service-accounts</td><td>DELETE</td><td>Delete an service account.</td></tr><tr><td>/service-accounts</td><td>GET</td><td>List service accounts in a paginated format.</td></tr><tr><td>/service-accounts</td><td>POST</td><td>Create/Update/Restore service account.</td></tr><tr><td>/service-accounts/identifier/{identifier}</td><td>GET</td><td>Show an service account by Identifier</td></tr><tr><td>/service-accounts/username/{username}</td><td>GET</td><td>Show an service account by Username</td></tr><tr><td>/service-accounts/{id}</td><td>GET</td><td>Show an service account by ID</td></tr><tr><td>/states</td><td>DELETE</td><td>Delete a State.</td></tr><tr><td>/states</td><td>GET</td><td>List States in a paginated format.</td></tr><tr><td>/states</td><td>POST</td><td>Create/Update/Restore State.</td></tr><tr><td>/states/code/{code}</td><td>GET</td><td>Show a State by Code.</td></tr><tr><td>/states/{id}</td><td>GET</td><td>Show a State by ID.</td></tr><tr><td>/verify</td><td>POST</td><td>Verify Email or Mobile Phone.</td></tr><tr><td>/verify/{token}</td><td>GET</td><td>Verify Email or Mobile Phone.</td></tr></table>
73 changes: 73 additions & 0 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Install

* Step 1: [Install NGINX](https://github.com/MelonSmasher/NginxInstaller)

* Step 2: Install MariaDB

* Step 3: Install Redis

* Step 4: Install PHP and extensions

* Step 5: Initialize the DB

```mysql
create database orm;
CREATE USER 'orm'@'localhost' IDENTIFIED BY 'SOMESTRONGPASSWORD';
GRANT ALL PRIVILEGES ON orm.* To 'orm'@'localhost';
FLUSH PRIVILEGES;
```

* Step 6: Initialize ORM

```bash
# Create a vendor dir
sudo mkdir /home/nginx; sudo mkdir /usr/share/nginx/html/OpenResourceManager; cd /usr/share/nginx/html/OpenResourceManager;

# Set the right permissions
sudo chown -R nginx:nginx /usr/share/nginx/html/OpenResourceManager; sudo chown -R nginx:nginx /home/nginx;

# Clone Repo
sudo -u nginx git clone https://github.com/OpenResourceManager/Core.git; cd Core;

# Check out to the latest tag
sudo -u nginx git checkout $(git describe --tags $(git rev-list --tags --max-count=1));

# Create a new envorinment file
sudo -u nginx cp .env.example .env;

# Install composer dependancies
sudo -u nginx composer install --no-dev;

# Generate optimaized class loader
sudo -u nginx composer dump-autoload -o;

# Generate a new application key
sudo -u nginx php artisan key:generate;

# Generate a boradcast key
sudo -u nginx php artisan orm:bckey;

# Generate a new JWT key
sudo -u nginx bash generate_jwt_key.sh;

# Run DB Migrations
sudo -u nginx php artisan migrate --force;

# Seed DB With Default Assets
sudo -u nginx php artisan db:seed --force;

# Compile and optomize
sudo -u nginx php artisan optimize;

# Cache normal routes
sudo -u nginx php artisan route:cache;

# Cache API routes
sudo -u nginx php artisan api:cache;
```

* Step 7: Open the `.env` file in your favorite editor and configure it.

```bash
sudo -u nginx vi .env;
```
72 changes: 72 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# ORM Core API

[![Build Status](https://travis-ci.org/OpenResourceManager/Core.svg?branch=master)](https://travis-ci.org/OpenResourceManager/Core)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

---

## About

ORM Core is a REST API designed to house institutional data and act as an intermediate between an existing ERP and an array of applications and systems.

##### Advantages

* Near real time data propagation:
* Depending on the existing ERP, data can be sent to the core API on the fly as it receives new and updated data. From there any client applications that reefer to ORM are up to date and any aggregates that need to be sent information are sent data through Redis Channels.
* Control:
* The API manager allows you to view API clients. In a large environment this has huge benefits, since it can be very hard to keep track of various flat file feeds.
* Development:
* The API interface eases the development of home grown programs and applications.
* Security:
* Fine grained access and permissions can be configured.
* JWT authentication allows for easy and secure development.
* Feedback:
* API clients will be provided with detailed feedback which allows for error handling and error reporting on the client side as well as errors being log within ORM itself.

##### Features

* REST API interface
* API manager front end
* API manager admin back end
* API Accounts for different applications
* Account permissions and access control
* JWT authentication
* API rate limit/throttle
* API event history
* Log viewer
* Mobile Phone and Email verification
* API metrics and statistics
* API Event broadcast to event manager for 3rd party applications
* [Interactive documentation](https://demo-orm.sage.edu/api/documentation) using OpenAPI fka(Swagger)

## Requirements:

* php >= 7.0.0
* Redis
* MariaDB/MySQL (tested on MariaDB 10.1)
* [Yarn](https://yarnpkg.com/) -- For development*
* [composer](https://getcomposer.org/)
* NGINX or Apache (tested on NGINX)

PHP Packages:

* php-pecl-redis
* php-pdo
* php-mysqlnd
* php-mcrypt
* php-mbstring
* php-gd
* php-xml
* php-fpm (NGINX only)

### Installation

See the [installation docs](INSTALL.md)

### Update

See the [update docs](UPDATE.md)

### API Specification

See the [API spec](API_Specification.md)
26 changes: 26 additions & 0 deletions docs/UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Update

Below is a general set of update directions, there may be version specific directions at some point.

```bash
# Pull the latest code
sudo -u nginx git pull;

# Check out to the latest tag
sudo -u nginx git checkout $(git describe --tags $(git rev-list --tags --max-count=1));

# Install composer dependancies
sudo -u nginx composer install;

# Run DB Migrations
sudo -u nginx php artisan migrate --force;

# Compile and optimize
sudo -u nginx php artisan optimize;

# Cache normal routes
sudo -u nginx php artisan route:cache;

# Cache API routes
sudo -u nginx php artisan api:cache;
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prod": "gulp --production",
"dev": "gulp watch",
"spec": "yaml2json -p spec/swagger.yaml > storage/api-docs/api-docs.json",
"spec2md": "swagger-to-md storage/api-docs/api-docs.json > docs/spec.md"
"spec2md": "cp spec/header.md docs/API_Specification.md && swagger-to-md -y spec/swagger.yaml >> docs/API_Specification.md"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
Expand Down

0 comments on commit 33a58c5

Please sign in to comment.