mirror of
https://github.com/bitwarden/server.git
synced 2025-01-21 21:41:21 +01:00
Typed ids as guids in repositories. Removed unused repo methods.
This commit is contained in:
parent
994f27ff40
commit
8d57b21f97
@ -36,7 +36,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public async Task<ListResponseModel<FolderResponseModel>> Get(bool dirty = false)
|
||||
public async Task<ListResponseModel<FolderResponseModel>> Get()
|
||||
{
|
||||
var folders = await _folderRepository.GetManyByUserIdAsync(User.GetUserId());
|
||||
return new ListResponseModel<FolderResponseModel>(folders.Select(f => new FolderResponseModel(f)));
|
||||
|
@ -42,9 +42,9 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public async Task<ListResponseModel<SiteResponseModel>> Get(bool dirty = false, string[] expand = null)
|
||||
public async Task<ListResponseModel<SiteResponseModel>> Get(string[] expand = null)
|
||||
{
|
||||
var sites = await _siteRepository.GetManyByUserIdAsync(User.GetUserId(), dirty);
|
||||
var sites = await _siteRepository.GetManyByUserIdAsync(User.GetUserId());
|
||||
|
||||
var responses = sites.Select(s => new SiteResponseModel(s)).ToList();
|
||||
await ExpandManyAsync(sites, responses, expand, null);
|
||||
|
@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Bit.Core.Domains;
|
||||
using Microsoft.AspNet.Authentication.JwtBearer;
|
||||
|
||||
namespace Bit.Core.Identity
|
||||
|
@ -8,6 +8,5 @@ namespace Bit.Core.Repositories
|
||||
{
|
||||
Task<Folder> GetByIdAsync(string id, string userId);
|
||||
Task<ICollection<Folder>> GetManyByUserIdAsync(string userId);
|
||||
Task<ICollection<Folder>> GetManyByUserIdAsync(string userId, bool dirty);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,5 @@ namespace Bit.Core.Repositories
|
||||
{
|
||||
Task<Site> GetByIdAsync(string id, string userId);
|
||||
Task<ICollection<Site>> GetManyByUserIdAsync(string userId);
|
||||
Task<ICollection<Site>> GetManyByUserIdAsync(string userId, bool dirty);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
@ -32,16 +33,11 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
{
|
||||
var results = await connection.QueryAsync<FolderTableModel>(
|
||||
$"[{Schema}].[{Table}_ReadByUserId]",
|
||||
new { UserId = userId },
|
||||
new { UserId = new Guid(userId) },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.Select(f => f.ToDomain()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Folder>> GetManyByUserIdAsync(string userId, bool dirty)
|
||||
{
|
||||
return await GetManyByUserIdAsync(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
{
|
||||
var results = await connection.QueryAsync<TModel>(
|
||||
$"[{Schema}].[{Table}_ReadById]",
|
||||
new { Id = id },
|
||||
new { Id = new Guid(id) },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
var model = results.FirstOrDefault();
|
||||
@ -96,7 +96,7 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
{
|
||||
await connection.ExecuteAsync(
|
||||
$"[{Schema}].[{Table}_DeleteById]",
|
||||
new { Id = id },
|
||||
new { Id = new Guid(id) },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
@ -32,16 +33,11 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
{
|
||||
var results = await connection.QueryAsync<SiteTableModel>(
|
||||
$"[{Schema}].[{Table}_ReadByUserId]",
|
||||
new { UserId = userId },
|
||||
new { UserId = new Guid(userId) },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.Select(s => s.ToDomain()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Site>> GetManyByUserIdAsync(string userId, bool dirty)
|
||||
{
|
||||
return await GetManyByUserIdAsync(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user