Skip to content
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

Dw add acceptance email #78

Open
wants to merge 3 commits into
base: ns-add-conf-email
Choose a base branch
from

Conversation

denniwang
Copy link

image
^ screenshot of what the email looks like.

  • created lambda function for sending acceptance letters
  • added trigger for sending letters in application service, triggers if application status is changed to accepted
  • some formatting

throw new Error('Error posting application');
}
const user = await this.userService.getUser(applicationData.userId);
const site = await this.siteService.getSite(applicationData.siteId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const site = await this.siteService.getSite(applicationData.siteId);
const site = await this.siteService.getSite(applicationData.siteId.N);

Don't forget the .N to extract the number!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im getting this ts error when I add .N,
image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added .N to the userid and siteid from the updateapplication function and that seemed to work because thats the one retrieving from dynamo

if (result.$metadata.httpStatusCode !== 200) {
throw new Error('Error posting application');
}
const user = await this.userService.getUser(applicationData.userId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const user = await this.userService.getUser(applicationData.userId);
const user = await this.userService.getUser(applicationData.userId.N);

Same thing here

data?: { [key: string]: any },
): UserModel {
const siteIds = data['siteIds'].L.map((item) => Number(item.N)) ?? [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const siteIds = data['siteIds'].L.map((item) => Number(item.N)) ?? [];
const siteIds = Array.isArray(data["siteIds"]?.L)
? data["siteIds"].L.map(item => Number(item.N))
: [];

You might have to make this change to remove this error: Cannot read properties of undefined (reading 'map')

Copy link

@hams7504 hams7504 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR seems close to being done! Just a couple things left

Copy link

@mahekagg mahekagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also make sure that the userId of the user is given to the user in the acceptance email as they will be using their userId to register/create their account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants