91 lines
3.1 KiB
C#
91 lines
3.1 KiB
C#
|
|
using Sozsoft.Notifications.Entities;
|
||
|
|
using Sozsoft.Notifications.Domain;
|
||
|
|
using Sozsoft.Notifications.NotificationRules;
|
||
|
|
using Riok.Mapperly.Abstractions;
|
||
|
|
using Volo.Abp.Mapperly;
|
||
|
|
|
||
|
|
namespace Sozsoft.Notifications.Application;
|
||
|
|
|
||
|
|
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)]
|
||
|
|
public partial class NotificationTypeToNotificationTypeDtoMapper : MapperBase<NotificationType, NotificationTypeDto>
|
||
|
|
{
|
||
|
|
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<NotificationRule, NotificationRuleDto>
|
||
|
|
{
|
||
|
|
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<Notification, NotificationDto>
|
||
|
|
{
|
||
|
|
[MapperIgnoreTarget(nameof(NotificationDto.CreatorFullname))]
|
||
|
|
[MapperIgnoreTarget(nameof(NotificationDto.TenantId))]
|
||
|
|
public override partial NotificationDto Map(Notification source);
|
||
|
|
|
||
|
|
[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<CreateUpdateNotificationRuleDto, NotificationRule>
|
||
|
|
{
|
||
|
|
[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)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
}
|