This is a very simple backend for the Gaston project.
Implemented via AWS API Gateway. Please note that OPTIONS
requests are for CORS preflight requests.
GET /records/{record_id}
OPTIONS /records/{record_id}
GET /records
OPTIONS /records
PUT /records/{record_id}/review
OPTIONS /records/{record_id}/review
GET /categories
OPTIONS /categories
Identifier | Description | Configuration variables |
---|---|---|
banorte_email.handle |
This function is triggered when an email from Banorte arrives via a SES driven SNS subscription. It parses the email using banes in order to create and insert a record in a DynamoDB table. | OWNER_ID |
record.get_records |
This function fetches all records. | OWNER_ID, GET_RECORDS_QUERY_LIMIT |
record.get_record |
This function gets a record by id. | OWNER_ID |
record_review.put_record_review |
This function creates a review for a given record. | OWNER_ID |
category.get_categories |
This function fetches all categories. Currently all the categories are hardcoded. | None |
- OWNER_ID: Sets the
owner_id
of the record when querying or creating. - GET_RECORDS_QUERY_LIMIT: Sets the number of records returned in the response before paginating.
The test suite is composed mainly of integration tests and it depends on DynamoDB local.
In order to run the tests you should:
- Start DynamoDB local:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
- Run:
pytest
.
The repository contains simple scripts to manage the functions.
Build
scripts/lambda-build.sh -f $FUNCTION_PATH
Create
scripts/lambda-create.sh -n $FUNCTION_NAME -r $ROLE_ARN -p build/function.zip -h $NAMESPACE.FUNCTION_HANDLER
Update
scripts/lambda-update.sh -n $FUNCTION_NAME -p build/function.zip