Template.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. namespace bitforum.Constants
  2. {
  3. public class TemplateKey
  4. {
  5. public string Name { get; }
  6. public string Subject { get; }
  7. public string Content { get; }
  8. public TemplateKey(string name, string subject, string content)
  9. {
  10. Name = name;
  11. Subject = subject;
  12. Content = content;
  13. }
  14. }
  15. public static class Template
  16. {
  17. public static readonly TemplateKey RegisterEmailForm = new("회원가입 시", "register_email_form_title", "register_email_form_content");
  18. public static readonly TemplateKey RegistrationEmailForm = new("회원가입 완료", "registration_email_form_title", "registration_email_form_content");
  19. public static readonly TemplateKey ForgotPasswordEmailForm = new("비밀번호 재설정", "forgot_password_email_form_title", "forgot_password_email_form_content");
  20. public static readonly TemplateKey ChangedPasswordEmailForm = new("비밀번호 변경 완료", "changed_password_email_form_title", "changed_password_email_form_content");
  21. public static readonly TemplateKey WithdrawEmailForm = new("회원탈퇴 시", "withdraw_email_form_title", "withdraw_email_form_content");
  22. public static readonly TemplateKey EmailVerifyForm = new("이메일 변경 시", "email_verify_form_title", "email_verify_form_content");
  23. public static readonly TemplateKey ChangedEmailForm = new("이메일 변경 완료", "changed_email_form_title", "changed_email_form_content");
  24. }
  25. public interface IPlaceholder
  26. {
  27. Dictionary<string, string> ToDictionary();
  28. }
  29. public class Placeholders : IPlaceholder
  30. {
  31. private readonly Dictionary<string, string> _data = new();
  32. private Placeholders() { } // 생성자 직접 호출 방지
  33. // 회원가입 시
  34. public static Placeholders RegisterEmailForm(string email, string code) => new Placeholders { _data = { ["email"] = email, ["code"] = code } };
  35. // 회원가입 수락
  36. public static Placeholders RegistrationEmailForm(string email, string createdAt) => new Placeholders { _data = { ["email"] = email, ["createdAt"] = createdAt } };
  37. // 비밀번호 재설정
  38. public static Placeholders ForgotPasswordEmailForm(string email, string code) => new Placeholders { _data = { ["email"] = email, ["code"] = code } };
  39. // 비밀번호 변경 완료
  40. public static Placeholders ChangedPasswordEmailForm(string email, string createdAt) => new Placeholders { _data = { ["email"] = email, ["createdAt"] = createdAt } };
  41. // 회원탈퇴 시
  42. public static Placeholders WithdrawEmailForm(string email, string reason, string createdAt) => new Placeholders { _data = { ["email"] = email, ["reason"] = reason, ["createdAt"] = createdAt } };
  43. // 이메일 변경 시
  44. public static Placeholders EmailVerifyForm(string email, string link) => new Placeholders { _data = { ["email"] = email, ["link"] = link } };
  45. // 이메일 변경 완료
  46. public static Placeholders ChangedEmailForm(string email, string createdAt) => new Placeholders { _data = { ["email"] = email, ["createdAt"] = createdAt } };
  47. public Dictionary<string, string> ToDictionary() => _data;
  48. }
  49. }