Request.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. using Microsoft.AspNetCore.Http;
  2. using System.ComponentModel;
  3. using System.ComponentModel.DataAnnotations;
  4. namespace Application.Features.Config.Update;
  5. public sealed class Request
  6. {
  7. public int ID { get; init; }
  8. public BasicConfigDto Basic { get; init; } = new();
  9. public ImagesConfigDto Images { get; init; } = new();
  10. public MetaConfigDto Meta { get; init; } = new();
  11. public CompanyConfigDto Company { get; init; } = new();
  12. public AccountConfigDto Account { get; init; } = new();
  13. public EmailTemplateConfigDto EmailTemplate { get; init; } = new();
  14. public ExternalApiConfigDto External { get; init; } = new();
  15. public PaymentConfigDto Payment { get; init; } = new();
  16. public sealed class BasicConfigDto
  17. {
  18. [MaxLength(100)]
  19. [DisplayName("사이트 이름")]
  20. public string? SiteName { get; init; }
  21. [MaxLength(100)]
  22. [DataType(DataType.Url)]
  23. [DisplayName("사이트 주소")]
  24. public string? SiteURL { get; init; }
  25. [DisplayName("최고 관리자 ID")]
  26. public string? RootID { get; init; }
  27. [MaxLength(100)]
  28. [DataType(DataType.EmailAddress)]
  29. [DisplayName("송수신 이메일")]
  30. public string? FromEmail { get; init; }
  31. [MaxLength(30)]
  32. [DisplayName("송수신자 이름")]
  33. public string? FromName { get; init; }
  34. [MaxLength(200)]
  35. [DisplayName("SMTP Server")]
  36. public string? SmtpServer { get; init; }
  37. [Range(1, 65535)]
  38. [DisplayName("SMTP Port")]
  39. public int? SmtpPort { get; set; }
  40. [DisplayName("SMTP Enable SSL")]
  41. public bool SmtpEnableSSL { get; init; } = false;
  42. [MaxLength(100)]
  43. [DisplayName("SMTP Username")]
  44. public string? SmtpUsername { get; init; }
  45. [MaxLength(200)]
  46. [DataType(DataType.Password)]
  47. [DisplayName("SMTP Password")]
  48. public string? SmtpPassword { get; init; }
  49. [MaxLength(200)]
  50. [DataType(DataType.MultilineText)]
  51. [DisplayName("관리자단 접근 가능 IP")]
  52. public string? AdminWhiteIPList { get; init; }
  53. [MaxLength(200)]
  54. [DataType(DataType.MultilineText)]
  55. [DisplayName("사용자단 접근 가능 IP")]
  56. public string? FrontWhiteIPList { get; init; }
  57. [MaxLength(200)]
  58. [DisplayName("차단 시 안내문 제목")]
  59. public string? BlockAlertTitle { get; init; }
  60. [MaxLength(5000)]
  61. [DataType(DataType.MultilineText)]
  62. [DisplayName("차단 시 안내문 내용")]
  63. public string? BlockAlertContent { get; init; }
  64. [DisplayName("점검 여부")]
  65. public bool IsMaintenance { get; init; } = false;
  66. [MaxLength(5000)]
  67. [DataType(DataType.MultilineText)]
  68. [DisplayName("점검 내용")]
  69. public string? MaintenanceContent { get; init; }
  70. }
  71. public sealed class ImagesConfigDto
  72. {
  73. // ====== DB에 저장/표시할 경로(문자열) ======
  74. [MaxLength(255)]
  75. [DisplayName("Favicon")]
  76. public string? FaviconPath { get; init; }
  77. [MaxLength(255)]
  78. [DisplayName("Logo-square")]
  79. public string? LogoSquarePath { get; init; }
  80. [MaxLength(255)]
  81. [DisplayName("Logo-horizontal")]
  82. public string? LogoHorizontalPath { get; init; }
  83. [MaxLength(255)]
  84. [DisplayName("og-default")]
  85. public string? OgDefaultPath { get; init; }
  86. [MaxLength(255)]
  87. [DisplayName("Twitter-image")]
  88. public string? TwitterImagePath { get; init; }
  89. [MaxLength(255)]
  90. [DisplayName("Apple-touch-icon")]
  91. public string? AppleTouchIconPath { get; init; }
  92. [MaxLength(255)]
  93. [DisplayName("App-icon-192")]
  94. public string? AppIcon192Path { get; init; }
  95. [MaxLength(255)]
  96. [DisplayName("App-icon-512")]
  97. public string? AppIcon512Path { get; init; }
  98. // ====== 업로드 입력(폼 바인딩용) ======
  99. [DataType(DataType.Upload)]
  100. [DisplayName("Favicon 업로드")]
  101. public IFormFile? FaviconFile { get; init; }
  102. [DataType(DataType.Upload)]
  103. [DisplayName("Logo-square 업로드")]
  104. public IFormFile? LogoSquareFile { get; init; }
  105. [DataType(DataType.Upload)]
  106. [DisplayName("Logo-horizontal 업로드")]
  107. public IFormFile? LogoHorizontalFile { get; init; }
  108. [DataType(DataType.Upload)]
  109. [DisplayName("og-default 업로드")]
  110. public IFormFile? OgDefaultFile { get; init; }
  111. [DataType(DataType.Upload)]
  112. [DisplayName("Twitter-image 업로드")]
  113. public IFormFile? TwitterImageFile { get; init; }
  114. [DataType(DataType.Upload)]
  115. [DisplayName("Apple-touch-icon 업로드")]
  116. public IFormFile? AppleTouchIconFile { get; init; }
  117. [DataType(DataType.Upload)]
  118. [DisplayName("App-icon-192 업로드")]
  119. public IFormFile? AppIcon192File { get; init; }
  120. [DataType(DataType.Upload)]
  121. [DisplayName("App-icon-512 업로드")]
  122. public IFormFile? AppIcon512File { get; init; }
  123. }
  124. public sealed class MetaConfigDto
  125. {
  126. [MaxLength(255)]
  127. [DisplayName("Meta Keywords")]
  128. public string? Keywords { get; init; }
  129. [MaxLength(255)]
  130. [DisplayName("Meta Description")]
  131. public string? Description { get; init; }
  132. [MaxLength(255)]
  133. [DisplayName("Meta Author")]
  134. public string? Author { get; init; }
  135. [MaxLength(255)]
  136. [DisplayName("Meta Viewport")]
  137. public string? Viewport { get; init; }
  138. [MaxLength(255)]
  139. [DisplayName("Meta ApplicationName")]
  140. public string? ApplicationName { get; init; }
  141. [MaxLength(255)]
  142. [DisplayName("Meta Generator")]
  143. public string? Generator { get; init; }
  144. [MaxLength(255)]
  145. [DisplayName("Meta Robots")]
  146. public string? Robots { get; init; }
  147. [MaxLength(3000)]
  148. [DataType(DataType.MultilineText)]
  149. [DisplayName("Meta Adds")]
  150. public string? Adds { get; init; }
  151. }
  152. public sealed class CompanyConfigDto
  153. {
  154. [MaxLength(70)]
  155. [DisplayName("상호 명")]
  156. public string? Name { get; init; }
  157. [MaxLength(100)]
  158. [DisplayName("사업자 등록 번호")]
  159. public string? RegNo { get; init; }
  160. [MaxLength(255)]
  161. [DisplayName("사업자 소재지")]
  162. public string? Address { get; init; }
  163. [MaxLength(8)]
  164. [DataType(DataType.PostalCode)]
  165. [DisplayName("우편번호")]
  166. public string? ZipCode { get; init; }
  167. [MaxLength(50)]
  168. [DisplayName("대표자 명")]
  169. public string? Owner { get; init; }
  170. [MaxLength(20)]
  171. [DisplayName("대표 전화번호")]
  172. public string? Tel { get; init; }
  173. [MaxLength(20)]
  174. [DisplayName("FAX")]
  175. public string? Fax { get; init; }
  176. [MaxLength(20)]
  177. [DisplayName("통신판매업 신고번호")]
  178. public string? RetailSaleNo { get; init; }
  179. [MaxLength(20)]
  180. [DisplayName("부가통신 사업자번호")]
  181. public string? AddedSaleNo { get; init; }
  182. [MaxLength(100)]
  183. [DisplayName("호스팅 서비스")]
  184. public string? Hosting { get; init; }
  185. [MaxLength(70)]
  186. [DisplayName("정보관리책임자")]
  187. public string? AdminName { get; init; }
  188. [MaxLength(100)]
  189. [DataType(DataType.EmailAddress)]
  190. [DisplayName("정보관리책임자 이메일")]
  191. public string? AdminEmail { get; init; }
  192. [MaxLength(200)]
  193. [DataType(DataType.Url)]
  194. [DisplayName("사이트 주소")]
  195. public string? SiteUrl { get; init; }
  196. [MaxLength(10)]
  197. [DisplayName("입금계좌 - 은행")]
  198. public string? BankCode { get; init; }
  199. [MaxLength(70)]
  200. [DisplayName("입금계좌 - 예금주")]
  201. public string? BankOwner { get; init; }
  202. [MaxLength(100)]
  203. [DisplayName("입금계좌 - 계좌번호")]
  204. public string? BankNumber { get; init; }
  205. }
  206. public sealed class AccountConfigDto
  207. {
  208. public bool IsRegisterBlock { get; init; }
  209. public bool IsRegisterEmailAuth { get; init; }
  210. public ushort? PasswordMinLength { get; init; }
  211. public ushort? PasswordUppercaseLength { get; init; }
  212. public ushort? PasswordNumbersLength { get; init; }
  213. public ushort? PasswordSpecialcharsLength { get; init; }
  214. public string? DeniedEmailList { get; init; }
  215. public string? DeniedNameList { get; init; }
  216. public ushort? ChangeEmailDay { get; init; }
  217. public ushort? ChangeNameDay { get; init; }
  218. public ushort? ChangeSummaryDay { get; init; }
  219. public ushort? ChangeIntroDay { get; init; }
  220. public ushort? ChangePasswordDay { get; init; }
  221. public ushort? MaxLoginTryCount { get; init; }
  222. public ushort? MaxLoginTryLimitSecond { get; init; }
  223. }
  224. public sealed class EmailTemplateConfigDto
  225. {
  226. public string? RegisterEmailFormTitle { get; init; }
  227. public string? RegisterEmailFormContent { get; init; }
  228. public string? RegistrationEmailFormTitle { get; init; }
  229. public string? RegistrationEmailFormContent { get; init; }
  230. public string? ResetPasswordEmailFormTitle { get; init; }
  231. public string? ResetPasswordEmailFormContent { get; init; }
  232. public string? ChangedPasswordEmailFormTitle { get; init; }
  233. public string? ChangedPasswordEmailFormContent { get; init; }
  234. public string? WithdrawEmailFormTitle { get; init; }
  235. public string? WithdrawEmailFormContent { get; init; }
  236. public string? EmailVerifyFormTitle { get; init; }
  237. public string? EmailVerifyFormContent { get; init; }
  238. public string? ChangedEmailFormTitle { get; init; }
  239. public string? ChangedEmailFormContent { get; init; }
  240. }
  241. public sealed class ExternalApiConfigDto
  242. {
  243. public string? YouTubeApiKeyEnc { get; init; }
  244. public string? YouTubeApiName { get; init; }
  245. public string? GoogleClientId { get; init; }
  246. public string? GoogleClientSecretEnc { get; init; }
  247. public string? GoogleAppId { get; init; }
  248. }
  249. public sealed class PaymentConfigDto
  250. {
  251. }
  252. public static Request From(Get.Response src) => new()
  253. {
  254. ID = src.ID,
  255. Basic = new BasicConfigDto
  256. {
  257. SiteName = src.Basic.SiteName,
  258. SiteURL = src.Basic.SiteURL,
  259. RootID = src.Basic.RootID,
  260. FromEmail = src.Basic.FromEmail,
  261. FromName = src.Basic.FromName,
  262. SmtpServer = src.Basic.SmtpServer,
  263. SmtpPort = src.Basic.SmtpPort,
  264. SmtpEnableSSL = src.Basic.SmtpEnableSSL,
  265. SmtpUsername = src.Basic.SmtpUsername,
  266. SmtpPassword = src.Basic.SmtpPassword,
  267. AdminWhiteIPList = src.Basic.AdminWhiteIPList,
  268. FrontWhiteIPList = src.Basic.FrontWhiteIPList,
  269. BlockAlertTitle = src.Basic.BlockAlertTitle,
  270. BlockAlertContent = src.Basic.BlockAlertContent,
  271. IsMaintenance = src.Basic.IsMaintenance,
  272. MaintenanceContent = src.Basic.MaintenanceContent
  273. },
  274. Images = new ImagesConfigDto
  275. {
  276. FaviconPath = src.Images.FaviconPath,
  277. LogoSquarePath = src.Images.LogoSquarePath,
  278. LogoHorizontalPath = src.Images.LogoHorizontalPath,
  279. OgDefaultPath = src.Images.OgDefaultPath,
  280. TwitterImagePath = src.Images.TwitterImagePath,
  281. AppleTouchIconPath = src.Images.AppleTouchIconPath,
  282. AppIcon192Path = src.Images.AppIcon192Path,
  283. AppIcon512Path = src.Images.AppIcon512Path
  284. },
  285. Meta = new MetaConfigDto
  286. {
  287. Keywords = src.Meta.Keywords,
  288. Description = src.Meta.Description,
  289. Author = src.Meta.Author,
  290. Viewport = src.Meta.Viewport,
  291. ApplicationName = src.Meta.ApplicationName,
  292. Generator = src.Meta.Generator,
  293. Robots = src.Meta.Robots,
  294. Adds = src.Meta.Adds
  295. },
  296. Company = new CompanyConfigDto
  297. {
  298. Name = src.Company.Name,
  299. RegNo = src.Company.RegNo,
  300. Address = src.Company.Address,
  301. ZipCode = src.Company.ZipCode,
  302. Owner = src.Company.Owner,
  303. Tel = src.Company.Tel,
  304. Fax = src.Company.Fax,
  305. RetailSaleNo = src.Company.RetailSaleNo,
  306. AddedSaleNo = src.Company.AddedSaleNo,
  307. Hosting = src.Company.Hosting,
  308. AdminName = src.Company.AdminName,
  309. AdminEmail = src.Company.AdminEmail,
  310. SiteUrl = src.Company.SiteUrl,
  311. BankCode = src.Company.BankCode,
  312. BankOwner = src.Company.BankOwner,
  313. BankNumber = src.Company.BankNumber
  314. },
  315. Account = new AccountConfigDto
  316. {
  317. IsRegisterBlock = src.Account.IsRegisterBlock,
  318. IsRegisterEmailAuth = src.Account.IsRegisterEmailAuth,
  319. PasswordMinLength = src.Account.PasswordMinLength,
  320. PasswordUppercaseLength = src.Account.PasswordUppercaseLength,
  321. PasswordNumbersLength = src.Account.PasswordNumbersLength,
  322. PasswordSpecialcharsLength = src.Account.PasswordSpecialcharsLength,
  323. DeniedEmailList = src.Account.DeniedEmailList,
  324. DeniedNameList = src.Account.DeniedNameList,
  325. ChangeEmailDay = src.Account.ChangeEmailDay,
  326. ChangeNameDay = src.Account.ChangeNameDay,
  327. ChangeSummaryDay = src.Account.ChangeSummaryDay,
  328. ChangeIntroDay = src.Account.ChangeIntroDay,
  329. ChangePasswordDay = src.Account.ChangePasswordDay,
  330. MaxLoginTryCount = src.Account.MaxLoginTryCount,
  331. MaxLoginTryLimitSecond = src.Account.MaxLoginTryLimitSecond
  332. },
  333. EmailTemplate = new EmailTemplateConfigDto
  334. {
  335. RegisterEmailFormTitle = src.EmailTemplate.RegisterEmailFormTitle,
  336. RegisterEmailFormContent = src.EmailTemplate.RegisterEmailFormContent,
  337. RegistrationEmailFormTitle = src.EmailTemplate.RegistrationEmailFormTitle,
  338. RegistrationEmailFormContent = src.EmailTemplate.RegistrationEmailFormContent,
  339. ResetPasswordEmailFormTitle = src.EmailTemplate.ResetPasswordEmailFormTitle,
  340. ResetPasswordEmailFormContent = src.EmailTemplate.ResetPasswordEmailFormContent,
  341. ChangedPasswordEmailFormTitle = src.EmailTemplate.ChangedPasswordEmailFormTitle,
  342. ChangedPasswordEmailFormContent = src.EmailTemplate.ChangedPasswordEmailFormContent,
  343. WithdrawEmailFormTitle = src.EmailTemplate.WithdrawEmailFormTitle,
  344. WithdrawEmailFormContent = src.EmailTemplate.WithdrawEmailFormContent,
  345. EmailVerifyFormTitle = src.EmailTemplate.EmailVerifyFormTitle,
  346. EmailVerifyFormContent = src.EmailTemplate.EmailVerifyFormContent,
  347. ChangedEmailFormTitle = src.EmailTemplate.ChangedEmailFormTitle,
  348. ChangedEmailFormContent = src.EmailTemplate.ChangedEmailFormContent
  349. },
  350. External = new ExternalApiConfigDto
  351. {
  352. YouTubeApiKeyEnc = src.External.YouTubeApiKeyEnc,
  353. YouTubeApiName = src.External.YouTubeApiName,
  354. GoogleClientId = src.External.GoogleClientId,
  355. GoogleClientSecretEnc = src.External.GoogleClientSecretEnc,
  356. GoogleAppId = src.External.GoogleAppId
  357. },
  358. Payment = new PaymentConfigDto()
  359. };
  360. }