1
0
mirror of https://github.com/bitwarden/server synced 2025-12-30 15:14:02 +00:00

refactor for cipher details, folders, favorites

This commit is contained in:
Kyle Spearrin
2017-03-18 11:58:02 -04:00
parent 2b71420818
commit 588f6c7c2c
15 changed files with 139 additions and 138 deletions

View File

@@ -21,15 +21,17 @@ namespace Bit.Core.Repositories.SqlServer
: base(connectionString)
{ }
public async Task<Cipher> GetByIdAsync(Guid id, Guid userId)
public async Task<CipherDetails> GetByIdAsync(Guid id, Guid userId)
{
var cipher = await GetByIdAsync(id);
if(cipher == null || cipher.UserId != userId)
using(var connection = new SqlConnection(ConnectionString))
{
return null;
}
var results = await connection.QueryAsync<CipherDetails>(
$"[{Schema}].[CipherDetails_ReadById]",
new { Id = id },
commandType: CommandType.StoredProcedure);
return cipher;
return results.FirstOrDefault(c => c.UserId == userId);
}
}
public async Task<ICollection<CipherDetails>> GetManyByUserIdAsync(Guid userId)