diff --git a/app/Console/Commands/RankingReminderCommand.php b/app/Console/Commands/RankingReminderCommand.php index fd9548c..f41e398 100644 --- a/app/Console/Commands/RankingReminderCommand.php +++ b/app/Console/Commands/RankingReminderCommand.php @@ -17,8 +17,6 @@ class RankingReminderCommand extends Command public function handle() { - dispatch(new ScheduledJobIsRunning("Ranking Reminder Job")); - User::query() ->forRankingReminders() ->get() diff --git a/app/Exports/RankingsExport.php b/app/Exports/RankingsExport.php index 2576796..a0046ab 100644 --- a/app/Exports/RankingsExport.php +++ b/app/Exports/RankingsExport.php @@ -8,16 +8,13 @@ class RankingsExport implements WithMultipleSheets { - public function __construct(private Collection $rankings){} + public function __construct(private Collection $rankings) {} - /** - * @return array - */ public function sheets(): array { $sheets = []; - foreach($this->rankings as $ranking) { + foreach ($this->rankings as $ranking) { $sheets[] = new SongExport($ranking->songs, $ranking->name); } diff --git a/app/Http/Controllers/RankingDownloadController.php b/app/Http/Controllers/RankingDownloadController.php index b7507ab..40b2fac 100644 --- a/app/Http/Controllers/RankingDownloadController.php +++ b/app/Http/Controllers/RankingDownloadController.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; -use App\Jobs\DownloadDataJob; use App\Models\Ranking; +use App\Notifications\DownloadDataNotification; use Illuminate\Http\JsonResponse; -use Illuminate\Http\Request; +use Illuminate\Support\Facades\Notification; class RankingDownloadController extends Controller { @@ -16,7 +16,7 @@ public function index(): JsonResponse ->with('songs', 'artist') ->get(); - DownloadDataJob::dispatch($rankings, auth()->user()); + defer(fn() => Notification::send(auth()->user(), new DownloadDataNotification($rankings))); return response()->json([ 'success' => true, diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/UserSettingsController.php similarity index 96% rename from app/Http/Controllers/SettingsController.php rename to app/Http/Controllers/UserSettingsController.php index abb3931..023cdcf 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/UserSettingsController.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log;; -class SettingsController extends Controller +class UserSettingsController extends Controller { public function destroy(UserDeletionRequest $request): JsonResponse { diff --git a/app/Jobs/DownloadDataJob.php b/app/Jobs/DownloadDataJob.php deleted file mode 100644 index e5cb7f8..0000000 --- a/app/Jobs/DownloadDataJob.php +++ /dev/null @@ -1,25 +0,0 @@ -user, new DownloadDataNotification($this->rankings)); - } -} diff --git a/app/Jobs/ScheduledJobIsRunning.php b/app/Jobs/ScheduledJobIsRunning.php deleted file mode 100644 index 561fa5c..0000000 --- a/app/Jobs/ScheduledJobIsRunning.php +++ /dev/null @@ -1,22 +0,0 @@ -job} at " . now()->format('m/d/Y g:i:s')); - } -} diff --git a/app/Models/Ranking.php b/app/Models/Ranking.php index b158030..7c3e336 100644 --- a/app/Models/Ranking.php +++ b/app/Models/Ranking.php @@ -120,12 +120,11 @@ public function scopeForExplorePage(Builder $query, ?string $search = null) ->where('is_ranked', true) ->where('is_public', true) ->when($search != null, function($query) use ($search) { - $query->newQuery() - ->where(function($query2) use ($search) { - $query2->newQuery() - ->whereHas('artist', fn($q) => $q->where('artist_name', 'LIKE', "%{$search}%")) - ->orWhere('name', 'LIKE', "%{$search}%"); - }); + $query->where(function($query2) use ($search) { + $query2->newQuery() + ->whereHas('artist', fn($q) => $q->where('artist_name', 'LIKE', "%{$search}%")) + ->orWhere('name', 'LIKE', "%{$search}%"); + }); }) ->with('user', 'artist') ->with('songs', fn($q) => $q->where('rank', 1)) @@ -137,11 +136,10 @@ public function scopeForProfilePage(Builder $query, $user) { $query->newQuery() ->where('user_id', $user ? $user->getKey() : auth()->id()) - ->when($user && $user->getKey() !== auth()->id(), - fn($q) => $q->newQuery() - ->where('is_ranked', true) - ->where('is_public', true) - ) + ->when($user && $user->getKey() !== auth()->id(), function($query2) { + $query2->where('is_ranked', true) + ->where('is_public', true); + }) ->with('user', 'artist') ->with('songs', fn($q) => $q->where('rank', 1)) ->withCount('songs') diff --git a/app/Notifications/DownloadDataNotification.php b/app/Notifications/DownloadDataNotification.php index e88aa84..a298c0d 100644 --- a/app/Notifications/DownloadDataNotification.php +++ b/app/Notifications/DownloadDataNotification.php @@ -25,7 +25,6 @@ public function toMail(object $notifiable): MailMessage { return (new MailMessage) ->markdown('emails.downloaded-data', ['notifiable' => $notifiable]) - ->from(env("MAIL_FROM_ADDRESS")) ->subject("song-rank.dev - Data Download Complete") ->attach(Excel::download(new RankingsExport($this->rankings), 'rankings.xlsx')->getFile(), ['as' => 'rankings.xlsx']); } diff --git a/composer.lock b/composer.lock index c1503ba..9d0ab9a 100644 --- a/composer.lock +++ b/composer.lock @@ -1671,16 +1671,16 @@ }, { "name": "laravel/framework", - "version": "v11.23.4", + "version": "v11.30.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "08b46ae7be52f71688196f98556d21cb2ec799b6" + "reference": "dff716442d9c229d716be82ccc9a7de52eb97193" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/08b46ae7be52f71688196f98556d21cb2ec799b6", - "reference": "08b46ae7be52f71688196f98556d21cb2ec799b6", + "url": "https://api.github.com/repos/laravel/framework/zipball/dff716442d9c229d716be82ccc9a7de52eb97193", + "reference": "dff716442d9c229d716be82ccc9a7de52eb97193", "shasum": "" }, "require": { @@ -1699,7 +1699,7 @@ "fruitcake/php-cors": "^1.3", "guzzlehttp/guzzle": "^7.8", "guzzlehttp/uri-template": "^1.0", - "laravel/prompts": "^0.1.18", + "laravel/prompts": "^0.1.18|^0.2.0|^0.3.0", "laravel/serializable-closure": "^1.3", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", @@ -1785,7 +1785,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^9.4.0", + "orchestra/testbench-core": "^9.5", "pda/pheanstalk": "^5.0", "phpstan/phpstan": "^1.11.5", "phpunit/phpunit": "^10.5|^11.0", @@ -1844,6 +1844,7 @@ "src/Illuminate/Filesystem/functions.php", "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Log/functions.php", + "src/Illuminate/Support/functions.php", "src/Illuminate/Support/helpers.php" ], "psr-4": { @@ -1875,7 +1876,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-09-12T14:57:48+00:00" + "time": "2024-10-30T15:00:34+00:00" }, { "name": "laravel/prompts", diff --git a/config/services.php b/config/services.php index a9e5d76..8f68487 100644 --- a/config/services.php +++ b/config/services.php @@ -1,18 +1,9 @@ [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), - 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), - 'scheme' => 'https', - ], - 'spotify' => [ 'client_id' => env('SPOTIFY_CLIENT_ID'), 'client_secret' => env('SPOTIFY_CLIENT_SECRET'), 'redirect' => env('SPOTIFY_REDIRECT_URI'), ], - ]; diff --git a/resources/js/components/Explore/Explorer.vue b/resources/js/components/Explore/Explorer.vue index 4382821..16bab5b 100644 --- a/resources/js/components/Explore/Explorer.vue +++ b/resources/js/components/Explore/Explorer.vue @@ -33,13 +33,13 @@