54 lines
1.5 KiB
Markdown
54 lines
1.5 KiB
Markdown
# Condition Check Reminder Lambda
|
|
|
|
Sends email reminders to owners and renters to complete condition checks at key points in the rental lifecycle.
|
|
|
|
## Check Types
|
|
|
|
| Check Type | Recipient | Timing |
|
|
|------------|-----------|--------|
|
|
| `pre_rental_owner` | Owner | 24 hours before rental start |
|
|
| `rental_start_renter` | Renter | At rental start |
|
|
| `rental_end_renter` | Renter | At rental end |
|
|
| `post_rental_owner` | Owner | 24 hours after rental end |
|
|
|
|
## Local Development
|
|
|
|
### Install Dependencies
|
|
|
|
```bash
|
|
cd lambdas/shared && npm install
|
|
cd ../conditionCheckReminder && npm install
|
|
```
|
|
|
|
### Set Up Environment
|
|
|
|
```bash
|
|
cp .env.example .env.dev
|
|
# Edit .env.dev with your DATABASE_URL
|
|
```
|
|
|
|
### Run Locally
|
|
|
|
```bash
|
|
# Default: rental ID 1, check type pre_rental_owner
|
|
npm run local
|
|
|
|
# Specify rental ID and check type
|
|
node -r dotenv/config test-local.js dotenv_config_path=.env.dev 123 rental_start_renter
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
| Variable | Description | Example |
|
|
|----------|-------------|---------|
|
|
| `DATABASE_URL` | PostgreSQL connection string | `postgresql://user:pass@localhost:5432/rentall` |
|
|
| `FRONTEND_URL` | Frontend URL for email links | `http://localhost:3000` |
|
|
| `SES_FROM_EMAIL` | Sender email address | `noreply@villageshare.app` |
|
|
| `EMAIL_ENABLED` | Enable/disable email sending | `false` |
|
|
| `SCHEDULE_GROUP_NAME` | EventBridge schedule group | `condition-check-reminders-dev` |
|
|
| `AWS_REGION` | AWS region | `us-east-1` |
|
|
|
|
## Deployment
|
|
|
|
See [infrastructure/cdk/README.md](../../infrastructure/cdk/README.md) for deployment instructions.
|