1
0
mirror of https://github.com/bitwarden/server synced 2026-01-07 19:13:50 +00:00

rollback share if errors

This commit is contained in:
Kyle Spearrin
2017-07-10 16:21:18 -04:00
parent f8c749bab5
commit 72e4062d87
7 changed files with 130 additions and 46 deletions

View File

@@ -8,5 +8,6 @@ namespace Bit.Core.Repositories
public interface IOrganizationRepository : IRepository<Organization, Guid>
{
Task<ICollection<Organization>> GetManyByUserIdAsync(Guid userId);
Task UpdateStorageAsync(Guid id, long storageIncrease);
}
}

View File

@@ -9,5 +9,6 @@ namespace Bit.Core.Repositories
Task<User> GetByEmailAsync(string email);
Task<string> GetPublicKeyAsync(Guid id);
Task<DateTime> GetAccountRevisionDateAsync(Guid id);
Task UpdateStorageAsync(Guid id, long storageIncrease);
}
}

View File

@@ -31,5 +31,17 @@ namespace Bit.Core.Repositories.SqlServer
return results.ToList();
}
}
public async Task UpdateStorageAsync(Guid id, long storageIncrease)
{
using(var connection = new SqlConnection(ConnectionString))
{
await connection.ExecuteAsync(
"[dbo].[Organization_UpdateStorage]",
new { Id = id, StorageIncrease = storageIncrease },
commandType: CommandType.StoredProcedure,
commandTimeout: 180);
}
}
}
}

View File

@@ -78,5 +78,17 @@ namespace Bit.Core.Repositories.SqlServer
commandTimeout: 180);
}
}
public async Task UpdateStorageAsync(Guid id, long storageIncrease)
{
using(var connection = new SqlConnection(ConnectionString))
{
await connection.ExecuteAsync(
$"[{Schema}].[{Table}_UpdateStorage]",
new { Id = id, StorageIncrease = storageIncrease },
commandType: CommandType.StoredProcedure,
commandTimeout: 180);
}
}
}
}