Skip to content

Latest commit

 

History

History
171 lines (118 loc) · 6.31 KB

README.md

File metadata and controls

171 lines (118 loc) · 6.31 KB

subito-bot

Build Status Coverage Status Swagger Status

A slash command Slack bot for getting the daily soup selection from Indianapolis' Subito

Add to Slack

Usage

/subito - what's on the menu today!

screenshot_1

/subito [today | tomorrow | yesterday | YYYY-MM-DD] - what's on the menu for some day

OR

/subito day [today | tomorrow | yesterday | YYYY-MM-DD]

screenshot_2

/subito week

OR

/subito week [today | tomorrow | yesterday | YYYY-MM-DD]

week

/subito subscribe

subscribe_1

subscribe_2

/subito subscribe [search string]

subscribe_3

_ *You can only be subscribed once_

/subito unsubscribe

unsubscribe

/subito search [search string]

search

/subito settings notify [time]

settings

/subito help (or anything else unrecognizable)

help

In Development

  • Subscribe to multiple criteria

Docs

Localhost Docs

Online Docs

Cron Schedule

Job Runtime Description
Soup Calendar Importer 12:00am Sunday Fetches the latest soup calendar, parses, and updates the soup calendar database
Subscriber Messaging Every 15 Minutes Handles messaging subscribers whose notification setting is within that 15 minute range

* Hosted server timezone runs in EDT

Development

Requirements

  • mysql
  • node/npm (recommend using nvm)

Setup

  • mysql -e "CREATE DATABASE IF NOT EXISTS subito;" -u root -p
  • mysql -e "CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';" -u root -p
  • mysql -e "GRANT ALL PRIVILEGES ON subito . * TO '[username]'@'localhost';" -u root -p
  • mysql -D subito < ddl/ddl.sql -u root -p

Environment

While defaults exist, many things (like connecting to a database) will not work unless you've set up a local environment (.env) file in the project's root directory. Below is an example/template you should use.

DATABASE_HOST=localhost
DATABASE_USER=subito
DATABASE_PASSWORD=[password]
DATABASE_NAME=subito
HOST=localhost
TEST_DATABASE_HOST=localhost
TEST_DATABASE_USER=test
TEST_DATABASE_PASSWORD=[test password]
TEST_DATABASE_NAME=subito_test
PORT=3000
SSL_PORT=443
SSL_PRIV_KEY=[absolute path to key]
SSL_CERT=[absolute path to cert]
SSL_CA=[absolute path to ca/chain]
ENCRYPTION_KEY=[random key]
TEST_LOGGING_LEVEL=fatal
LOGGING_LEVEL=debug
NODE_ENV=development

Swagger Building

By design, the swagger.yaml file is git-ignored. This is to leverage dynamic variables per environment, as can be seen in config/[env].js. While the buildSwagger command is included at the start of a standard run and test, it does not run when swagger project start is used to start the server, nor node app.js. So be aware when changes are made to index.yaml that npm run buildSwagger needs to run or you won't be up to date.

Database Changes

Database changes should be added in the db-migrations/sql folder. File names should be something like [migration id]-[hyphen case description]-[up | down].sql, with a corresponding up and down file.

Migrations can be ran via npm run migrate-up:[local | test]. This command will process and run all up migrations. npm run migrate-down:[local | test] will run only the last migration down script, so undoing a migration will happen one at a time.

Testing

Setup

  • mysql -e "CREATE DATABASE IF NOT EXISTS subito_test;" -u root -p
  • mysql -e "CREATE USER 'test'@'localhost' IDENTIFIED BY '[password]';" -u root -p
  • mysql -e "GRANT ALL PRIVILEGES ON subito_test . * TO 'test'@'localhost';" -u root -p
  • mysql -D subito_test < ddl/ddl.sql -u root -p

License

GNU General Public License v3.0

Privacy

Privacy Policy

Disclaimers

This privacy policy is only guaranteed for the instance of Subito hosted at dev.brandongroff.com

While Subito bot was built to use the Subito soup schedule, this app is completely unassociated with the Subito business. The logo and all content existing at subitosoups.com are property of Subito. This application exists solely as an alternate way to view and be notified of their soup calendar and was independently developed.

The use of the Subito logo in the Slack App store submission is currently being discussed with Subito management. While completely unassociated with the Subito business, the submission will not be made fully public until/unless Subito soups approves the project.