mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
feat: Enhance API endpoints with pagination and new subscription details for players
This commit is contained in:
@@ -1,31 +1,14 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DorkNet.Server.Auth;
|
||||
using DorkNet.Server.Data;
|
||||
using DorkNet.Server.Data.Entities;
|
||||
|
||||
namespace DorkNet.Server.Controllers.API.GameSight;
|
||||
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class GameSightController(DorkNetDbContext db) : ControllerBase
|
||||
[AllowAnonymous]
|
||||
public class GameSightController : ControllerBase
|
||||
{
|
||||
[HttpPost("api/gamesight/event")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> Event([FromBody] object? body)
|
||||
{
|
||||
var playerId = this.CurrentPlayerId();
|
||||
if (playerId is null)
|
||||
return Ok(new { Success = true });
|
||||
|
||||
db.ObjectiveProgress.Add(new ObjectiveProgressEntity
|
||||
{
|
||||
PlayerId = playerId.Value,
|
||||
Key = $"gamesight:{Guid.NewGuid():N}",
|
||||
IsCompleted = true,
|
||||
ClearedAt = DateTime.UtcNow,
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
return Ok(new { Success = true });
|
||||
}
|
||||
[HttpPost("/api/gamesight/event")]
|
||||
[HttpPost("/data/event")]
|
||||
[HttpPost("/data/heartbeat")]
|
||||
public IActionResult Event() => Ok(new { Success = true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user