mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
nostr events schedule
This commit is contained in:
@@ -26,6 +26,7 @@ class PublishUnpublishedItems extends Command
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
config(['app.user-timezone' => 'Europe/Berlin']);
|
||||
$modelName = $this->option('model');
|
||||
$className = '\\App\Models\\'.$modelName;
|
||||
$model = $className::query()
|
||||
@@ -33,6 +34,7 @@ class PublishUnpublishedItems extends Command
|
||||
->when($modelName === 'BitcoinEvent', fn($q) => $q->where('from', '>', now()))
|
||||
->when($modelName === 'CourseEvent', fn($q) => $q->where('from', '>', now()))
|
||||
->when($modelName === 'MeetupEvent', fn($q) => $q->where('start', '>', now()))
|
||||
->when($modelName === 'LibraryItem', fn($q) => $q->where('type', '<>', 'markdown_article'))
|
||||
->first();
|
||||
$this->publishOnNostr($model, $this->getText($model));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Console;
|
||||
|
||||
use App\Console\Commands\Database\CleanupLoginKeys;
|
||||
use App\Console\Commands\Feed\ReadAndSyncPodcastFeeds;
|
||||
use App\Console\Commands\Nostr\PublishUnpublishedItems;
|
||||
use App\Console\Commands\OpenBooks\SyncOpenBooks;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
@@ -29,6 +30,34 @@ class Kernel extends ConsoleKernel
|
||||
->dailyAt('04:30');
|
||||
$schedule->command(CleanupLoginKeys::class)
|
||||
->everyFifteenMinutes();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'LibraryItem',
|
||||
])
|
||||
->everySixHours();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'BitcoinEvent',
|
||||
])
|
||||
->hourly();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'CourseEvent',
|
||||
])
|
||||
->everyTwoHours();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'MeetupEvent',
|
||||
])
|
||||
->everyThreeHours();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'Meetup',
|
||||
])
|
||||
->everyFourHours();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'Course',
|
||||
])
|
||||
->everySixHours();
|
||||
$schedule->command(PublishUnpublishedItems::class, [
|
||||
'--model' => 'OrangePill',
|
||||
])
|
||||
->everyFourHours();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user