Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement Create email template endpoint (Admin) #40 #75

Merged
merged 14 commits into from
Oct 24, 2023

Conversation

sathudeva7
Copy link
Contributor

Purpose

The purpose of this PR is to fix #40

Goals

This issue involves implementing an API to create email template. The endpoint should allow Admin to make a POST request to {{baseUrl}}/api/admin/emails/templates.

Approach

 const emailRepositroy = dataSource.getRepository(Email)

    const newEmailTemplate = new Email(recipient, subject, content, state)

    const savedEmailTemplate = await emailRepositroy.save(newEmailTemplate)

Screenshots

Checklist

  • This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Related PRs

Test environment

Learning

Comment on lines 6 to 9
recipient: string,
subject: string,
content: string,
state: EmailStatusTypes
Copy link
Member

Choose a reason for hiding this comment

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

Create email template only requires the content and subject. A sent email will have the data you mentioned above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted Thanks

Comment on lines 16 to 23
const newEmailTemplate = new Email(
'',
subject,
content,
EmailStatusTypes.SENT
)

const savedEmailTemplate = await emailRepositroy.save(newEmailTemplate)
Copy link
Member

Choose a reason for hiding this comment

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

Can you check the ERD here? https://drive.google.com/file/d/11KMgdNu2mSAm0Ner8UsSPQpZJS8QNqYc/view

Email templates are saved under the platform table. The email table is used to track the email that we are sending through the platform.

Copy link
Member

Choose a reason for hiding this comment

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

Any updates @sathudeva7?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have an issue on how to find platform to add the email templates in the platform

Copy link
Member

Choose a reason for hiding this comment

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

we have created a Platform entity. So you can use it the the same as you have used the emailRepositroy @sathudeva7

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes but how can we find the particular platform from db, because we didnt pass any platformId in the request query

Copy link
Member

Choose a reason for hiding this comment

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

we had a discussion regarding this. Can you create a new table to store the email templates? I will update the ERD as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Member

@anjula-sack anjula-sack left a comment

Choose a reason for hiding this comment

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

Good job! @sathudeva7

@anjula-sack anjula-sack merged commit b03fbb9 into sef-global:main Oct 24, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Create email template endpoint (Admin)
2 participants