Skip to content
Peter Lam edited this page Feb 22, 2019 · 17 revisions

Adonis

Prerequisites

  • Install Node.js here

  • Install Yarn here

  • Install Adonis with yarn add global @adonisjs/cli

CMD

Within the directory /Jasper write the following to install all dependencies:

  • yarn install

Running The Application

To start the application run

  • yarn start or adonis serve --dev

To run test if your code meets coding coventions

  • run yarn lint

SQLite

  1. Download the database file and place it under the <App root directory>/database folder.

  2. Make sure your .env has the following lines:

DB_CONNECTION=sqlite
DB_DATABASE=jasper_dev

Migration

  • Run adonis migration:run to generate the tables.
  • Run adonis migration:rollback to purge the tables.

Sqlite shell (Optional)

Windows(64-bit)

  1. Download the binaries and the command line tool and place them under C:\Windows\System32
  2. Open a command line tool from the <App root directory>/database and run sqlite3 jasper_dev.db

Populating the Database

  1. Save the following query in datanase/ as populate.sql
  2. Within the sqlite3 shell, run .read populate.sql. This will populate the database with some mock rooms whose schedules are hosted on the Outlook account.
insert into rooms (name, fullName, floor, tower, telephone, seats, capacity, projector, whiteboard, flipchart, audioConference, videoConference, surfaceHub, pc, extraEquipment, comment, calendar, state)
values("0ASIS", "IC CONF OTT-235 Queen-Oasis CONF IC", 0, "East", "Contact IT Service Desk", 22, 42, 1, 1, 0, 1, 1, 0, 1,"PC has Video"," ","insertCalendarHere", 1),
("101A (E)", "IC CONF OTT-235 Queen101A CONF IC", 1, "East", "343-291-3070", 6, 7, 0, 0, 0, 1, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("101B (E)", "IC CONF OTT-235 Queen101B CONF IC", 1, "East", "343-291-3069", 8, 8, 0, 0, 0, 1, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("105A (E)", "IC CONF OTT-235 Queen105A CONF IC", 1, "East", "343-291-3083", 10, 26, 0, 0, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("145A (E)", "IC CONF OTT-235 Queen145A CONF IC", 1, "East", "343-291-3248", 6, 7, 0, 0, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("165A (W)", "IC CONF OTT-235 Queen165A CONF IC", 1, "West", "343-291-2536", 6, 7, 0, 0, 0, 1, 0, 1, 1," ","(Collaboration Room)","insertCalendarHere", 1),
("174A (W)", "IC CONF OTT-235 Queen174A CONF IC", 1, "West", "343-291-3723", 7, 9, 0, 0, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("199B (W)", "IC CONF OTT-235 Queen199B CONF IC", 1, "West", "343-291-2424", 10, 14, 1, 1, 0, 1, 0, 0, 1,"Smartboard"," ","insertCalendarHere", 1),
("199C (W)", "IC CONF OTT-235 Queen199C CONF IC", 1, "West", "Contact IT Service Desk", 9, 10, 0, 1, 0, 1, 1, 0, 1,"2 PCS, 2 LED Displays"," ","insertCalendarHere", 1),
("231A (E)", "IC CONF OTT-235 Queen231A CONF IC", 2, "East", "343-291-2994", 10, 14, 0, 1, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("243A (E)", "IC CONF OTT-235 Queen243A CONF IC", 2, "East", "343-291-2738", 9, 17, 0, 1, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("243C (E)", "IC CONF OTT-235 Queen243C CONF IC", 2, "East", "343-291-2736", 10, 20, 0, 1, 1, 1, 0, 0, 1,"Plasma, Writeable Wall"," ","insertCalendarHere", 1),
("255D (W)", "IC CONF OTT-235 Queen255D CONF IC", 2, "West", "343-291-2768", 8, 8, 0, 0, 0, 0, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("259A (W)", "IC CONF OTT-235 Queen259A CONF IC", 2, "West", "343-291-2776", 8, 9, 0, 1, 0, 1, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("298B (W)", "IC CONF OTT-235 Queen298B CONF IC", 2, "West", "343-291-3040", 5, 5, 0, 0, 0, 1, 1, 0, 1,"LCD Smart TV","(Collaboration Room)","insertCalendarHere", 1),
("298C (W)", "IC CONF OTT-235 Queen298C CONF IC", 2, "West", "343-291-3041", 6, 10, 0, 0, 0, 1, 0, 0, 1,"TV"," ","insertCalendarHere", 1),
("299A (W)", "IC CONF OTT-235 Queen299A CONF IC", 2, "West", "343-291-1545", 12, 24, 0, 1, 0, 1, 0, 0, 1,"2 PCS, 2 Plasmas, Blueray"," ","insertCalendarHere", 1),
("331A (E)", "IC CONF OTT-235 Queen331A CONF IC", 3, "East", "343-291-6464", 12, 37, 1, 0, 0, 1, 1, 0, 1,"2 PCS, 2 Projectors, VOIP # 343-291-2205"," ","AQMkADAwATM3ZmYAZS0xZWQyLWU0ZDEtMDACLTAwCgBGAAADuaOGRiaWJUeLSSjCrWPpCwcAIgcoqDGsOEGJ8e9NcrEd7QAAAgEGAAAAIgcoqDGsOEGJ8e9NcrEd7QAAAg0oAAAA", 1),
("353A (W)", "IC CONF OTT-235 Queen353A CONF IC", 3, "West", "343-291-1409", 10, 25, 0, 1, 0, 1, 1, 0, 1,"LED Display"," ","insertCalendarHere", 1),
("398C (W)", "IC CONF OTT-235 Queen398C CONF IC", 3, "West", "343-291-1593", 6, 7, 1, 1, 0, 1, 0, 0, 1,"Smartboard"," ","insertCalendarHere", 1),
("398B (W)", "IC CONF OTT-235 Queen398B CONF IC", 3, "West", "343-291-1592", 7, 9, 1, 1, 0, 1, 0, 0, 1,"Projector, Smartboard"," ","insertCalendarHere", 1),
("399B (W)", "IC CONF OTT-235 Queen399B CONF IC", 3, "West", "343-291-1592", 4, 6, 0, 0, 1, 1, 0, 1, 1," "," ","AQMkADAwATM3ZmYAZS0xZWQyLWU0ZDEtMDACLTAwCgBGAAADuaOGRiaWJUeLSSjCrWPpCwcAIgcoqDGsOEGJ8e9NcrEd7QAAAgEGAAAAIgcoqDGsOEGJ8e9NcrEd7QAAAg0pAAAA", 1),
("3E Lobby", "IC CONF OTT-235 Queen-3E LOBBY CONF IC", 3, "East", "343-291-1402", 12, 28, 0, 1, 0, 1, 0, 0, 1,"2 PCS, 2 Smartboards"," ","insertCalendarHere", 1),
("3W Lobby", "IC CONF OTT-235 Queen-3W LOBBY CONF IC", 3, "West", "343-291-1596", 10, 27, 1, 1, 1, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("401A (E)", "IC CONF OTT-235 Queen401A CONF IC", 4, "East", "343-291-2076", 8, 10, 1, 0, 0, 1, 0, 1, 1," "," ","AQMkADAwATM3ZmYAZS0xZWQyLWU0ZDEtMDACLTAwCgBGAAADuaOGRiaWJUeLSSjCrWPpCwcAIgcoqDGsOEGJ8e9NcrEd7QAAAgEGAAAAIgcoqDGsOEGJ8e9NcrEd7QAAAg0qAAAA", 1),
("401B (E)", "IC CONF OTT-235 Queen401B CONF IC", 4, "East", "343-291-2077", 8, 18, 1, 1, 1, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("402A (E)", "IC CONF OTT-235 Queen402A CONF IC", 4, "East", "343-291-2078", 6, 8, 0, 1, 1, 1, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("551A (W)", "IC CONF OTT-235 Queen402A CONF IC", 5, "West", "Contact IT Service Desk", 8, 12, 0, 1, 0, 1, 1, 0, 1,"2 PCS, Smartboard","(Multi-purpose room)","insertCalendarHere", 1),
("567A (W)", "IC CONF OTT-235 Queen567A CONF IC", 5, "West", "Contact CIO", 6, 11, 0, 1, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("5W Lobby", "IC CONF OTT-235 Queen5WLOBBY CONF IC", 5, "West", "343-291-1860", 12, 27, 1, 1, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("645C (E)", "IC CONF OTT-235 Queen645C CONF IC", 6, "East", "343-291-1866", 10, 16, 0, 1, 1, 1, 1, 0, 1,"Smartboard TV"," ","insertCalendarHere", 1),
("660F (W)", "IC CONF OTT-235 Queen660F CONF IC", 6, "West", "343-291-1240", 13, 14, 0, 1, 1, 1, 0, 0, 1,"12 PCS, Smartboard","(Training room)","insertCalendarHere", 1),
("7E Lobby", "IC CONF OTT-235 Queen-7E LOBBY CONF IC", 7, "East", "343-291-1861", 12, 30, 1, 1, 1, 1, 0, 1, 1," ","(Multi-purpose room)","insertCalendarHere", 1),
("7W Lobby", "IC CONF OTT-235 Queen-7W LOBBY CONF IC", 7, "West", "343-291-1862", 12, 28, 1, 1, 1, 1, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("741F (E)", "IC CONF OTT-235 Queen741F CONF IC", 7, "East", "343-291-1881", 10, 10, 0, 1, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("752A (E)", "IC CONF OTT-235 Queen752A CONF IC", 7, "East", "343-291-3188", 16, 16, 0, 0, 1, 0, 0, 0, 0," "," ","insertCalendarHere", 1),
("799A (W)", "IC CONF OTT-235 Queen799A CONF IC", 7, "West", "343-291-3544", 10, 31, 0, 0, 1, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("831D (E)", "IC CONF OTT-235 Queen831D CONF IC", 8, "East", "343-291-2322", 8, 9, 0, 1, 0, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("902A (E)", "IC CONF OTT-235 Queen902A CONF IC", 9, "East", "343-291-1868", 8, 12, 0, 1, 1, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("903A (E)", "IC CONF OTT-235 Queen903A CONF IC", 9, "East", "343-291-1851", 6, 8, 0, 0, 0, 1, 0, 0, 1,"Smartboard"," ","insertCalendarHere", 1),
("903B (E)", "IC CONF OTT-235 Queen903B CONF IC", 9, "East", "343-291-1852", 10, 15, 0, 1, 1, 1, 0, 0, 1,"Plasma"," ","insertCalendarHere", 1),
("921D (E)", "IC CONF OTT-235 Queen921D CONF IC", 9, "East", "343-291-2144", 6, 9, 0, 1, 1, 1, 0, 1, 1," "," ","insertCalendarHere", 1),
("921E (E)", "IC CONF OTT-235 Queen921E CONF IC", 9, "East", "343-291-2151", 6, 12, 0, 1, 1, 4, 0, 1, 1," "," ","insertCalendarHere", 1),
("949A (E)", "IC CONF OTT-235 Queen949A CONF IC ", 9, "East", "Contact IT Service Desk", 22, 49, 1, 1, 1, 1, 1, 0, 1,"2 PCS, 2 Projectors"," ","insertCalendarHere", 1)

References


ESLint

VSCode

  • Go to extentions and download "ESLint"

Manual Testing

  • Type yarn lint

Ignoring ESLint [Not Recommended]

  • For in line use: // eslint-disable-line
  • For the whole file use: eslint no-use-before-define: 0 */ // --> OFF

References


Outlook

  1. Download this script and put it in database/. To execute the script, within the sqlite3 shell, run .read room.sql. This will populate the database with some mock rooms whose schedules are hosted on the Outlook account.

  2. Add these lines to the .env file:

  MICROSOFT_APP_ID=292802e3-a198-4e18-ab66-8ea5e7968922
  MICROSOFT_APP_PASSWORD=beguX64??cjmDDRVIJ676+!
  MICROSOFT_REDIRECT_URI=http://localhost:3333/authorize
  MICROSOFT_SCOPES=user.read calendars.readwrite openid profile offline_access 
  MICROSOFT_HOST=https://login.microsoftonline.com
  MICROSOFT_AUTHORIZE_ENDPOINT=common/oauth2/v2.0/authorize
  MICROSOFT_TOKEN_ENDPOINT=common/oauth2/v2.0/token
  1. To get access token from the Outlook account, go to http://localhost:3333/authenticate where you will be prompted to login. Use the following credentials (You will only have to do this once. The application will refresh the access token every half hour as long as it is running):

  2. You may log into Outlook using the above credentials view the schedules(calendars) of mock rooms.

Clone this wiki locally