예제 #1
0
        public async Task <IntegrationReadResponse> GetIntegration(IntegrationReadRequest request)
        {
            var response = new IntegrationReadResponse();

            var currentUser = _cacheManager.GetCachedCurrentUser(request.CurrentUserId);

            var entity = await _integrationRepository.Select(x => x.Uid == request.IntegrationUid);

            if (entity.IsNotExist())
            {
                response.SetInvalidBecauseNotFound("integration");
                return(response);
            }

            if (entity.OrganizationId != currentUser.OrganizationId)
            {
                response.SetFailed();
                return(response);
            }

            response.Item   = _integrationFactory.CreateDtoFromEntity(entity);
            response.Status = ResponseStatus.Success;
            return(response);
        }