This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2021-03-20 19:04:08 +00:00
.github/ISSUE_TEMPLATE Update Issue templates, readme 2021-03-20 11:41:18 +00:00
.idea Hopefully fix speed issue on external data 2019-09-09 15:37:56 +01:00
doc Payroll sumission API improved and test added 2017-09-18 17:13:18 +01:00
etc/code-point-open Added codepoint open data to etc. dir with LICENCE file 2017-09-21 13:15:20 +01:00
images fixes 2017-04-20 16:40:24 +01:00
lib Fix builtin homonym linter errors 2021-03-20 19:03:59 +00:00
log Added log folder and gitignore config 2016-09-15 16:55:27 +01:00
public Word wrap feedback in admin console 2017-10-23 15:02:18 +01:00
script added new relations 2019-07-03 17:36:36 +01:00
share Add push notifications and device token management 2020-11-30 17:34:13 +00:00
t Possible fix for test failure 2019-07-14 15:52:39 +01:00
templates flash fixes on import 2019-09-11 15:02:08 +01:00
.gitignore Add code formatter, format all code 2021-03-20 12:09:50 +00:00
.travis.yml Update perl version in Travis CI 2019-09-16 10:46:38 +01:00
CHANGELOG.md Update changelog 2019-09-16 10:43:44 +01:00
CONTRIBUTING.md Add contributing and security info, license under MIT 2021-03-20 10:24:59 +00:00
cpanfile Add linting, pass gentle level 2021-03-20 11:52:59 +00:00
LICENSE.md Add contributing and security info, license under MIT 2021-03-20 10:24:59 +00:00
make_leaderboards Fixed rank sending and added leaderboard creation script 2017-07-20 11:56:24 +01:00
pear-local_loop.conf Merge remote-tracking branch 'origin/TBSliver/Minion-Tasks' into finn/minionimport 2019-07-05 18:50:37 +01:00
pear-local_loop.development.conf Fix various bits for import 2019-07-14 15:15:14 +01:00
pear-local_loop.testing.conf Update config and tests so deployment and testing use separate databases. 2017-03-08 18:52:04 +00:00
README.md Update readme 2021-03-20 19:04:08 +00:00
SECURITY.md Add contributing and security info, license under MIT 2021-03-20 10:24:59 +00:00

LocalSpend (Server)

Looking to discover if the value of spending local can be measured, understood and shown.

This repository contains the server application for the LocalSpend system. See also:

Current Status

Branch Status
master Build Status
development Build Status

Table of Contents

Technology Stack

The server app. is written in Perl.

Admin. portal pages are templated using HTML::EP.

Technology Description Link
Mojolicious Perl Web framework Link
PostgreSQL Relational database managment system Link
SQLite Relational database managment system Link

Features

This server app. provides:

  • user creation, updating and deletion;
  • organisation creation, updating and deletion;
  • an admin. management portal;
  • transaction logging;
  • transaction history analysis; and
  • leaderboard generation.

Installation

  1. Clone the repo. to your dev. environment (git clone git@github.com:Pear-Trading/FoodLoop-Server.git);
  2. enter the new directory (cd FoodLoop-Server);
  3. install the dependencies:
    • cpanm --installdeps . \
      --with-feature=sqlite \
      --with-feature=codepoint-open
      
    • if you are using a PostgreSQL database, replace --with-feature=sqlite with --with-feature=postgres.
  4. install the database:
    • run ./script/deploy_db install -c 'dbi:SQLite:dbname=foodloop.db';
    • development supports both SQLite and PostgreSQL (production uses PostgreSQL);
    • for this example we will use SQLite; so
    • as the default config. is set up for this, no configuration changes are needed initially.
  5. set up the development users:
    • ./script/pear-local_loop dev_data --force
    • DO NOT RUN ON PROD!
  6. start the Minion job scheduler:
    • ./script/pear-local_loop minion worker
  7. import ward data:
    1. Download the CSV(s) from here; and
    2. run the following command:
      •     ./script/pear-local_loop minion job \
            --enqueue 'csv_postcode_import'  \
            --args '[ "⟨ path to CSV ⟩ ]'
            ```
        
  8. set up postcodes:
    1. import Code-Point Open: - a copy is included in etc/; - run ./script/pear-local_loop codepoint_open --outcodes LA1
      1. assign postcodes:
      ./script/pear-local_loop minion job
      --enqueue entity_postcode_lookup ```

Configuration

App. configuration settings are found in pear-local_loop.⟨environment⟩.conf.

Firebase Cloud Messaging (FCM) credentials should be placed in a file called localspend-47012.json in root. This file is not tracked by Git; ask another developer for a copy.

Default user credentials are found in lib/Pear/LocalLoop/Command/dev_data.pm.

Usage

  • Run ./script/pear-local_loop minion worker to start the Minion asynchronous job scheduler; and
  • run morbo script/pear-local_loop -l http://*:3000 to start the server on the specific hostname and port.

Database Scripts

To upgrade the database after making changes to commit:

  1. Increment the $VERSION number in lib/Pear/LocalLoop/Schema.pm;
  2. run ./script/deploy_db write_ddl -c 'dbi:SQLite:dbname=foodloop.db'; and
  3. run ./script/deploy_db upgrade -c 'dbi:SQLite:dbname=foodloop.db'.

Run ./script/pear-local_loop recalc_leaderboards to update the leaderboards.

Testing

  • Run prove -lr -j 9 to run the full test suite using Test-Simple (when using an SQLite database); and
  • run PEAR_TEST_PG=1 prove -lr -j 9 to run the full test suite (when using a PostgreSQL database).

Test files are found in the t/ directory.

Code Formatting

Run for f in ./lib/**/*.pm; do perltidy -b $f; done to format all Perl files with Perl-Tidy (there is no built-in option to format files recursively).

Run perlcritic lib to lint all Perl files with Perl-Critic.

Documentation

TODO

Acknowledgements

LocalLoop is the result of collaboration between the Small Green Consultancy, Shadowcat Systems, Independent Lancaster and the Ethical Small Traders Association.

License

This project is released under the MIT license.

Contact

Name Link(s)
Mark Keating Email
Michael Hallam Email