diff --git a/src/Covid19Radar.Api/DataAccess/CosmosEventLogRepository.cs b/src/Covid19Radar.Api/DataAccess/CosmosEventLogRepository.cs index 3908eac51..8d8f64fdd 100644 --- a/src/Covid19Radar.Api/DataAccess/CosmosEventLogRepository.cs +++ b/src/Covid19Radar.Api/DataAccess/CosmosEventLogRepository.cs @@ -26,7 +26,12 @@ ILogger logger public async Task UpsertAsync(EventLogModel eventLog) { - ItemResponse recordAdded = await _db.EventLog.UpsertItemAsync(eventLog); + PartitionKey? pk = null; + if(eventLog.PartitionKey is not null) + { + pk = new PartitionKey(eventLog.PartitionKey); + } + ItemResponse recordAdded = await _db.EventLog.UpsertItemAsync(eventLog, pk); _logger.LogInformation($"{nameof(UpsertAsync)} RequestCharge:{recordAdded.RequestCharge}"); } } diff --git a/src/Covid19Radar.Api/V1EventLog.cs b/src/Covid19Radar.Api/V1EventLog.cs index 9f4610715..a6bea8f37 100644 --- a/src/Covid19Radar.Api/V1EventLog.cs +++ b/src/Covid19Radar.Api/V1EventLog.cs @@ -139,6 +139,7 @@ public async Task RunAsync( ) { id = id, + PartitionKey = id, Created = timestamp, }; await _eventLogRepository.UpsertAsync(eventLogModel);