-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## RecNet auto-release action This is an auto-generated PR by recnet-release-action 🤖 Please make sure to test your changes in staging before merging. ## Related Issues - #260 - #261 ## Related PRs - #350 - #351 - #349 ## Staging links recnet-web: [https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app](https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app) recnet-api: [https://dev-api.recnet.io/api](https://dev-api.recnet.io/api)
- Loading branch information
Showing
45 changed files
with
1,480 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "recnet-api", | ||
"version": "1.8.1" | ||
"version": "1.8.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# Database connection details | ||
DB_NAME="" | ||
DB_USER="" | ||
DB_HOST="" | ||
DB_PORT="" | ||
DB_PASSWORD="" | ||
|
||
export PGPASSWORD=$DB_PASSWORD | ||
|
||
# Query to select all user IDs and insert into Subscription table | ||
psql -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -p "$DB_PORT" -t -c "SELECT id FROM recnet.\"User\";" | while read -r userId; do | ||
if [[ -n "$userId" ]]; then | ||
# Insert a new subscription for each user ID | ||
psql -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -p "$DB_PORT" -c \ | ||
"INSERT INTO recnet.\"Subscription\" (\"userId\", \"type\", \"channel\") VALUES ('$userId', 'WEEKLY_DIGEST', 'EMAIL') ON CONFLICT DO NOTHING;" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
apps/recnet-api/src/database/repository/weekly-digest-cron-log.repository.type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
export type WeeklyDigestCronResult = { | ||
successCount: number; | ||
errorUserIds: string[]; | ||
email: { | ||
successCount: number; | ||
errorUserIds: string[]; | ||
}; | ||
slack: { | ||
successCount: number; | ||
errorUserIds: string[]; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
export const MAX_REC_PER_MAIL = 5; | ||
export const EMAIL_RETRY_DURATION_MS = 1000; | ||
|
||
export const WEEKLY_DIGEST_CRON = "0 0 0 * * 3"; | ||
export const EMAIL_RETRY_LIMIT = 3; | ||
|
||
export const RETRY_LIMIT = 3; | ||
|
||
export const SLEEP_DURATION_MS = 1000; | ||
|
||
// providers | ||
export const MAIL_TRANSPORTER = "MAIL_TRANSPORTER"; | ||
export const EMAIL_DEV_HANDLE_WHITELIST = ["joannechen1223", "swh00tw"]; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,13 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { ConfigService } from "@nestjs/config"; | ||
|
||
import { DbRepositoryModule } from "@recnet-api/database/repository/db.repository.module"; | ||
|
||
import { MAIL_TRANSPORTER } from "./email.const"; | ||
import { EmailController } from "./email.controller"; | ||
import { EmailService } from "./email.service"; | ||
import { Transporter } from "./email.type"; | ||
import EmailDevTransporter from "./transporters/email.dev.transporters"; | ||
import EmailTransporter from "./transporters/email.transporters"; | ||
|
||
const transporterFactory = (configService: ConfigService): Transporter => { | ||
const nodeEnv = configService.get("app").nodeEnv; | ||
const nodemailerConfig = configService.get("nodemailer"); | ||
|
||
return nodeEnv === "production" | ||
? new EmailTransporter(nodemailerConfig) | ||
: new EmailDevTransporter(nodemailerConfig); | ||
}; | ||
import EmailTransporter from "./transporters/email.transporter"; | ||
|
||
@Module({ | ||
controllers: [EmailController], | ||
providers: [ | ||
EmailService, | ||
{ | ||
provide: MAIL_TRANSPORTER, | ||
useFactory: transporterFactory, | ||
inject: [ConfigService], | ||
}, | ||
], | ||
providers: [EmailService, EmailTransporter], | ||
imports: [DbRepositoryModule], | ||
exports: [EmailService], | ||
}) | ||
export class EmailModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.