Config.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. namespace Domain.Entities.Common
  2. {
  3. public sealed class Config
  4. {
  5. public int ID { get; private set; }
  6. public DateTime LastUpdatedAt { get; private set; } = DateTime.UtcNow;
  7. public byte[] RowVersion { get; private set; } = [];
  8. public BasicConfig Basic { get; private set; } = new();
  9. public MetaConfig Meta { get; private set; } = new();
  10. public CompanyConfig Company { get; private set; } = new();
  11. public AccountConfig Account { get; private set; } = new();
  12. public EmailTemplateConfig EmailTemplate { get; private set; } = new();
  13. public ExternalApiConfig External { get; private set; } = new();
  14. public PaymentConfig Payment { get; private set; } = new();
  15. private Config() { }
  16. public static Config Create()
  17. {
  18. return new();
  19. }
  20. public void Update(
  21. BasicConfig basic,
  22. MetaConfig meta,
  23. CompanyConfig company,
  24. AccountConfig account,
  25. EmailTemplateConfig emailTemplate,
  26. ExternalApiConfig external,
  27. PaymentConfig payment
  28. ) {
  29. Basic = basic ?? throw new ArgumentNullException(nameof(basic));
  30. Meta = meta ?? throw new ArgumentNullException(nameof(meta));
  31. Company = company ?? throw new ArgumentNullException(nameof(company));
  32. Account = account ?? throw new ArgumentNullException(nameof(account));
  33. EmailTemplate = emailTemplate ?? throw new ArgumentNullException(nameof(emailTemplate));
  34. External = external ?? throw new ArgumentNullException(nameof(external));
  35. Payment = payment ?? throw new ArgumentNullException(nameof(payment));
  36. LastUpdatedAt = DateTime.UtcNow;
  37. }
  38. }
  39. #region Owned Groups
  40. // ==================================================
  41. // 기본 정보 (Basic)
  42. // ==================================================
  43. public sealed class BasicConfig
  44. {
  45. public string? SiteName { get; set; }
  46. public string? RootID { get; set; }
  47. public string? FromEmail { get; set; }
  48. public string? FromName { get; set; }
  49. public string? SmtpServer { get; set; }
  50. public int? SmtpPort { get; set; }
  51. public bool? SmtpEnableSsl { get; set; }
  52. public string? SmtpUsername { get; set; }
  53. public string? SmtpPasswordEnc { get; set; }
  54. public string? AdminWhiteIpList { get; set; }
  55. public string? FrontWhiteIpList { get; set; }
  56. public string? BlockAlertTitle { get; set; }
  57. public string? BlockAlertContent { get; set; }
  58. public bool IsMaintenance { get; set; } = false;
  59. public string? MaintenanceContent { get; set; }
  60. public string? DefaultPaymentGateway { get; set; }
  61. public decimal? DefaultFeeAmount { get; set; }
  62. public decimal? DefaultFeeRate { get; set; }
  63. }
  64. // ==================================================
  65. // 메타 태그 (Meta)
  66. // ==================================================
  67. public sealed class MetaConfig
  68. {
  69. public string? Keywords { get; set; }
  70. public string? Description { get; set; }
  71. public string? Author { get; set; }
  72. public string? Viewport { get; set; }
  73. public string? ApplicationName { get; set; }
  74. public string? Generator { get; set; }
  75. public string? Robots { get; set; }
  76. public string? Adds { get; set; }
  77. }
  78. // ==================================================
  79. // 회사 정보 (Company)
  80. // ==================================================
  81. public sealed class CompanyConfig
  82. {
  83. public string? Name { get; set; }
  84. public string? RegNo { get; set; }
  85. public string? Owner { get; set; }
  86. public string? Tel { get; set; }
  87. public string? Fax { get; set; }
  88. public string? RetailSaleNo { get; set; }
  89. public string? AddedSaleNo { get; set; }
  90. public string? ZipCode { get; set; }
  91. public string? Hosting { get; set; }
  92. public string? AdminName { get; set; }
  93. public string? AdminEmail { get; set; }
  94. public string? SiteUrl { get; set; }
  95. public string? BankCode { get; set; }
  96. public string? BankOwner { get; set; }
  97. public string? BankNumber { get; set; }
  98. }
  99. // ==================================================
  100. // 회원가입 설정 (Account)
  101. // ==================================================
  102. public sealed class AccountConfig
  103. {
  104. // 회원 가입 시
  105. public bool IsRegisterBlock { get; set; } = false;
  106. public bool IsRegisterEmailAuth { get; set; } = false;
  107. public ushort? PasswordMinLength { get; set; }
  108. public ushort? PasswordUppercaseLength { get; set; }
  109. public ushort? PasswordNumbersLength { get; set; }
  110. public ushort? PasswordSpecialcharsLength { get; set; }
  111. public string? DeniedEmailList { get; set; }
  112. public string? DeniedNameList { get; set; }
  113. // 회원 수정 시
  114. public ushort? ChangeEmailDay { get; set; }
  115. public ushort? ChangeNameDay { get; set; }
  116. public ushort? ChangeSummaryDay { get; set; }
  117. public ushort? ChangeIntroDay { get; set; }
  118. public ushort? ChangePasswordDay { get; set; }
  119. // 로그인 시
  120. public ushort? MaxLoginTryCount { get; set; }
  121. public ushort? MaxLoginTryLimitSecond { get; set; }
  122. }
  123. // ==================================================
  124. // 알림 발송 양식 - 이메일 (EmailTemplate)
  125. // ==================================================
  126. public sealed class EmailTemplateConfig
  127. {
  128. public string? RegisterEmailFormTitle { get; set; }
  129. public string? RegisterEmailFormContent { get; set; }
  130. public string? RegistrationEmailFormTitle { get; set; }
  131. public string? RegistrationEmailFormContent { get; set; }
  132. public string? ResetPasswordEmailFormTitle { get; set; }
  133. public string? ResetPasswordEmailFormContent { get; set; }
  134. public string? ChangedPasswordEmailFormTitle { get; set; }
  135. public string? ChangedPasswordEmailFormContent { get; set; }
  136. public string? WithdrawEmailFormTitle { get; set; }
  137. public string? WithdrawEmailFormContent { get; set; }
  138. public string? EmailVerifyFormTitle { get; set; }
  139. public string? EmailVerifyFormContent { get; set; }
  140. public string? ChangedEmailFormTitle { get; set; }
  141. public string? ChangedEmailFormContent { get; set; }
  142. }
  143. // ==================================================
  144. // 외부 API 설정 (External)
  145. // ==================================================
  146. public sealed class ExternalApiConfig
  147. {
  148. /** YouTube **/
  149. public string? YouTubeApiKeyEnc { get; set; }
  150. public string? YouTubeApiName { get; set; }
  151. /** 구글 **/
  152. public string? GoogleClientId { get; set; }
  153. public string? GoogleClientSecretEnc { get; set; }
  154. public string? GoogleAppId { get; set; }
  155. /** 다날 페이 **/
  156. //[Comment("Danal 결제 환경")]
  157. //public string? DanalPayMode { get; set; }
  158. //[Comment("Danal Test CPID")]
  159. //public string? DanalTestCpid { get; set; }
  160. //[Comment("Danal Test Client Key (암호화 저장 권장)")]
  161. //public string? DanalTestClientKeyEnc { get; set; }
  162. //[Comment("Danal Test Secret Key (암호화 저장 권장)")]
  163. //public string? DanalTestSecretKeyEnc { get; set; }
  164. //[Comment("Danal Live CPID")]
  165. //public string? DanalLiveCpid { get; set; }
  166. //[Comment("Danal Live Client Key (암호화 저장 권장)")]
  167. //public string? DanalLiveClientKeyEnc { get; set; }
  168. //[Comment("Danal Live Secret Key (암호화 저장 권장)")]
  169. //public string? DanalLiveSecretKeyEnc { get; set; }
  170. }
  171. // ==================================================
  172. // 결제 설정 (Payment)
  173. // ==================================================
  174. public sealed class PaymentConfig
  175. {
  176. /** 다날 페이 **/
  177. //[Range(0, 100)]
  178. //[Comment("다날 신용카드 수수료(%)")]
  179. //public decimal? DanalCardFeeRate { get; set; }
  180. //[Range(0, 999_999_999)]
  181. //[Comment("다날 신용카드 수수료(원)")]
  182. //public decimal? DanalCardFeeAmount { get; set; }
  183. //[Range(0, 100)]
  184. //[Comment("다날 계좌이체 수수료(%)")]
  185. //public decimal? DanalTransferFeeRate { get; set; }
  186. //[Range(0, 999_999_999)]
  187. //[Comment("다날 계좌이체 수수료(원)")]
  188. //public decimal? DanalTransferFeeAmount { get; set; }
  189. //[Range(0, 100)]
  190. //[Comment("다날 가상계좌 수수료(%)")]
  191. //public decimal? DanalVbankFeeRate { get; set; }
  192. //[Range(0, 999_999_999)]
  193. //[Comment("다날 가상계좌 수수료(원)")]
  194. //public decimal? DanalVbankFeeAmount { get; set; }
  195. //[Range(0, 100)]
  196. //[Comment("다날 간편결제 수수료(%)")]
  197. //public decimal? DanalSimpleFeeRate { get; set; }
  198. //[Range(0, 999_999_999)]
  199. //[Comment("다날 간편결제 수수료(원)")]
  200. //public decimal? DanalSimpleFeeAmount { get; set; }
  201. }
  202. #endregion
  203. }