added foolproofing
This commit is contained in:
parent
cdfb045c90
commit
d846756a7f
|
@ -22,13 +22,15 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
|
||||||
|
|
||||||
public async Task CreateTwitterUserAsync(string acct, long lastTweetPostedId)
|
public async Task CreateTwitterUserAsync(string acct, long lastTweetPostedId)
|
||||||
{
|
{
|
||||||
|
acct = acct.ToLowerInvariant();
|
||||||
|
|
||||||
using (var dbConnection = Connection)
|
using (var dbConnection = Connection)
|
||||||
{
|
{
|
||||||
dbConnection.Open();
|
dbConnection.Open();
|
||||||
|
|
||||||
await dbConnection.ExecuteAsync(
|
await dbConnection.ExecuteAsync(
|
||||||
$"INSERT INTO {_settings.TwitterUserTableName} (acct,lastTweetPostedId,lastTweetSynchronizedForAllFollowersId) VALUES(@acct,@lastTweetPostedId,@lastTweetSynchronizedForAllFollowersId)",
|
$"INSERT INTO {_settings.TwitterUserTableName} (acct,lastTweetPostedId,lastTweetSynchronizedForAllFollowersId) VALUES(@acct,@lastTweetPostedId,@lastTweetSynchronizedForAllFollowersId)",
|
||||||
new { acct = acct, lastTweetPostedId = lastTweetPostedId, lastTweetSynchronizedForAllFollowersId = lastTweetPostedId });
|
new { acct, lastTweetPostedId, lastTweetSynchronizedForAllFollowersId = lastTweetPostedId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
|
||||||
{
|
{
|
||||||
var query = $"SELECT * FROM {_settings.TwitterUserTableName} WHERE acct = @acct";
|
var query = $"SELECT * FROM {_settings.TwitterUserTableName} WHERE acct = @acct";
|
||||||
|
|
||||||
|
acct = acct.ToLowerInvariant();
|
||||||
|
|
||||||
using (var dbConnection = Connection)
|
using (var dbConnection = Connection)
|
||||||
{
|
{
|
||||||
dbConnection.Open();
|
dbConnection.Open();
|
||||||
|
@ -78,6 +82,8 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
|
||||||
{
|
{
|
||||||
if (acct == default) throw new ArgumentException("acct");
|
if (acct == default) throw new ArgumentException("acct");
|
||||||
|
|
||||||
|
acct = acct.ToLowerInvariant();
|
||||||
|
|
||||||
var query = $"DELETE FROM {_settings.TwitterUserTableName} WHERE acct = @acct";
|
var query = $"DELETE FROM {_settings.TwitterUserTableName} WHERE acct = @acct";
|
||||||
|
|
||||||
using (var dbConnection = Connection)
|
using (var dbConnection = Connection)
|
||||||
|
|
Loading…
Reference in New Issue