using Riok.Mapperly.Abstractions; using Sozsoft.Notifications.Domain; using Sozsoft.Notifications.Entities; using Sozsoft.Notifications.NotificationRules; using Volo.Abp.Mapperly; namespace Sozsoft.Notifications.Application; [Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] public partial class NotificationTypeToNotificationTypeDtoMapper : MapperBase { public override partial NotificationTypeDto Map(NotificationType source); public override partial void Map(NotificationType source, NotificationTypeDto destination); public override void BeforeMap(NotificationType source) { } public override void AfterMap(NotificationType source, NotificationTypeDto destination) { } } [Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] public partial class NotificationRuleToNotificationRuleDtoMapper : MapperBase { public override partial NotificationRuleDto Map(NotificationRule source); public override partial void Map(NotificationRule source, NotificationRuleDto destination); public override void BeforeMap(NotificationRule source) { } public override void AfterMap(NotificationRule source, NotificationRuleDto destination) { } } [Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] public partial class NotificationToNotificationDtoMapper : MapperBase { // NotificationType hedefte string. Kaynaktaki navigation entity'si doğrudan // eşlenirse ToString() devreye girip "[ENTITY: NotificationType] Id = ..." // yazısı UI'a düşüyor; bu yüzden açıkça Name alanından beslenir. [MapProperty("NotificationType.Name", nameof(NotificationDto.NotificationType))] [MapperIgnoreTarget(nameof(NotificationDto.CreatorFullname))] [MapperIgnoreTarget(nameof(NotificationDto.TenantId))] public override partial NotificationDto Map(Notification source); [MapProperty("NotificationType.Name", nameof(NotificationDto.NotificationType))] [MapperIgnoreTarget(nameof(NotificationDto.CreatorFullname))] [MapperIgnoreTarget(nameof(NotificationDto.TenantId))] public override partial void Map(Notification source, NotificationDto destination); public override void BeforeMap(Notification source) { } public override void AfterMap(Notification source, NotificationDto destination) { } } [Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] public partial class CreateUpdateNotificationRuleDtoToNotificationRuleMapper : MapperBase { [MapperIgnoreTarget(nameof(NotificationRule.RecipientType))] public override NotificationRule Map(CreateUpdateNotificationRuleDto source) { var destination = new NotificationRule { RecipientType = NotificationRecipientTypes.All, Channel = source.Channel, NotificationTypeId = source.NotificationTypeId, IsActive = source.IsActive }; AfterMap(source, destination); return destination; } [MapperIgnoreTarget(nameof(NotificationRule.RecipientType))] public override partial void Map(CreateUpdateNotificationRuleDto source, NotificationRule destination); public override void BeforeMap(CreateUpdateNotificationRuleDto source) { } public override void AfterMap(CreateUpdateNotificationRuleDto source, NotificationRule destination) { } }