| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using Domain.Entities.Donations.ValueObject;
- using Domain.Entities.Members;
- namespace Domain.Entities.Donations;
- public class CrewWidgetConfig
- {
- [ForeignKey(nameof(ChannelID))]
- public virtual Channel? Channel { get; private set; }
- [ForeignKey(nameof(MemberID))]
- public virtual Member? Member { get; private set; }
- [Key]
- public int ID { get; private set; }
- public int ChannelID { get; private set; }
- public int MemberID { get; private set; }
- public string Title { get; private set; } = default!;
- public CrewWidgetTheme Theme { get; private set; } = CrewWidgetTheme.Basic;
- public RankPeriodType Period { get; private set; }
- public DateTime? StartAt { get; private set; }
- public DateTime? EndAt { get; private set; }
- public int MaxDisplayCount { get; private set; } = 5;
- public bool IsShowAmount { get; private set; } = true;
- public bool IsShowDonationCount { get; private set; }
- public bool IsShowContributionRate { get; private set; } = true;
- public bool IsShowMemberIcon { get; private set; } = true;
- public bool IsActive { get; private set; }
- public string BgColor { get; private set; } = "#1A1A2E";
- // ── 제목 폰트 ───────────────────────────────────
- public string? TitleFontFamily { get; private set; }
- public int TitleFontSizePx { get; private set; } = 18;
- public string TitleFontColor { get; private set; } = "#FFFFFF";
- // ── 1위 폰트 ────────────────────────────────────
- public string? Rank1FontFamily { get; private set; }
- public int Rank1FontSizePx { get; private set; } = 15;
- public string Rank1FontColor { get; private set; } = "#FFD700";
- // ── 2위 폰트 ────────────────────────────────────
- public string? Rank2FontFamily { get; private set; }
- public int Rank2FontSizePx { get; private set; } = 15;
- public string Rank2FontColor { get; private set; } = "#C0C0C0";
- // ── 3위 폰트 ────────────────────────────────────
- public string? Rank3FontFamily { get; private set; }
- public int Rank3FontSizePx { get; private set; } = 15;
- public string Rank3FontColor { get; private set; } = "#CD7F32";
- // ── 일반 행 폰트 ────────────────────────────────
- public string? RowFontFamily { get; private set; }
- public int RowFontSizePx { get; private set; } = 14;
- public string RowFontColor { get; private set; } = "#FFFFFF";
- public DateTime? UpdatedAt { get; private set; }
- public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
- private CrewWidgetConfig() { }
- public static CrewWidgetConfig Create(
- int channelID, int memberID, string title,
- CrewWidgetTheme theme, RankPeriodType period,
- DateTime? startAt, DateTime? endAt,
- int maxDisplayCount, bool isShowAmount, bool isShowDonationCount,
- bool isShowContributionRate, bool isShowMemberIcon, bool isActive,
- string bgColor,
- string? titleFontFamily, int titleFontSizePx, string titleFontColor,
- string? rank1FontFamily, int rank1FontSizePx, string rank1FontColor,
- string? rank2FontFamily, int rank2FontSizePx, string rank2FontColor,
- string? rank3FontFamily, int rank3FontSizePx, string rank3FontColor,
- string? rowFontFamily, int rowFontSizePx, string rowFontColor
- ) {
- return new CrewWidgetConfig
- {
- ChannelID = channelID, MemberID = memberID, Title = title,
- Theme = theme, Period = period, StartAt = startAt, EndAt = endAt,
- MaxDisplayCount = maxDisplayCount, IsShowAmount = isShowAmount,
- IsShowDonationCount = isShowDonationCount, IsShowContributionRate = isShowContributionRate,
- IsShowMemberIcon = isShowMemberIcon, IsActive = isActive, BgColor = bgColor,
- TitleFontFamily = titleFontFamily, TitleFontSizePx = titleFontSizePx, TitleFontColor = titleFontColor,
- Rank1FontFamily = rank1FontFamily, Rank1FontSizePx = rank1FontSizePx, Rank1FontColor = rank1FontColor,
- Rank2FontFamily = rank2FontFamily, Rank2FontSizePx = rank2FontSizePx, Rank2FontColor = rank2FontColor,
- Rank3FontFamily = rank3FontFamily, Rank3FontSizePx = rank3FontSizePx, Rank3FontColor = rank3FontColor,
- RowFontFamily = rowFontFamily, RowFontSizePx = rowFontSizePx, RowFontColor = rowFontColor
- };
- }
- public void Update(
- string title,
- CrewWidgetTheme theme, RankPeriodType period,
- DateTime? startAt, DateTime? endAt,
- int maxDisplayCount, bool isShowAmount, bool isShowDonationCount,
- bool isShowContributionRate, bool isShowMemberIcon, bool isActive,
- string bgColor,
- string? titleFontFamily, int titleFontSizePx, string titleFontColor,
- string? rank1FontFamily, int rank1FontSizePx, string rank1FontColor,
- string? rank2FontFamily, int rank2FontSizePx, string rank2FontColor,
- string? rank3FontFamily, int rank3FontSizePx, string rank3FontColor,
- string? rowFontFamily, int rowFontSizePx, string rowFontColor
- ) {
- Title = title; Theme = theme; Period = period;
- StartAt = startAt; EndAt = endAt;
- MaxDisplayCount = maxDisplayCount; IsShowAmount = isShowAmount;
- IsShowDonationCount = isShowDonationCount; IsShowContributionRate = isShowContributionRate;
- IsShowMemberIcon = isShowMemberIcon; IsActive = isActive; BgColor = bgColor;
- TitleFontFamily = titleFontFamily; TitleFontSizePx = titleFontSizePx; TitleFontColor = titleFontColor;
- Rank1FontFamily = rank1FontFamily; Rank1FontSizePx = rank1FontSizePx; Rank1FontColor = rank1FontColor;
- Rank2FontFamily = rank2FontFamily; Rank2FontSizePx = rank2FontSizePx; Rank2FontColor = rank2FontColor;
- Rank3FontFamily = rank3FontFamily; Rank3FontSizePx = rank3FontSizePx; Rank3FontColor = rank3FontColor;
- RowFontFamily = rowFontFamily; RowFontSizePx = rowFontSizePx; RowFontColor = rowFontColor;
- UpdatedAt = DateTime.UtcNow;
- }
- }
|