Skip to content

feat: setup email workflows across admins env#72

Merged
ayush00git merged 11 commits into
mainfrom
feat/email-wkfls
May 30, 2026
Merged

feat: setup email workflows across admins env#72
ayush00git merged 11 commits into
mainfrom
feat/email-wkfls

Conversation

@ayush00git
Copy link
Copy Markdown
Owner

@ayush00git ayush00git commented May 30, 2026

Closes #44
Closes #74

Changes made -

  1. removed adminType from the frontend route as it wasn't necessary.
  2. Set up email workflows across the admin environment, thinking to include the user who made the post as well.
    We've used go-routines to send emails to not block any ongoing user query.
			go func() {
				// search for email of ae
				var position models.PositionType
				if post.TypeOfPost == "Civil" {
					position = models.TypeAECivil
				} else {
					position = models.TypeAEElectrical
				}
				var ae models.Admin
				result := h.DB.Where("position = ?", position).Take(&ae)
				if result.Error != nil {
		       	 	log.Printf("failed to send AE mail for post %d", post.ID)
					return
				}
				if err := services.SendPostMailToAdmins(ae.Email, postURL); err != nil {
		       	 	log.Printf("failed to send AE mail for post %d: %s", post.ID, err)
					return
				}
			} ()
  1. As the post is created it is directly mailed to the civil/electrical type XEN depending upon the type_of_post field in the post schema.

@ayush00git
Copy link
Copy Markdown
Owner Author

Send a custom message as well to the admins like - completion, closed, review..

@ayush00git ayush00git merged commit 315fd33 into main May 30, 2026
1 check passed
@ayush00git ayush00git deleted the feat/email-wkfls branch May 30, 2026 17:47
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.

[BUG] xen should be able to close the "Resolved_JE" type posts [FEAT]: set up emails across admin workflows

1 participant