public async Task <SyncRequest> CreateSyncRequestAsync(SynchronizationComponent source, SynchronizationComponent target)
        {
            //get
            var synchronizations = await this.synchronizationRepository.GetSynchronizationsAsync();

            var synchronization = synchronizations.Where(x => x.Component == target && x.UserId == userIdentityContext.UserId).FirstOrDefault();

            var request = new SyncRequest
            {
                Component   = source,
                ComponentId = new Guid(settings.ApplicationId),
                UserId      = userIdentityContext.ExternalId,
                LastSync    = synchronization != null ? synchronization.LastSyncAt : new DateTime(),
            };

            //collect collections to send to update
            //modified on || created on > LastSync

            request = await this.GetCollectionsToSyncAsync(request);

            return(request);
        }
Exemple #2
0
        public async Task <Synchronization> GetSynchronizationAsync(SynchronizationComponent component, Guid componentId, int userId)
        {
            var currency = await this.Context.Synchronizations.FirstOrDefaultAsync(x => x.Component == component && x.ComponentId == componentId && x.UserId == userId);

            return(currency);
        }