mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
Added "since" revision date parameter to folder and site "get all" APIs.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Domains;
|
||||
|
||||
@ -8,5 +9,6 @@ namespace Bit.Core.Repositories
|
||||
{
|
||||
Task<Folder> GetByIdAsync(string id, string userId);
|
||||
Task<ICollection<Folder>> GetManyByUserIdAsync(string userId);
|
||||
Task<ICollection<Folder>> GetManyByRevisionDateAsync(string userId, DateTime sinceRevisionDate);
|
||||
}
|
||||
}
|
||||
|
@ -9,5 +9,6 @@ namespace Bit.Core.Repositories
|
||||
{
|
||||
Task<Site> GetByIdAsync(string id, string userId);
|
||||
Task<ICollection<Site>> GetManyByUserIdAsync(string userId);
|
||||
Task<ICollection<Site>> GetManyByRevisionDateAsync(string userId, DateTime sinceRevisionDate);
|
||||
}
|
||||
}
|
||||
|
@ -39,5 +39,18 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
return results.Select(f => f.ToDomain()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Folder>> GetManyByRevisionDateAsync(string userId, DateTime sinceRevisionDate)
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<FolderTableModel>(
|
||||
$"[{Schema}].[{Table}_ReadByRevisionDate]",
|
||||
new { UserId = new Guid(userId), SinceRevisionDate = sinceRevisionDate },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.Select(f => f.ToDomain()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,5 +39,18 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
return results.Select(s => s.ToDomain()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Site>> GetManyByRevisionDateAsync(string userId, DateTime sinceRevisionDate)
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<SiteTableModel>(
|
||||
$"[{Schema}].[{Table}_ReadByRevisionDate]",
|
||||
new { UserId = new Guid(userId), SinceRevisionDate = sinceRevisionDate },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.Select(f => f.ToDomain()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user