KitaPlatzZentrale / kpz

1 stars 0 forks source link

Trigger MongoDB Event to send out email with Email Service #67

Closed hannogrimm closed 1 year ago

hannogrimm commented 1 year ago

@Darjusch Please add acceptance criteria and description here as you planned out.

Darjusch commented 1 year ago

Implementation of MongoDB Trigger in combination with AWS EventBridge and AWS Lambda for the following two functionalities: signUpToKitaEmail and signUpToServiceEmail.

Screenshot 2023-05-19 at 15 00 46

Acceptance criteria: Insert a document into the according collection and receive a respective email.

This is the document for singleKita

{
      "uuid": "0123456789",
      "email": "darjusch.schrand@code.berlin",
      "consentId": "abcdefg123456",
      "trackedKitas": [
        {
          "id": "kitaid123",
          "kitaName": "Kita A",
          "kitaAvailability": "May"
        },
        {
          "id": "kitaid456",
          "kitaName": "Kita B",
          "kitaAvailability": null
        }
      ],
      "createdAt": "2023-05-18T00:00:00Z",
      "consentedAt": "2023-05-18T00:00:00Z",
      "revokedAt": null
    }

This is the document for the service:

{
      "uuid": "0123456789",
      "consentId": "test",
      "email": "darjusch.schrand@code.berlin",
      "fullAddress": "123 Main St, City",
      "desiredStartingMonth": "September",
      "actualOrExpectedBirthMonth": "June",
      "createdAt": "2023-05-18T00:00:00Z",
      "consentedAt": "2023-05-18T00:00:00Z",
      "revokedAt": null
    }

I sent you the invite for the DevMongoDB There is one collection called user -> This is for singleKitaSignup The other collection is called emailService. -> This is for the service :D

Screenshot 2023-05-19 at 15 07 50

If you want to receive an Email you need to change the email in the above to yours, in case you didn't add it to the SES service as whitelisted you also need to do that.