1
0
mirror of https://github.com/bitwarden/server synced 2026-01-03 09:03:44 +00:00

WIP: scaffolding for families for enterprise sponsorship flow

This commit is contained in:
Matt Gibson
2021-10-30 13:34:03 -04:00
committed by Justin Baur
parent f9fd83d809
commit 0d9c0bdaea
7 changed files with 258 additions and 28 deletions

View File

@@ -10,5 +10,6 @@ namespace Bit.Core.Repositories
{
Task<OrganizationSponsorship> GetBySponsoringOrganizationUserIdAsync(Guid sponsoringOrganizationUserId);
Task<OrganizationSponsorship> GetBySponsoredOrganizationIdAsync(Guid sponsoredOrganizationId);
Task<OrganizationSponsorship> GetByOfferedToEmailAsync(string email);
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
@@ -26,7 +25,10 @@ namespace Bit.Core.Repositories.SqlServer
{
var results = await connection.QueryAsync<OrganizationSponsorship>(
"[dbo].[OrganizationSponsorship_ReadBySponsoringOrganizationUserId]",
new { SponsoringOrganizationUserId = sponsoringOrganizationUserId },
new
{
SponsoringOrganizationUserId = sponsoringOrganizationUserId
},
commandType: CommandType.StoredProcedure);
return results.SingleOrDefault();
@@ -45,5 +47,21 @@ namespace Bit.Core.Repositories.SqlServer
return results.SingleOrDefault();
}
}
public async Task<OrganizationSponsorship> GetByOfferedToEmailAsync(string offeredToEmail)
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<OrganizationSponsorship>(
"[dbo].[OrganizationSponsorship_ReadByOfferedToEmail]",
new
{
OfferedToEmail = offeredToEmail
},
commandType: CommandType.StoredProcedure);
return results.SingleOrDefault();
}
}
}
}