Skip to content

Commit

Permalink
Improve weight event mushroom eater calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ptlthg committed Jan 2, 2025
1 parent 3cb8c60 commit cd82036
Show file tree
Hide file tree
Showing 7 changed files with 2,637 additions and 12 deletions.
12 changes: 10 additions & 2 deletions EliteAPI/Controllers/Events/EventController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
using System.Text.Json;
using Asp.Versioning;
using AutoMapper;
using EliteAPI.Authentication;
using EliteAPI.Configuration.Settings;
using EliteAPI.Data;
using EliteAPI.Models.DTOs.Outgoing;
using EliteAPI.Models.Entities.Accounts;
using EliteAPI.Models.Entities.Events;
using EliteAPI.Services.Interfaces;
using EliteAPI.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand Down Expand Up @@ -156,6 +158,7 @@ public async Task<ActionResult<List<EventMemberDetailsDto>>> GetEventMembers(ulo
/// <param name="eventId"></param>
/// <param name="playerUuid"></param>
/// <returns></returns>
[OptionalAuthorize]
[HttpGet("member/{playerUuid}")]
[ResponseCache(Duration = 60, Location = ResponseCacheLocation.Any)]
[ProducesResponseType(StatusCodes.Status200OK)]
Expand All @@ -174,8 +177,13 @@ public async Task<ActionResult<EventMemberDto>> GetEventMember(ulong eventId, st
if (member is null) return NotFound("Event member not found.");

var mapped = mapper.Map<EventMemberDto>(member);

return Ok(mapped);

if (User.GetId() is { } id && (id == member.UserId.ToString() || User.IsInRole(ApiUserPolicies.Moderator))) {
return mapped;
} else {
mapped.Notes = null;
return mapped;
}
}

/// <summary>
Expand Down
Loading

0 comments on commit cd82036

Please sign in to comment.