This commit is contained in:
Nicolas Constant 2023-01-05 23:58:58 -05:00
parent 3460c72895
commit 5b32a9021f
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 21 additions and 20 deletions

View File

@ -3,29 +3,30 @@ using System.Threading.Tasks;
using BirdsiteLive.DAL.Contracts;
using BirdsiteLive.DAL.Models;
namespace BirdsiteLive.Pipeline.Processors.SubTasks;
public class SendTweetsTaskBase
namespace BirdsiteLive.Pipeline.Processors.SubTasks
{
private readonly ISyncTweetsPostgresDal _syncTweetsPostgresDal;
#region Ctor
protected SendTweetsTaskBase(ISyncTweetsPostgresDal syncTweetsPostgresDal)
public class SendTweetsTaskBase
{
_syncTweetsPostgresDal = syncTweetsPostgresDal;
}
#endregion
private readonly ISyncTweetsPostgresDal _syncTweetsPostgresDal;
protected async Task SaveSyncTweetAsync(string acct, long tweetId, string host, string inbox)
{
var inboxUrl = $"https://{host}/{inbox.Trim('/')}";
var tweet = new SyncTweet
#region Ctor
protected SendTweetsTaskBase(ISyncTweetsPostgresDal syncTweetsPostgresDal)
{
Acct = acct,
TweetId = tweetId,
PublishedAt = DateTime.UtcNow,
Inbox = inboxUrl
};
await _syncTweetsPostgresDal.SaveTweetAsync(tweet);
_syncTweetsPostgresDal = syncTweetsPostgresDal;
}
#endregion
protected async Task SaveSyncTweetAsync(string acct, long tweetId, string host, string inbox)
{
var inboxUrl = $"https://{host}/{inbox.Trim('/')}";
var tweet = new SyncTweet
{
Acct = acct,
TweetId = tweetId,
PublishedAt = DateTime.UtcNow,
Inbox = inboxUrl
};
await _syncTweetsPostgresDal.SaveTweetAsync(tweet);
}
}
}