memberpoint/ba-wos-app

Installs: 0

Dependents: 0

Suggesters: 0

Type:project

v1.23.beta1 2021-12-03 04:52 UTC

README

The MemberPoint Whole-Of-Sports (WOS) Bowls Australia Application provides API based functionality for the management of Bowls Australia's CRM.

Quick start

These are a summary of the commands to run to setup the app.

Update configuration
DATABASE: /.env
Setup App
composer install
mkdir config/jwt
openssl genrsa -out config/jwt/private.pem -aes256 4096
openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem
bin/console doctrine:database:create
bin/console doctrine:schema:create
Load Test Data
bin/console doctrine:fixtures:load
bin/console wos:users:create-account -c
bin/console ba:clubmember:index
bin/console server:run

Setup Tests

UPDATE CONFIG: 
/phpunit.xml.dist

GENERATE KEYS
openssl genrsa -out config/jwt/private-test.pem  -passout pass:TestingPass -aes256 4096
openssl rsa -pubout -passin pass:TestingPass -in config/jwt/private-test.pem -out config/jwt/public-test.pem

SETUP TEST USER
Password: Testing101

bin/console wos:users:create-account -c --first-name=Test --last-name=Test --email-address=test@example.com

Installation

Open a command console, enter the project directory, and execute:

$ composer install

Setup

There are a number of configuration steps required to successfully install and setup the application.

Security

This application provides JSON Web Token (JWT) authentication functionality. To use this functionality, SSH keys first need to be generated.

To generate the necessary SSH keys, open a command console, enter the project directory, and execute:

mkdir config/jwt
APP KEYS
openssl genrsa -out config/jwt/private.pem -aes256 4096
openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem

This command will require you to enter a pass-phrase. This pass-phrase will need to be updated into the applications .env file.

The .env file should have been created for you automatically by Symfony after running the installation.

###> lexik/jwt-authentication-bundle ###
# Key paths should be relative to the project directory
JWT_PRIVATE_KEY_PATH=config/jwt/private.pem
JWT_PUBLIC_KEY_PATH=config/jwt/public.pem
JWT_PASSPHRASE=[ ENTER PASS-PHRASE HERE ]
###< lexik/jwt-authentication-bundle ###

Database

This application uses doctrine for database management. It's pre-configured to use a MySQL database for its storage.

To set the database, again edit the .env file and add in the doctrine connection string.

DATABASE_URL=mysql://<username>:<password>@127.0.0.1:3306/<databaseName>

You can then use Symfony's console to create the database and build the base schema.

$ bin/console doctrine:database:create
$ bin/console doctrine:schema:create

All of the WOS bundles come loaded with doctrine fixtures. The dev version of this application includes doctrine/doctrine-fixtures-bundle.

As an optional step, you can add these fixtures with the following command.

$ bin/console doctrine:fixtures:load

Mailer

There are a number of bundles that can send emails.

Default User

To begin using the application, you will first need to create a new user account. An account can be created for a new user using the following command:

$ php bin/console wos:users:create-account

Once the user has been created, an email with be sent to the nominated address (a copy will be included in the console).

Club Member Index

One of the last steps is to populate the ClubMember index. This can be run by the following command.

$ php bin/console ba:clubmember:index

Once the dev-server has started, this link can be followed and a password setup.

Dev Server

This application comes with the symfony dev-server which can be started with

$ php bin/console server:run

Testing

This Application is testable via PHPUnit. There are a few configuration options needed prior to running

First, generate some private keys for the tests.
for CI purposes please ensure the passphrase TestingPass is used.
As before the keys can be generated using the following openssl applications via the terminal.

openssl genrsa -out config/jwt/private-test.pem  -passout pass:TestingPass -aes256 4096
openssl rsa -pubout -passin pass:TestingPass -in config/jwt/private-test.pem -out config/jwt/public-test.pem

Second, copy the phpunit.xml.dist file found at the application root to phpunit.xml, and update the following line to match your local database setup:

<env name="DATABASE_URL" value="mysql://root:root@127.0.0.1:3306/ba_app"/>

TESTING IS CURRENTLY DISABLED

Third, create at least one set of credentials for testing.
The Testing suite is setup to automatically expect a user with the following credentials.

$ bin/console wos:users:create-account -c --first-name=Test --last-name=Test --email-address=test@example.com

Username: test@example.com
Password: Testing101

Functional Test Coverage

To test coverage of Functional tests, you can run the following replacing <outputFolder>
With the destination that you would like the HTML output to.

$ bin/phpunit -cphpunit-functionalcoverage.xml --coverage-html="<outputFolder>"