airqo-platform / airqo-platform/AirQo-api
Fix: Pass preferences parameter to generateAlertEmailContent in air-quality-alerts-job
- 主要語言
- JavaScript
- 星號
- 26
- 分支
- 24
- 平均合併
- 5 小時 36 分鐘
- 30 天內合併 PR
- 81
描述
## Issue Description
The `generateAlertEmailContent` function in `src/auth-service/bin/jobs/air-quality-alerts-job.js` expects three parameters: `spikes`, `userName`, and `preferences`. However, in the current implementation, only two arguments are being passed when calling this function, which could lead to runtime errors when the function tries to access the `preferences` parameter.
### Current Implementation
```javascript
const emailPromises = batch.map(async ({ user, spikes }) => {
const content = generateAlertEmailContent(spikes, user.firstName);
```
### Expected Implementation
```javascript
const emailPromises = batch.map(async ({ user, spikes, preferences }) => {
const content = generateAlertEmailContent(spikes, user.firstName, preferences);
```
### Impact
- Potential runtime errors when accessing preferences data
- Incorrect threshold values in email alerts
- Missing site-specific preferences in the generated email content
### References
- Pull Request: https://github.com/airqo-platform/AirQo-api/pull/4204
- Discussion: https://github.com/airqo-platform/AirQo-api/pull/4204#discussion_r1921239185
貢獻指南
評估
這個 Issue 還沒有評估資料。