Skip to content

Commit 2d4c994

Browse files
committed
Allow username for GetAssetsByUser endpoint
1 parent 0113347 commit 2d4c994

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Refresh.Interfaces.APIv3/Endpoints/Admin/AdminAssetApiEndpoints.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Refresh.Database;
77
using Refresh.Database.Models.Assets;
88
using Refresh.Database.Models.Users;
9+
using Refresh.Interfaces.APIv3.Documentation.Descriptions;
910
using Refresh.Interfaces.APIv3.Endpoints.ApiTypes;
1011
using Refresh.Interfaces.APIv3.Endpoints.ApiTypes.Errors;
1112
using Refresh.Interfaces.APIv3.Endpoints.DataTypes.Response.Data;
@@ -15,15 +16,16 @@ namespace Refresh.Interfaces.APIv3.Endpoints.Admin;
1516

1617
public class AdminAssetApiEndpoints : EndpointGroup
1718
{
18-
[ApiV3Endpoint("admin/users/uuid/{uuid}/assets"), MinimumRole(GameUserRole.Moderator)]
19+
[ApiV3Endpoint("admin/users/{idType}/{id}/assets"), MinimumRole(GameUserRole.Moderator)]
1920
[DocSummary("Retrieves a list of assets uploaded by the user.")]
2021
[DocQueryParam("assetType", "The asset type to filter by. Can be excluded to list all types.")]
2122
[DocError(typeof(ApiNotFoundError), ApiNotFoundError.UserMissingErrorWhen)]
2223
[DocError(typeof(ApiValidationError), "The asset type could not be parsed.")]
2324
public ApiListResponse<ApiMinimalGameAssetResponse> GetAssetsByUser(RequestContext context, GameDatabaseContext database, DataContext dataContext,
24-
[DocSummary("The UUID of the user.")] string uuid)
25+
[DocSummary(SharedParamDescriptions.UserIdParam)] string id,
26+
[DocSummary(SharedParamDescriptions.UserIdTypeParam)] string idType)
2527
{
26-
GameUser? user = database.GetUserByUuid(uuid);
28+
GameUser? user = database.GetUserByIdAndType(idType, id);
2729
if (user == null) return ApiNotFoundError.UserMissingError;
2830

2931
(int skip, int count) = context.GetPageData(1000);

0 commit comments

Comments
 (0)