-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from kyledoesdev/feature/dev-ops
Added Unit Tests & Some Restful refactors
- Loading branch information
Showing
37 changed files
with
1,894 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ yarn-error.log | |
/.fleet | ||
/.idea | ||
/.vscode | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Ranking; | ||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
use Illuminate\View\View; | ||
|
||
class ProfileController extends Controller | ||
{ | ||
public function show(string $id): View | ||
{ | ||
$user = User::where('spotify_id', $id)->first(); | ||
|
||
return view('profile.show', [ | ||
'user' => $user, | ||
'rankings' => Ranking::query() | ||
->forProfilePage($user) | ||
->paginate(5) | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Jobs\DownloadDataJob; | ||
use App\Models\Ranking; | ||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
|
||
class RankingDownloadController extends Controller | ||
{ | ||
public function index(): JsonResponse | ||
{ | ||
$rankings = Ranking::query() | ||
->where('user_id', auth()->id()) | ||
->with('songs', 'artist') | ||
->get(); | ||
|
||
DownloadDataJob::dispatch($rankings, auth()->user()); | ||
|
||
return response()->json([ | ||
'success' => true, | ||
'message' => "Your download has started and will be emailed to you when completed!" | ||
], 200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests\Song\Placement\StoreSongPlacementRequest; | ||
use App\Models\Ranking; | ||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
|
||
class SongPlacementController extends Controller | ||
{ | ||
public function store(StoreSongPlacementRequest $request): JsonResponse | ||
{ | ||
Ranking::complete(collect($request->songs), $request->rankingId); | ||
|
||
session()->flash('success', 'Song rankings were successfuly placed!'); | ||
|
||
return response()->json([ | ||
'redirect' => route('home'), | ||
], 200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...equests/Rankings/FinishRankingRequest.php → ...s/Placement/StoreSongPlacementRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.