private static APIGatewayProxyResponse GetTimelineEventAttachments(APIGatewayProxyRequest request)
        {
            var tenantId = request.AuthoriseGetRequest();

            request.TryGetHeader("TimelineEventId", out var timelineEventId);
            ValidateTimelineEventAttachmentId(timelineEventId);
            var models = GetRepo(tenantId).GetTimelineEventAttachments(timelineEventId);

            return(ResponseHelper.WrapResponse(models));
        }
        private static APIGatewayProxyResponse GetTimelineEvent(APIGatewayProxyRequest request)
        {
            var tenantId = request.AuthoriseGetRequest();

            request.TryGetHeader("TimelineEventId", out var timelineEventId);
            ValidateTimelineEventId(timelineEventId);

            var repo       = GetRepo(tenantId);
            var eventModel = repo.GetTimelineEventModel(timelineEventId);

            return(ResponseHelper.WrapResponse(eventModel));
        }
Exemple #3
0
        private static APIGatewayProxyResponse GetTimeline(APIGatewayProxyRequest request)
        {
            var tenantId = request.AuthoriseGetRequest();

            request.TryGetHeader("TimelineId", out var timelineId);

            timelineId.ValidateString("Invalid Timeline Id");
            var repo = GetRepository(tenantId);

            var model = repo.GetModel(timelineId);

            return(ResponseHelper.WrapResponse(model));
        }
Exemple #4
0
        private static APIGatewayProxyResponse GetLinkedEvents(APIGatewayProxyRequest request)
        {
            var tenantId = request.AuthoriseGetRequest();

            request.TryGetHeader("TimelineId", out var timelineId);
            timelineId.ValidateString("Invalid Timeline Id");

            var linkRepo = GetRepository(tenantId);

            var events = linkRepo.GetLinkedEvents(timelineId);

            return(ResponseHelper.WrapResponse(events));
        }
        private static APIGatewayProxyResponse GenerateGetAttachmentPresignedUrl(APIGatewayProxyRequest request)
        {
            var tenantId = request.AuthoriseGetRequest();

            request.TryGetHeader("AttachmentId", out var attachmentId);
            ValidateTimelineEventAttachmentId(attachmentId);

            var s3Client     = new AmazonS3Client(RegionEndpoint.EUWest1);
            var presignedUrl = s3Client.GetPreSignedURL(new GetPreSignedUrlRequest
            {
                BucketName = "ideagengcu",
                Verb       = HttpVerb.GET,
                Key        = $"{tenantId}/{attachmentId}",
                Expires    = DateTime.Now.AddMinutes(15)
            });

            return(ResponseHelper.PlainTextResponse(presignedUrl));
        }
        private static APIGatewayProxyResponse GetLinkedTimelineEvents(APIGatewayProxyRequest request)
        {
            var tenantId = request.AuthoriseGetRequest();

            request.TryGetHeader("TimelineEventId", out var timelineEventId);
            ValidateTimelineEventId(timelineEventId);

            var repo       = GetRepo(tenantId);
            var eventModel = repo.GetTimelineEventModel(timelineEventId);
            var timelineEventLinkedModels = repo.GetTimelineEventLinks(eventModel.Id);

            Log("Returning linked timeline events");
            foreach (var linkedModel in timelineEventLinkedModels)
            {
                Log(linkedModel.ToString());
            }

            return(ResponseHelper.WrapResponse(timelineEventLinkedModels));
        }