Skip to content

Commit

Permalink
remove route (get from beatmapset instead)
Browse files Browse the repository at this point in the history
  • Loading branch information
notbakaneko committed Dec 17, 2024
1 parent f5552af commit 5ad134a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 42 deletions.
9 changes: 0 additions & 9 deletions app/Http/Controllers/BeatmapTagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ public function __construct()
'destroy',
],
]);

$this->middleware('require-scopes:public', ['only' => 'index']);
}

public function index($beatmapId)
{
return [
'beatmap_tags' => Beatmap::findOrFail($beatmapId)->topTagsJson(),
];
}

public function destroy($beatmapId, $tagId)
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
});
});

Route::apiResource('tags', 'BeatmapTagsController', ['only' => ['index', 'store', 'destroy']]);
Route::apiResource('tags', 'BeatmapTagsController', ['only' => ['store', 'destroy']]);
});
});

Expand Down
16 changes: 0 additions & 16 deletions tests/Controllers/BeatmapTagsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use App\Models\Solo\Score;
use App\Models\Tag;
use App\Models\User;
use Illuminate\Testing\Fluent\AssertableJson;
use Tests\TestCase;

class BeatmapTagsControllerTest extends TestCase
Expand All @@ -21,21 +20,6 @@ class BeatmapTagsControllerTest extends TestCase
private Beatmap $beatmap;
private BeatmapTag $beatmapTag;

public function testIndex(): void
{
$this->actAsScopedUser(User::factory()->create(), ['public']);

$this
->get(route('api.beatmaps.tags.index', ['beatmap' => $this->beatmap->getKey()]))
->assertSuccessful()
->assertJson(fn (AssertableJson $json) =>
$json
->where('beatmap_tags.0.id', $this->tag->getKey())
->where('beatmap_tags.0.name', $this->tag->name)
->where('beatmap_tags.0.count', 1)
->etc());
}

public function testStore(): void
{
$user = User::factory()
Expand Down
16 changes: 0 additions & 16 deletions tests/api_routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,6 @@
],
"scopes": []
},
{
"uri": "api/v2/beatmaps/{beatmap}/tags",
"methods": [
"GET",
"HEAD"
],
"controller": "App\\Http\\Controllers\\BeatmapTagsController@index",
"middlewares": [
"App\\Http\\Middleware\\ThrottleRequests:1200,1,api:",
"App\\Http\\Middleware\\RequireScopes",
"App\\Http\\Middleware\\RequireScopes:public"
],
"scopes": [
"public"
]
},
{
"uri": "api/v2/beatmaps/{beatmap}/tags",
"methods": [
Expand Down

0 comments on commit 5ad134a

Please sign in to comment.