text clean up
This commit is contained in:
@@ -4,12 +4,12 @@ Sends email reminders to owners and renters to complete condition checks at key
|
||||
|
||||
## 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 |
|
||||
| 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
|
||||
|
||||
@@ -22,11 +22,6 @@ cd ../conditionCheckReminder && npm install
|
||||
|
||||
### Set Up Environment
|
||||
|
||||
```bash
|
||||
cp .env.example .env.dev
|
||||
# Edit .env.dev with your DATABASE_URL
|
||||
```
|
||||
|
||||
### Run Locally
|
||||
|
||||
```bash
|
||||
@@ -36,18 +31,3 @@ 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.
|
||||
|
||||
@@ -1,41 +1,29 @@
|
||||
/**
|
||||
* Local test script for the condition check reminder lambda
|
||||
*
|
||||
* Usage:
|
||||
* 1. Set environment variables (or create a .env file)
|
||||
* 2. Run: node test-local.js
|
||||
*
|
||||
* Required environment variables:
|
||||
* - DATABASE_URL: PostgreSQL connection string
|
||||
* - FRONTEND_URL: Frontend URL for email links
|
||||
* - SES_FROM_EMAIL: Email sender address
|
||||
* - EMAIL_ENABLED: Set to 'false' to skip actual email sending
|
||||
* - SCHEDULE_GROUP_NAME: EventBridge schedule group name
|
||||
* - AWS_REGION: AWS region
|
||||
*/
|
||||
|
||||
const { handler } = require('./index');
|
||||
const { handler } = require("./index");
|
||||
|
||||
// Test event - modify these values as needed
|
||||
const testEvent = {
|
||||
rentalId: parseInt(process.argv[2]) || 1, // Pass rental ID as CLI arg or default to 1
|
||||
checkType: process.argv[3] || 'pre_rental_owner' // Options: pre_rental_owner, rental_start_renter, rental_end_renter, post_rental_owner
|
||||
rentalId: parseInt(process.argv[2]) || 1, // Pass rental ID as CLI arg or default to 1
|
||||
checkType: process.argv[3] || "pre_rental_owner", // Options: pre_rental_owner, rental_start_renter, rental_end_renter, post_rental_owner
|
||||
};
|
||||
|
||||
console.log('Running condition check reminder lambda locally...');
|
||||
console.log('Event:', JSON.stringify(testEvent, null, 2));
|
||||
console.log('---');
|
||||
console.log("Running condition check reminder lambda locally...");
|
||||
console.log("Event:", JSON.stringify(testEvent, null, 2));
|
||||
console.log("---");
|
||||
|
||||
handler(testEvent)
|
||||
.then(result => {
|
||||
console.log('---');
|
||||
console.log('Success!');
|
||||
console.log('Result:', JSON.stringify(result, null, 2));
|
||||
.then((result) => {
|
||||
console.log("---");
|
||||
console.log("Success!");
|
||||
console.log("Result:", JSON.stringify(result, null, 2));
|
||||
process.exit(0);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('---');
|
||||
console.error('Error:', err.message);
|
||||
.catch((err) => {
|
||||
console.error("---");
|
||||
console.error("Error:", err.message);
|
||||
console.error(err.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user