mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 00:52:49 -05:00
dep. history and favorites apis. backwards compat
This commit is contained in:
@ -1,30 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
[Obsolete]
|
||||
public class CipherHistoryResponseModel : ResponseModel
|
||||
{
|
||||
public CipherHistoryResponseModel(IEnumerable<Cipher> revisedCiphers, IEnumerable<Guid> deletedIds, Guid userId)
|
||||
public CipherHistoryResponseModel()
|
||||
: base("cipherHistory")
|
||||
{
|
||||
if(revisedCiphers == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(revisedCiphers));
|
||||
}
|
||||
{ }
|
||||
|
||||
if(deletedIds == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(deletedIds));
|
||||
}
|
||||
|
||||
//Revised = revisedCiphers.Select(c => new CipherResponseModel(c));
|
||||
Deleted = deletedIds.Select(id => id.ToString());
|
||||
}
|
||||
|
||||
public IEnumerable<CipherResponseModel> Revised { get; set; }
|
||||
public IEnumerable<string> Deleted { get; set; }
|
||||
public IEnumerable<CipherResponseModel> Revised { get; set; } = new List<CipherResponseModel>();
|
||||
public IEnumerable<string> Deleted { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,6 @@ namespace Bit.Core.Repositories
|
||||
Task<ICollection<CipherDetails>> GetManyByUserIdAsync(Guid userId);
|
||||
Task<ICollection<CipherDetails>> GetManyByUserIdHasSubvaultsAsync(Guid userId);
|
||||
Task<ICollection<CipherDetails>> GetManyByTypeAndUserIdAsync(Enums.CipherType type, Guid userId);
|
||||
Task<Tuple<ICollection<CipherDetails>, ICollection<Guid>>> GetManySinceRevisionDateAndUserIdWithDeleteHistoryAsync(
|
||||
DateTime sinceRevisionDate, Guid userId);
|
||||
Task CreateAsync(CipherDetails cipher);
|
||||
Task ReplaceAsync(CipherDetails cipher);
|
||||
Task UpsertAsync(CipherDetails cipher);
|
||||
|
@ -92,27 +92,6 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Tuple<ICollection<CipherDetails>, ICollection<Guid>>>
|
||||
GetManySinceRevisionDateAndUserIdWithDeleteHistoryAsync(DateTime sinceRevisionDate, Guid userId)
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryMultipleAsync(
|
||||
$"[{Schema}].[CipherDetails_ReadByRevisionDateUserWithDeleteHistory]",
|
||||
new
|
||||
{
|
||||
SinceRevisionDate = sinceRevisionDate,
|
||||
UserId = userId
|
||||
},
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
var ciphers = await results.ReadAsync<CipherDetails>();
|
||||
var deletes = await results.ReadAsync<Guid>();
|
||||
|
||||
return new Tuple<ICollection<CipherDetails>, ICollection<Guid>>(ciphers.ToList(), deletes.ToList());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(CipherDetails cipher)
|
||||
{
|
||||
cipher.SetNewId();
|
||||
|
Reference in New Issue
Block a user