BirdsiteLive/src/BirdsiteLive.Pipeline/Processors/Federation/SubTasks/SendTweetsTaskBase.cs

32 lines
916 B
C#
Raw Normal View History

2023-01-06 05:55:50 +01:00
using System;
using System.Threading.Tasks;
using BirdsiteLive.DAL.Contracts;
using BirdsiteLive.DAL.Models;
2023-01-06 05:58:58 +01:00
namespace BirdsiteLive.Pipeline.Processors.SubTasks
2023-01-06 05:55:50 +01:00
{
2023-01-06 05:58:58 +01:00
public class SendTweetsTaskBase
2023-01-06 05:55:50 +01:00
{
2023-01-06 05:58:58 +01:00
private readonly ISyncTweetsPostgresDal _syncTweetsPostgresDal;
2023-01-06 05:55:50 +01:00
2023-01-06 05:58:58 +01:00
#region Ctor
protected SendTweetsTaskBase(ISyncTweetsPostgresDal syncTweetsPostgresDal)
{
_syncTweetsPostgresDal = syncTweetsPostgresDal;
}
#endregion
protected async Task SaveSyncTweetAsync(string acct, long tweetId, string host, string inbox)
2023-01-06 05:55:50 +01:00
{
2023-01-06 05:58:58 +01:00
var tweet = new SyncTweet
{
Acct = acct,
TweetId = tweetId,
PublishedAt = DateTime.UtcNow,
2023-01-06 08:08:57 +01:00
Inbox = inbox,
Host = host
2023-01-06 05:58:58 +01:00
};
await _syncTweetsPostgresDal.SaveTweetAsync(tweet);
}
2023-01-06 05:55:50 +01:00
}
}