-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7436a0e
commit 326e68b
Showing
37 changed files
with
510 additions
and
368 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,13 @@ | ||
import * as admin from "firebase-admin"; | ||
import * as functions from "firebase-functions"; | ||
import axios from "axios"; | ||
import { Configuration } from "./model"; | ||
import { getConfiguration } from "./v3/infrastructure/getConfiguration"; | ||
import { sendToWebhooks } from "./v3/domain/sendToWebhooks"; | ||
|
||
const firestore = admin.firestore(); | ||
|
||
export const onSendChangesToWebHooks = functions.firestore | ||
.document("companies-2025/{companyId}") | ||
.onUpdate(async (changes) => { | ||
const configurationFromFirestore = await firestore | ||
.doc("editions/2025") | ||
.get() | ||
.then((configuration) => { | ||
return configuration.data() as Configuration; | ||
}); | ||
|
||
if (configurationFromFirestore.webhooks?.length! > 0) { | ||
for (let webhook of configurationFromFirestore.webhooks!) { | ||
console.log( | ||
`Sending to webhook ${webhook} information about ${ | ||
changes.after.data().name | ||
}` | ||
); | ||
await axios.post(webhook, { | ||
id: changes.after.id, | ||
data: changes.after.data(), | ||
}); | ||
} | ||
} | ||
const configuration = await getConfiguration(firestore); | ||
sendToWebhooks(configuration, changes); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { Settings } from "../../model"; | ||
import { Configuration } from "../../model"; | ||
|
||
export default (company: Record<string, any>, settings: Settings) => { | ||
export default (company: Record<string, any>, configuration: Configuration) => { | ||
return { | ||
subject: `Partenariat ${settings.gdg.event} ${settings.convention.edition}: Relance Convention à Signer`, | ||
subject: `Partenariat ${configuration.gdg.event} ${configuration.convention.edition}: Relance Convention à Signer`, | ||
body: ` | ||
Bonjour | ||
<br><br> | ||
Nous vous envoyons cet email afin de vous annoncer que nous sommes toujours dans l'attente de votre signature pour la convention de partenariat pour ${settings.gdg.event}. | ||
Nous vous envoyons cet email afin de vous annoncer que nous sommes toujours dans l'attente de votre signature pour la convention de partenariat pour ${configuration.gdg.event}. | ||
<br><br> | ||
Une fois signée, vous pouvez nous la retourner par email, ou la sauvegarde sur votre espace dédié. | ||
<br><br> | ||
Nous restons à votre disposition pour tout complément via l'adresse email ${settings.mail.from}. | ||
Nous restons à votre disposition pour tout complément via l'adresse email ${configuration.mail.from}. | ||
<br><br> | ||
Cordialement | ||
<br><br> | ||
${settings.mail.signature} ${settings.convention.edition} | ||
${configuration.mail.signature} ${configuration.convention.edition} | ||
`, | ||
}; | ||
}; |
12 changes: 6 additions & 6 deletions
12
functions/src/emails/template/relanceInformationsComplementaires.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,20 +1,20 @@ | ||
import { Settings } from "../../model"; | ||
import { Configuration } from "../../model"; | ||
|
||
export default (partner: Record<string, any>, settings: Settings) => { | ||
export default (partner: Record<string, any>, configuration: Configuration) => { | ||
return { | ||
subject: `Partenariat ${settings.gdg.event} ${settings.convention.edition}: Relance Informations Complémentaires`, | ||
subject: `Partenariat ${configuration.gdg.event} ${configuration.convention.edition}: Relance Informations Complémentaires`, | ||
body: ` | ||
Bonjour | ||
<br><br> | ||
Nous vous envoyons cet email afin de vous annoncer que nous sommes toujours dans l'attente d'informations complémentaires afin d'établir la convention et la facture pour ${settings.gdg.event}. | ||
Nous vous envoyons cet email afin de vous annoncer que nous sommes toujours dans l'attente d'informations complémentaires afin d'établir la convention et la facture pour ${configuration.gdg.event}. | ||
<br><br> | ||
Vous pouvez renseigner ces informations sur votre espace dédié. | ||
<br><br> | ||
Nous restons à votre disposition pour tout complément via l'adresse email ${settings.mail.from}. | ||
Nous restons à votre disposition pour tout complément via l'adresse email ${configuration.mail.from}. | ||
<br><br> | ||
Cordialement | ||
<br><br> | ||
${settings.mail.signature} ${settings.convention.edition} | ||
${configuration.mail.signature} ${configuration.convention.edition} | ||
`, | ||
}; | ||
}; |
Oops, something went wrong.