1
0
mirror of https://github.com/bitwarden/server synced 2026-01-01 16:13:33 +00:00

Typed ids as guids in repositories. Removed unused repo methods.

This commit is contained in:
Kyle Spearrin
2016-03-09 18:11:52 -05:00
parent 994f27ff40
commit 8d57b21f97
8 changed files with 11 additions and 24 deletions

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}
}