Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mail from p2 and cleanup some code #36

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/Console/Commands/RankingReminderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class RankingReminderCommand extends Command

public function handle()
{
dispatch(new ScheduledJobIsRunning("Ranking Reminder Job"));

User::query()
->forRankingReminders()
->get()
Expand Down
7 changes: 2 additions & 5 deletions app/Exports/RankingsExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/RankingDownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
25 changes: 0 additions & 25 deletions app/Jobs/DownloadDataJob.php

This file was deleted.

22 changes: 0 additions & 22 deletions app/Jobs/ScheduledJobIsRunning.php

This file was deleted.

20 changes: 9 additions & 11 deletions app/Models/Ranking.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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')
Expand Down
1 change: 0 additions & 1 deletion app/Notifications/DownloadDataNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down
15 changes: 8 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions config/services.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
<?php

return [

'mailgun' => [
'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'),
],

];
6 changes: 3 additions & 3 deletions resources/js/components/Explore/Explorer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
</div>

<div class="row d-flex jusitfy-content-center" v-else>
<span>TLoading Rankings...</span>
<span>Loading Rankings...</span>
</div>

<ul class="pagination flex justify-end p-4">
<li v-if="ranks.prev_page_url">
<a
class="btn-primary"
class="btn-primary m-2 p-2"
@click.prevent="pageRankings(ranks.prev_page_url)"
href="#"
>
Expand All @@ -48,7 +48,7 @@
</li>
<li v-if="ranks.next_page_url">
<a
class="btn-primary"
class="btn-primary m-2 p-2"
@click.prevent="pageRankings(ranks.next_page_url)"
href="#"
>
Expand Down
6 changes: 3 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\RankingController;
use App\Http\Controllers\RankingDownloadController;
use App\Http\Controllers\SettingsController;
use App\Http\Controllers\UserSettingsController;
use App\Http\Controllers\SongPlacementController;
use App\Http\Controllers\SpotifyAPIController;
use App\Http\Controllers\SpotifyAuthController;
Expand Down Expand Up @@ -44,8 +44,8 @@

/* Settings */
Route::view('/settings', 'settings.index')->name('settings.index');
Route::post('/settings/update', [SettingsController::class, 'update'])->name('settings.update');
Route::post('/settings/destroy', [SettingsController::class, 'destroy'])->name('settings.destroy');
Route::post('/settings/update', [UserSettingsController::class, 'update'])->name('settings.update');
Route::post('/settings/destroy', [UserSettingsController::class, 'destroy'])->name('settings.destroy');
});

/* Pagination & Search routes */
Expand Down
Loading