Prerequisites
ThalliumEli is the API Microservice backend, which receives requests from, processes and then returns responses to BariumNahum.
ThalliumEliStack is declared in the faithinventory-com-infrastructure repo.
This repo contains the code for the ThalliumEliLambda resource, which contains the business logic that touches other ThalliumEliStack resourcs such as ThalliumEliInventoryItemsTable, ThalliumEliInventoryAdminsTable and ThalliumEliSESCWEventDestination.
To initialize this repo, you'll have to install the node modules. Run the following command. You'll only have to do this step once.
nvm use
npm install
- To deploy this lambda code, run this command.
sh ./scripts/deploy.sh <environment> <awsProfile>
API Documentation is provided via a Swagger Schema here:
https://faithinventory.com/api/1/docs/
This document can be updated by editing the corresponding Swagger Source file in the docs folder. Please check out it's README for further instructions.
Unit Tests can be performed through Jest, and can be edited in the test/thalliumeli-api-v1/index.unit.js
file.
To invoke the unit test code, follow these steps:
- First, install Jest into the test folder. You will only need to do this once.
cd ./test
npm install
cd ../
- Invoke the Jest unit tests:
npm run test:units
To invoke the integration tests, run the following command:
npm run test:integrations -- --apiKey=<apiKey> --email=<email> [--environment=<environment>]
The <environment>
argument defaults to dev
.
The api key restricts requests to all /api/1/admin/
routes to be performed by clients of whom are supplied an api key.
The Api Key value can be found at:
https://console.aws.amazon.com/apigateway/home?region=us-east-1#/api-keys/
Under <environment>-ThalliumEliApiKey
Please note, if the app doesn't have any inventory items, then the specific test:
"When a user visits the homepage" > "should get all inventory items"
will always fail because it is looking for items to return.
The issue will resolve itself on all subsequent runs of this test.
In addition, integration tests can be performed using an API Tool like Paw or Postman.
FaithInventory is curated by a collection of authors who are interested in sharing insights and discoveries with the broader community scattered among the nations. At the moment, Site Authors are the only type of user that can authenticate.
This application has pre-selected Administrators, also referred to as Site Authors, and is not designed for them to self-register.
It's designed for a Site Author to be registered, selectively, by the AWS Administrator. In order for an author to receive a magic link request, The AWS Administrator must follow the below instructions, first.
- Navigate to https://console.aws.amazon.com/ses/home?region=us-east-1#verified-senders-email:
- Click, 'Verify a New Email Address'
- In the input field, add the author's email address, then click, 'Verify This Email Address'
- Have the Author click the link in the automatic email that gets sent to the email address. This now verifies the email address.
- Navigate to (https://console.aws.amazon.com/dynamodb/home?region=us-east-1#tables:)[https://console.aws.amazon.com/dynamodb/home?region=us-east-1#tables:]
- Click '
<environmment>-ThalliumEliInventoryAdminsTable
' > 'Items' - Click, 'Create Item', then add the following values, replacing
<email>
with the Site Author's email address.
name | value |
---|---|
partitionKey | 'published' |
<email> |
- Click, 'Save'.
- Now, make a
GET
request to<environment>.faithinventory.com/api/1/inventory/admin/magic-link
. The author should now receive a Magic Link that they can click to sign into the PlatinumEnoch author area at<environment>.faithinventory.com/author
.