public async Task AddToHistoryRepository(
            IRepository repository,
            string settingsJson,
            string lastCommit = "",
            bool isManual     = false,
            string userName   = "",
            string userIp     = "")
        {
            var lastUpdate = await _repositoriesUpdateHistoryRepository.GetAsync(lastCommit);

            bool firtstCommit = lastUpdate == null;

            //cheking if last commit is the same. Skip manual edits. If it is do noting - to not duplicate
            if (lastUpdate != null)
            {
                await GetFileData(HISTORY_FILE_PREFIX + "settings_" + lastUpdate.RowKey + FILE_FORMAT);
            }

            //save commit data
            var repositoryUpdateHistory = new RepositoryUpdateHistory()
            {
                RowKey        = isManual ? Guid.NewGuid().ToString() : repository.RowKey,
                InitialCommit = firtstCommit ? repository.RowKey : lastUpdate.InitialCommit,
                User          = userName,
                Branch        = repository.Branch,
                IsManual      = isManual,
                CreatedAt     = DateTime.UtcNow,
            };
            await _repositoriesUpdateHistoryRepository.SaveRepositoryUpdateHistory(repositoryUpdateHistory);

            //save history-settings_ file
            var blobFileName = HISTORY_FILE_PREFIX + "settings_" + repositoryUpdateHistory.RowKey + FILE_FORMAT;
            await _repositoryDataRepository.UpdateBlobAsync(settingsJson, userName, userIp, blobFileName);
        }
Beispiel #2
0
 public Task UpdateAsync(string json, string userName, string ipAddress, string file = null)
 {
     return(_repositoryDataRepository.UpdateBlobAsync(json, userName, ipAddress, file));
 }