| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using Domain.Entities.Donations.ValueObject;
- using Domain.Entities.Members;
- namespace Domain.Entities.Donations;
- public class DonationGoalConfig
- {
- [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; } = "후원 목표";
- public GoalWidgetStyle Style { get; private set; } = GoalWidgetStyle.Simple;
- public int StartAmount { get; private set; } = DonationConstants.Goal.DefaultStartAmount;
- public int TargetAmount { get; private set; } = DonationConstants.Goal.DefaultTargetAmount;
- public DateTime? StartAt { get; private set; }
- public DateTime? EndAt { get; private set; }
- public bool IsShowPercent { get; private set; } = true;
- public string BarColor { get; private set; } = DonationConstants.Goal.DefaultBarColor;
- public string BarBackgroundColor { get; private set; } = DonationConstants.Goal.DefaultBarBackgroundColor;
- public int BarHeightPx { get; private set; } = DonationConstants.Goal.DefaultBarHeight;
- public int TitleFontSizePx { get; private set; } = DonationConstants.Goal.DefaultFontSize;
- public string TitleFontColor { get; private set; } = DonationConstants.Goal.DefaultTitleFontColor;
- public int AmountFontSizePx { get; private set; } = DonationConstants.Goal.DefaultFontSize;
- public string AmountFontColor { get; private set; } = DonationConstants.Goal.DefaultAmountFontColor;
- public string? TitleFontFamily { get; private set; }
- public string? AmountFontFamily { get; private set; }
- public bool IsActive { get; private set; }
- public DateTime? UpdatedAt { get; private set; }
- public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
- private DonationGoalConfig() { }
- public static DonationGoalConfig Create(int channelID, int memberID, string title, int targetAmount)
- {
- return new DonationGoalConfig
- {
- ChannelID = channelID,
- MemberID = memberID,
- Title = title,
- TargetAmount = targetAmount
- };
- }
- public void Update(
- string title,
- GoalWidgetStyle style,
- int startAmount,
- int targetAmount,
- DateTime? startAt,
- DateTime? endAt,
- bool isShowPercent,
- string barColor,
- string barBackgroundColor,
- int barHeightPx,
- int titleFontSizePx,
- string titleFontColor,
- int amountFontSizePx,
- string amountFontColor,
- string? titleFontFamily,
- string? amountFontFamily,
- bool isActive
- ) {
- Title = title;
- Style = style;
- StartAmount = startAmount;
- TargetAmount = targetAmount;
- StartAt = startAt;
- EndAt = endAt;
- IsShowPercent = isShowPercent;
- BarColor = barColor;
- BarBackgroundColor = barBackgroundColor;
- BarHeightPx = barHeightPx;
- TitleFontSizePx = titleFontSizePx;
- TitleFontColor = titleFontColor;
- AmountFontSizePx = amountFontSizePx;
- AmountFontColor = amountFontColor;
- TitleFontFamily = titleFontFamily;
- AmountFontFamily = amountFontFamily;
- IsActive = isActive;
- UpdatedAt = DateTime.UtcNow;
- }
- }
|