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