public OperationModule(ICommandDispatcher commandDispatcher, IIdentityProvider identityProvider, IOperationStorage operationStorage) : base(commandDispatcher, identityProvider, modulePath: "operations") { Get("{requestId}", args => Fetch <GetOperation, OperationDto> (async x => { var operation = await operationStorage.GetAsync(x.RequestId); if (operation.HasNoValue || operation.Value.UserId != CurrentUserId) { return(new Maybe <OperationDto>()); } return(operation); }).HandleAsync()); }
public OperationModule(ICommandDispatcher commandDispatcher, IValidatorResolver validatorResolver, IIdentityProvider identityProvider, IOperationStorage operationStorage) : base(commandDispatcher, validatorResolver, identityProvider, modulePath: "operations") { Get("{requestId}", args => Fetch <GetOperation, Operation> (async x => { var operation = await operationStorage.GetAsync(x.RequestId); if (operation.HasNoValue || operation.Value.UserId.Empty()) { return(operation); } this.RequiresAuthentication(); return(operation.Value.UserId == CurrentUserId ? operation : new Maybe <Operation>()); }).HandleAsync()); }