mirror of
https://github.com/bitwarden/server
synced 2025-12-24 20:23:21 +00:00
* Revert "Add git blame entry (#2226)" This reverts commit239286737d. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit34fb4cca2a.
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.Repositories;
|
|
using Bit.Core.Settings;
|
|
using Dapper;
|
|
|
|
namespace Bit.Infrastructure.Dapper.Repositories
|
|
{
|
|
public class SendRepository : Repository<Send, Guid>, ISendRepository
|
|
{
|
|
public SendRepository(GlobalSettings globalSettings)
|
|
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
|
|
{ }
|
|
|
|
public SendRepository(string connectionString, string readOnlyConnectionString)
|
|
: base(connectionString, readOnlyConnectionString)
|
|
{ }
|
|
|
|
public async Task<ICollection<Send>> GetManyByUserIdAsync(Guid userId)
|
|
{
|
|
using (var connection = new SqlConnection(ConnectionString))
|
|
{
|
|
var results = await connection.QueryAsync<Send>(
|
|
$"[{Schema}].[Send_ReadByUserId]",
|
|
new { UserId = userId },
|
|
commandType: CommandType.StoredProcedure);
|
|
|
|
return results.ToList();
|
|
}
|
|
}
|
|
|
|
public async Task<ICollection<Send>> GetManyByDeletionDateAsync(DateTime deletionDateBefore)
|
|
{
|
|
using (var connection = new SqlConnection(ConnectionString))
|
|
{
|
|
var results = await connection.QueryAsync<Send>(
|
|
$"[{Schema}].[Send_ReadByDeletionDateBefore]",
|
|
new { DeletionDate = deletionDateBefore },
|
|
commandType: CommandType.StoredProcedure);
|
|
|
|
return results.ToList();
|
|
}
|
|
}
|
|
}
|
|
}
|