Skip to content

Commit

Permalink
Merge pull request #11824 from notbakaneko/feature/beatmap-owners-mor…
Browse files Browse the repository at this point in the history
…e-endpoints

Include beatmap owners in additional Beatmap API responses
  • Loading branch information
nanaya authored Jan 28, 2025
2 parents f658d46 + 6fe306b commit d470f0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/BeatmapsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class BeatmapsController extends Controller
{
const DEFAULT_API_INCLUDES = ['beatmapset.ratings', 'failtimes', 'max_combo'];
const DEFAULT_API_INCLUDES = ['beatmapset.ratings', 'failtimes', 'max_combo', 'owners'];
const DEFAULT_SCORE_INCLUDES = ['user', 'user.country', 'user.cover', 'user.team'];

public function __construct()
Expand Down Expand Up @@ -194,7 +194,7 @@ public function attributes($id)
*
* Field | Type | Description
* -------- | ------------------------------------- | -----------
* beatmaps | [BeatmapExtended](#beatmapextended)[] | Includes `beatmapset` (with `ratings`), `failtimes`, and `max_combo`.
* beatmaps | [BeatmapExtended](#beatmapextended)[] | Includes `beatmapset` (with `ratings`), `failtimes`, `max_combo`, and `owners`.
*
* @queryParam ids[] integer Beatmap IDs to be returned. Specify once for each beatmap ID requested. Up to 50 beatmaps can be requested at once. Example: 1
*
Expand All @@ -216,6 +216,7 @@ public function index()
::whereIn('beatmap_id', $ids)
->whereHas('beatmapset')
->with([
'beatmapOwners.user',
'beatmapset',
'beatmapset.userRatings' => fn ($q) => $q->select('beatmapset_id', 'rating'),
'failtimes',
Expand Down
1 change: 1 addition & 0 deletions resources/views/docs/_structures/beatmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ beatmapset | [Beatmapset](#beatmapset)\|[BeatmapsetExtended](#beatmapsetextende
checksum | string? | |
failtimes | [Failtimes](#beatmap-failtimes) | |
max_combo | integer | |
owners | [BeatmapOwner](#beatmapowner)[] | List of owners (mappers) for the Beatmap.

<div id="beatmap-failtimes" data-unique="beatmap-failtimes"></div>

Expand Down
8 changes: 8 additions & 0 deletions resources/views/docs/_structures/beatmap_owner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## BeatmapOwner

Field | Type | Description
-------- | ------- | ------------
id | integer | [User](#user) id of the Beatmap owner.
username | string | Username of the Beatmap owner.

Users that are no longer visible will still appear as a `BeatmapOwner` but have the `username` set to `[deleted user]`.

0 comments on commit d470f0c

Please sign in to comment.