mirror of
https://github.com/bitwarden/server.git
synced 2025-07-06 10:32:49 -05:00
Add cipher response to restore (#1072)
* Return revised ciphers on restore api call * Return restored date from restore sproc * Test Restore updates passed in ciphers This is necessary for CipherController to appropriately return the up-to-date ciphers without an extra db call to read them. * Add missing SELECT
This commit is contained in:
@ -35,6 +35,6 @@ namespace Bit.Core.Repositories
|
||||
IEnumerable<CollectionCipher> collectionCiphers);
|
||||
Task SoftDeleteAsync(IEnumerable<Guid> ids, Guid userId);
|
||||
Task SoftDeleteByIdsOrganizationIdAsync(IEnumerable<Guid> ids, Guid organizationId);
|
||||
Task RestoreAsync(IEnumerable<Guid> ids, Guid userId);
|
||||
Task<DateTime> RestoreAsync(IEnumerable<Guid> ids, Guid userId);
|
||||
}
|
||||
}
|
||||
|
@ -610,14 +610,16 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RestoreAsync(IEnumerable<Guid> ids, Guid userId)
|
||||
public async Task<DateTime> RestoreAsync(IEnumerable<Guid> ids, Guid userId)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.ExecuteAsync(
|
||||
var results = await connection.ExecuteScalarAsync<DateTime>(
|
||||
$"[{Schema}].[Cipher_Restore]",
|
||||
new { Ids = ids.ToGuidIdArrayTVP(), UserId = userId },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user