Files
DorkNet/DorkNet.Server/Controllers/API/SubscriptionSeasons/SubscriptionSeasonsController.cs
T
Alexa 70980bf3b6 feat: Add new API controllers for progression events, room consumables, currencies, earnings distributions, screen share reports, subscription seasons, and UGC purchasables
- Implemented ProgressionEventsController to handle progression event retrieval and active events.
- Created RoomConsumablesController for listing and purchasing room consumables.
- Developed RoomCurrenciesController for managing room currencies, including creation, updates, and balance retrieval.
- Added RoomEarningsDistributionsController to fetch earnings distribution data for rooms.
- Introduced ScreenShareReportsController for reporting screen share incidents.
- Established SubscriptionSeasonsController to provide current subscription season details and rewards.
- Launched UgcPurchasablesController for managing user-generated content purchasables, including bulk operations.
- Added new data entities for customization and room economy, including custom avatar items, room currencies, and UGC purchasables.
2026-06-22 16:08:23 +03:00

41 lines
1.2 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using DorkNet.Server.Data;
namespace DorkNet.Server.Controllers.API.SubscriptionSeasons;
[ApiController]
public class SubscriptionSeasonsController(DorkNetDbContext db) : ControllerBase
{
[HttpGet("api/subscriptionseasons/v1/seasons/current")]
public async Task<IActionResult> Current()
{
var now = DateTime.UtcNow;
var start = new DateTime(now.Year, now.Month, 1, 0, 0, 0, DateTimeKind.Utc);
var end = start.AddMonths(1);
var activeSubscribers = await db.Subscriptions.CountAsync();
var rewards = await db.StoreItems
.Where(i => i.IsActive)
.OrderBy(i => i.Id)
.Take(10)
.Select(i => new
{
RewardId = i.Id,
i.Slug,
Name = i.DisplayName,
i.Category,
i.ImageName,
})
.ToListAsync();
return Ok(new
{
SeasonId = $"{start:yyyyMM}",
Name = $"Season {start:yyyy.MM}",
StartAt = start,
EndAt = end,
ActiveSubscriberCount = activeSubscribers,
Rewards = rewards,
});
}
}