2020-08-10 09:22:33 +02:00
|
|
|
|
namespace Giants.Services.Store
|
|
|
|
|
{
|
2022-09-09 07:31:24 +02:00
|
|
|
|
using System.Collections.Generic;
|
2020-08-10 09:22:33 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2022-09-05 22:42:41 +02:00
|
|
|
|
public class CosmosDbVersioningStore : IVersioningStore
|
2020-08-10 09:22:33 +02:00
|
|
|
|
{
|
2022-09-09 07:31:24 +02:00
|
|
|
|
private readonly CosmosDbClient client;
|
2020-08-10 09:22:33 +02:00
|
|
|
|
|
2022-09-05 22:42:41 +02:00
|
|
|
|
public CosmosDbVersioningStore(
|
2022-09-09 07:31:24 +02:00
|
|
|
|
CosmosDbClient cosmosDbClient)
|
2020-08-10 09:22:33 +02:00
|
|
|
|
{
|
2022-09-09 07:31:24 +02:00
|
|
|
|
this.client = cosmosDbClient;
|
2020-08-10 09:22:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-09 07:31:24 +02:00
|
|
|
|
public Task<IEnumerable<VersionInfo>> GetVersions()
|
2020-08-10 09:22:33 +02:00
|
|
|
|
{
|
2022-09-09 07:31:24 +02:00
|
|
|
|
return this.client.GetItems<VersionInfo>();
|
2020-08-10 09:22:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 22:42:41 +02:00
|
|
|
|
public async Task UpdateVersionInfo(VersionInfo versionInfo)
|
|
|
|
|
{
|
|
|
|
|
await this.client.UpsertItem(versionInfo);
|
|
|
|
|
}
|
2020-08-10 09:22:33 +02:00
|
|
|
|
}
|
|
|
|
|
}
|