public async Task <APIGatewayProxyResponse> Run(APIGatewayProxyRequest request)
        {
            var requestModel = new ListNotesRequest {
                userId = request.RequestContext.Identity.CognitoIdentityId
            };

            var mediator = _serviceProvider.GetService <IMediator>();
            var result   = await mediator.Send(requestModel);

            return(result == null ?
                   new APIGatewayProxyResponse {
                StatusCode = 404, Headers = CommonHeaders.corsHeaders
            } :
                   new APIGatewayProxyResponse {
                StatusCode = 200, Body = JsonConvert.SerializeObject(result), Headers = CommonHeaders.corsHeaders
            });
        }
示例#2
0
        public async Task <List <Note> > Handle(ListNotesRequest request, CancellationToken cancellationToken)
        {
            var result = await _itemRepository.ListByUserId <Note>(request.userId.ToString(), cancellationToken);

            return(result.ToList());
        }