1
0
mirror of https://github.com/bitwarden/server synced 2025-12-18 01:03:17 +00:00

[AC-1900] Update Vault DB to support provider billing (#3875)

* Add Gateway columns to Provider table

* Add ProviderId column to Transaction table

* Create ProviderPlan table

* Matt's feedback

* Rui's feedback

* Fixed Gateway parameter on Provider
This commit is contained in:
Alex Morask
2024-03-21 11:15:49 -04:00
committed by GitHub
parent 43ee5a24ec
commit 9f7e05869e
44 changed files with 9139 additions and 45 deletions

View File

@@ -0,0 +1,28 @@
using System.Data;
using Bit.Core.Billing.Entities;
using Bit.Core.Billing.Repositories;
using Bit.Core.Settings;
using Bit.Infrastructure.Dapper.Repositories;
using Dapper;
using Microsoft.Data.SqlClient;
namespace Bit.Infrastructure.Dapper.Billing.Repositories;
public class ProviderPlanRepository(
GlobalSettings globalSettings)
: Repository<ProviderPlan, Guid>(
globalSettings.SqlServer.ConnectionString,
globalSettings.SqlServer.ReadOnlyConnectionString), IProviderPlanRepository
{
public async Task<ProviderPlan> GetByProviderId(Guid providerId)
{
var sqlConnection = new SqlConnection(ConnectionString);
var results = await sqlConnection.QueryAsync<ProviderPlan>(
"[dbo].[ProviderPlan_ReadByProviderId]",
new { ProviderId = providerId },
commandType: CommandType.StoredProcedure);
return results.FirstOrDefault();
}
}