-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: send projet creation email #305
Merged
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e33d813
feat: send mail to user with no activity since 10 days from signup
mehdilouraoui c89f0bf
update vars name
mehdilouraoui 1bd30e1
update mail filter
mehdilouraoui 91f3d63
merge main and fix conflicts
mehdilouraoui c64a3de
Merge branch 'feat/csm-no-activity-since-signup' into feat/csm-batch
mehdilouraoui 1e464e8
update message response
mehdilouraoui 47f0b90
Merge branch 'feat/csm-no-activity-since-signup' into feat/csm-batch
mehdilouraoui fe27632
feat: ajout d'un batch
mehdilouraoui e1c7424
update return message
mehdilouraoui 66e6966
Merge branch 'feat/csm-no-activity-since-signup' into feat/csm-batch
mehdilouraoui b919840
feat: csm batch
mehdilouraoui dad713c
change var name
mehdilouraoui 80b78a1
add flexibility for inactivity days
mehdilouraoui dd259d6
change params wording
mehdilouraoui 78b2e49
edit cron json
mehdilouraoui 60b4281
fix: update env var
mehdilouraoui 83aae31
fix: update logs
mehdilouraoui dd8da87
feat: send projet creation email
rtaieb 4e67fea
fix: get user with no activity query (wip)
mehdilouraoui b30c183
Merge branch 'feat/csm-batch' into feat/csm-no-activity-since-signup
mehdilouraoui 33fdede
fix: update logic
mehdilouraoui baf1ff6
feat: add user id in email
mehdilouraoui cb1d7ab
feat: add created_at user in params
mehdilouraoui db8461b
feat: remove useless script file and merge last PR
mehdilouraoui b19a2c5
update following comments
mehdilouraoui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
prisma/migrations/20241210154607_add_email_template/migration.sql
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,10 @@ | ||
-- AlterEnum | ||
-- This migration adds more than one value to an enum. | ||
-- With PostgreSQL versions 11 and earlier, this is not possible | ||
-- in a single migration. This can be worked around by creating | ||
-- multiple migrations, each migration adding only one value to | ||
-- the enum. | ||
|
||
|
||
ALTER TYPE "emailType" ADD VALUE 'projetCreationRandomRex'; | ||
ALTER TYPE "emailType" ADD VALUE 'projetCreationFixedRex'; |
14 changes: 14 additions & 0 deletions
14
prisma/migrations/20241211100239_change_email_type_for_projet_creation/migration.sql
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,14 @@ | ||
/* | ||
Warnings: | ||
|
||
- The values [projetCreationRandomRex,projetCreationFixedRex] on the enum `emailType` will be removed. If these variants are still used in the database, this will fail. | ||
|
||
*/ | ||
-- AlterEnum | ||
BEGIN; | ||
CREATE TYPE "emailType_new" AS ENUM ('projetCreation', 'projetInvitation', 'projetRequestAccess', 'projetAccessGranted', 'projetAccessDeclined', 'contactMessageSent', 'welcomeMessage'); | ||
ALTER TABLE "email" ALTER COLUMN "type" TYPE "emailType_new" USING ("type"::text::"emailType_new"); | ||
ALTER TYPE "emailType" RENAME TO "emailType_old"; | ||
ALTER TYPE "emailType_new" RENAME TO "emailType"; | ||
DROP TYPE "emailType_old"; | ||
COMMIT; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { customCaptureException } from "@/src/lib/sentry/sentryCustomMessage"; | ||
import { EmailService } from "@/src/services/brevo"; | ||
|
||
const sendCsmEmails = async () => { | ||
try { | ||
if (process.env.SEND_CSM_EMAILS !== "true") { | ||
console.log("L'envoi de mail CSM est désactivé pour cet environnement'."); | ||
} else { | ||
await new EmailService().sendProjetCreationEmail(); | ||
} | ||
} catch (error) { | ||
customCaptureException("Erreur lors du batch d'envoi des mails CSM.", error); | ||
process.exit(1); | ||
} | ||
}; | ||
|
||
sendCsmEmails(); |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce fichier sera à supprimer avec la PR sur le batch