- Added CheckUserPermissionQuery and CheckUserPermissionQueryHandler for permission validation. - Introduced GetUserRolesQuery and GetUserRolesQueryHandler to retrieve user roles. - Created IPermissionService interface and its implementation in PermissionService. - Defined permission and role constants in PermissionDefinitions. - Developed SetDefaultVatPercentageCommand and its handler for VAT configuration. - Implemented GetCurrentVatPercentageQuery and handler to fetch current VAT settings. - Added manual payment commands: CreateManualPayment, ApproveManualPayment, and RejectManualPayment with respective handlers and validators. - Created GetManualPaymentsQuery and handler for retrieving manual payment records. - Integrated gRPC services for manual payments with appropriate permission checks. - Established Protobuf definitions for manual payment operations and metadata.
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using BackOffice.BFF.Application.Common.Interfaces;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
using MediatR;
|
|
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
|
|
using CmsProto = CMSMicroservice.Protobuf.Protos;
|
|
|
|
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.UpdatePublicMessage;
|
|
|
|
public class UpdatePublicMessageCommandHandler : IRequestHandler<BffProto.UpdatePublicMessageRequest, BffProto.UpdatePublicMessageRequest>
|
|
{
|
|
private readonly IApplicationContractContext _context;
|
|
|
|
public UpdatePublicMessageCommandHandler(IApplicationContractContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<BffProto.UpdatePublicMessageRequest> Handle(BffProto.UpdatePublicMessageRequest request, CancellationToken cancellationToken)
|
|
{
|
|
var cmsRequest = new CmsProto.UpdatePublicMessageRequest
|
|
{
|
|
Id = request.MessageId,
|
|
Title = request.Title,
|
|
Content = request.Content,
|
|
Type = request.MessageType,
|
|
Priority = request.Priority,
|
|
StartDate = Timestamp.FromDateTime(request.StartsAt.ToUniversalTime()),
|
|
EndDate = Timestamp.FromDateTime(request.ExpiresAt.ToUniversalTime())
|
|
};
|
|
|
|
await _context.PublicMessages.UpdatePublicMessageAsync(
|
|
cmsRequest,
|
|
cancellationToken: cancellationToken);
|
|
|
|
// در حال حاضر پاسخ خاصی از CMS دریافت نمیکنیم؛ همان ورودی را برمیگردانیم
|
|
return request;
|
|
}
|
|
}
|
|
|