added foolproofing

This commit is contained in:
Nicolas Constant 2020-07-06 00:55:56 -04:00
parent cdfb045c90
commit d846756a7f
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688

View file

@ -22,13 +22,15 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
public async Task CreateTwitterUserAsync(string acct, long lastTweetPostedId)
{
acct = acct.ToLowerInvariant();
using (var dbConnection = Connection)
{
dbConnection.Open();
await dbConnection.ExecuteAsync(
$"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";
acct = acct.ToLowerInvariant();
using (var dbConnection = Connection)
{
dbConnection.Open();
@ -78,6 +82,8 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
{
if (acct == default) throw new ArgumentException("acct");
acct = acct.ToLowerInvariant();
var query = $"DELETE FROM {_settings.TwitterUserTableName} WHERE acct = @acct";
using (var dbConnection = Connection)