Skip to content

Commit

Permalink
feat: added filament for external lists (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyrch authored Jul 1, 2024
1 parent 61e51a6 commit 09d9c22
Show file tree
Hide file tree
Showing 46 changed files with 1,707 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ public function store(Builder $builder, array $profileParameters): Model
[
ExternalResource::ATTRIBUTE_EXTERNAL_ID => 101573,
ExternalEntry::ATTRIBUTE_SCORE => 10,
ExternalEntry::ATTRIBUTE_IS_FAVOURITE => true,
ExternalEntry::ATTRIBUTE_IS_FAVORITE => true,
ExternalEntry::ATTRIBUTE_WATCH_STATUS => AnimeWatchStatus::COMPLETED->value,
],
[
ExternalResource::ATTRIBUTE_EXTERNAL_ID => 477,
ExternalEntry::ATTRIBUTE_SCORE => 9.5,
ExternalEntry::ATTRIBUTE_IS_FAVOURITE => false,
ExternalEntry::ATTRIBUTE_IS_FAVORITE => false,
ExternalEntry::ATTRIBUTE_WATCH_STATUS => AnimeWatchStatus::WATCHING->value,
],
[
ExternalResource::ATTRIBUTE_EXTERNAL_ID => 934,
ExternalEntry::ATTRIBUTE_SCORE => 8,
ExternalEntry::ATTRIBUTE_IS_FAVOURITE => false,
ExternalEntry::ATTRIBUTE_IS_FAVORITE => false,
ExternalEntry::ATTRIBUTE_WATCH_STATUS => AnimeWatchStatus::PAUSED->value,
],
],
Expand Down
41 changes: 41 additions & 0 deletions app/Events/Base/List/ListCreatedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace App\Events\Base\List;

use App\Constants\Config\ServiceConstants;
use App\Events\Base\BaseCreatedEvent;
use Illuminate\Support\Facades\Config;

/**
* Class ListCreatedEvent.
*
* @template TModel of \App\Models\BaseModel
*
* @extends BaseCreatedEvent<TModel>
*/
abstract class ListCreatedEvent extends BaseCreatedEvent
{
/**
* Get Discord channel the message will be sent to.
*
* @return string
*/
public function getDiscordChannel(): string
{
return Config::get(ServiceConstants::ADMIN_DISCORD_CHANNEL_QUALIFIED);
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return true;
}
}
41 changes: 41 additions & 0 deletions app/Events/Base/List/ListDeletedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace App\Events\Base\List;

use App\Constants\Config\ServiceConstants;
use App\Events\Base\BaseDeletedEvent;
use Illuminate\Support\Facades\Config;

/**
* Class ListDeletedEvent.
*
* @template TModel of \App\Models\BaseModel
*
* @extends BaseDeletedEvent<TModel>
*/
abstract class ListDeletedEvent extends BaseDeletedEvent
{
/**
* Get Discord channel the message will be sent to.
*
* @return string
*/
public function getDiscordChannel(): string
{
return Config::get(ServiceConstants::ADMIN_DISCORD_CHANNEL_QUALIFIED);
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return true;
}
}
41 changes: 41 additions & 0 deletions app/Events/Base/List/ListRestoredEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace App\Events\Base\List;

use App\Constants\Config\ServiceConstants;
use App\Events\Base\BaseRestoredEvent;
use Illuminate\Support\Facades\Config;

/**
* Class ListRestoredEvent.
*
* @template TModel of \App\Models\BaseModel
*
* @extends BaseRestoredEvent<TModel>
*/
abstract class ListRestoredEvent extends BaseRestoredEvent
{
/**
* Get Discord channel the message will be sent to.
*
* @return string
*/
public function getDiscordChannel(): string
{
return Config::get(ServiceConstants::ADMIN_DISCORD_CHANNEL_QUALIFIED);
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return true;
}
}
41 changes: 41 additions & 0 deletions app/Events/Base/List/ListUpdatedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace App\Events\Base\List;

use App\Constants\Config\ServiceConstants;
use App\Events\Base\BaseUpdatedEvent;
use Illuminate\Support\Facades\Config;

