Skip to content

Commit

Permalink
LiteDbPermissionInfoRepository: Create changed to CreateOrUpdate;
Browse files Browse the repository at this point in the history
  • Loading branch information
k-karuna committed May 27, 2022
1 parent d9d4937 commit 6261dcc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Beacon.Sdk.Sample.Console/DependencyInjectionSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ public async Task Run(IServiceProvider serviceProvider)

byte[] decodedBytes = Base58CheckEncoding.Decode(qrCode);
string message = Encoding.Default.GetString(decodedBytes);

P2PPairingRequest pairingRequest = JsonConvert.DeserializeObject<P2PPairingRequest>(message);

await walletClient.AddPeerAsync(pairingRequest!);

Console.ReadLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Beacon.Sdk.Core.Domain.Interfaces.Data

public interface IPermissionInfoRepository
{
Task<PermissionInfo> Create(PermissionInfo permissionInfo);
Task<PermissionInfo> CreateOrUpdate(PermissionInfo permissionInfo);

Task<PermissionInfo?> TryRead(string accountIdentifier);
}
Expand Down
2 changes: 1 addition & 1 deletion Beacon.Sdk/Core/Domain/ResponseMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private string HandlePermissionResponse(string receiverId, PermissionResponse re
response.Network,
response.Scopes);

_permissionInfoRepository.Create(info);
_permissionInfoRepository.CreateOrUpdate(info);

return _jsonSerializerService.Serialize(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public LiteDbPermissionInfoRepository(ILogger<LiteDbPermissionInfoRepository> lo
{
}

public Task<PermissionInfo> Create(PermissionInfo permissionInfo) => InConnection(col =>
public Task<PermissionInfo> CreateOrUpdate(PermissionInfo permissionInfo) => InConnection(col =>
{
col.Insert(permissionInfo);
col.Upsert(permissionInfo);
col.EnsureIndex(x => x.AccountIdentifier);

return Task.FromResult(permissionInfo);
Expand Down

0 comments on commit 6261dcc

Please sign in to comment.