/**
* Class ListUpdatedEvent.
*
* @template TModel of \App\Models\BaseModel
*
* @extends BaseUpdatedEvent<TModel>
*/
abstract class ListUpdatedEvent extends BaseUpdatedEvent
{
/**
* Get Discord channel the message will be sent to.
*
* @return string
*/
public function getDiscordChannel(): string
{
return Config::get(ServiceConstants::ADMIN_DISCORD_CHANNEL_QUALIFIED);
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

namespace App\Events\List\ExternalProfile\ExternalEntry;

use App\Events\Base\Admin\AdminCreatedEvent;
use App\Events\Base\List\ListCreatedEvent;
use App\Models\List\External\ExternalEntry;
use App\Models\List\ExternalProfile;

/**
* Class ExternalEntryCreated.
*
* @extends AdminCreatedEvent<ExternalEntry>
* @extends ListCreatedEvent<ExternalEntry>
*/
class ExternalEntryCreated extends AdminCreatedEvent
class ExternalEntryCreated extends ListCreatedEvent
{
/**
* The profile the entry belongs to.
Expand All @@ -33,6 +33,18 @@ public function __construct(ExternalEntry $entry)
$this->profile = $entry->externalprofile;
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return false;
}

/**
* Get the model that has fired this event.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

namespace App\Events\List\ExternalProfile\ExternalEntry;

use App\Events\Base\Admin\AdminDeletedEvent;
use App\Events\Base\List\ListDeletedEvent;
use App\Models\List\ExternalProfile;
use App\Models\List\External\ExternalEntry;

/**
* Class ExternalEntryDeleted.
*
* @extends AdminDeletedEvent<ExternalEntry>
* @extends ListDeletedEvent<ExternalEntry>
*/
class ExternalEntryDeleted extends AdminDeletedEvent
class ExternalEntryDeleted extends ListDeletedEvent
{
/**
* The profile the entry belongs to.
Expand All @@ -33,6 +33,18 @@ public function __construct(ExternalEntry $entry)
$this->profile = $entry->externalprofile;
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return false;
}

/**
* Get the model that has fired this event.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

namespace App\Events\List\ExternalProfile\ExternalEntry;

use App\Events\Base\Admin\AdminRestoredEvent;
use App\Events\Base\List\ListRestoredEvent;
use App\Models\List\ExternalProfile;
use App\Models\List\External\ExternalEntry;

/**
* Class ExternalEntryRestored.
*
* @extends AdminRestoredEvent<ExternalEntry>
* @extends ListRestoredEvent<ExternalEntry>
*/
class ExternalEntryRestored extends AdminRestoredEvent
class ExternalEntryRestored extends ListRestoredEvent
{
/**
* The profile the entry belongs to.
Expand All @@ -33,6 +33,18 @@ public function __construct(ExternalEntry $entry)
$this->profile = $entry->externalprofile;
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return false;
}

/**
* Get the model that has fired this event.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

namespace App\Events\List\ExternalProfile\ExternalEntry;

use App\Events\Base\Admin\AdminUpdatedEvent;
use App\Events\Base\List\ListUpdatedEvent;
use App\Models\List\ExternalProfile;
use App\Models\List\External\ExternalEntry;

/**
* Class ExternalEntryUpdated.
*
* @extends AdminUpdatedEvent<ExternalEntry>
* @extends ListUpdatedEvent<ExternalEntry>
*/
class ExternalEntryUpdated extends AdminUpdatedEvent
class ExternalEntryUpdated extends ListUpdatedEvent
{
/**
* The profile the entry belongs to.
Expand All @@ -34,6 +34,18 @@ public function __construct(ExternalEntry $entry)
$this->initializeEmbedFields($entry);
}

/**
* Determine if the message should be sent.
*
* @return bool
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function shouldSendDiscordMessage(): bool
{
return false;
}

/**
* Get the model that has fired this event.
*
Expand Down
6 changes: 3 additions & 3 deletions app/Events/List/ExternalProfile/ExternalProfileCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace App\Events\List\ExternalProfile;

use App\Events\Base\Admin\AdminCreatedEvent;
use App\Events\Base\List\ListCreatedEvent;
use App\Models\List\ExternalProfile;

/**
* Class ExternalProfileCreated.
*
* @extends AdminCreatedEvent<ExternalProfile>
* @extends ListCreatedEvent<ExternalProfile>
*/
class ExternalProfileCreated extends AdminCreatedEvent
class ExternalProfileCreated extends ListCreatedEvent
{
/**
* Create a new event instance.
Expand Down
Loading

0 comments on commit 09d9c22

Please sign in to comment.