mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-27 07:58:45 -07:00
feat: Add support for 2018 client API endpoints and data models
- Implemented new search endpoints for rooms to accommodate the 2018 client. - Added support for retrieving room details and featured rooms in a format compatible with the 2018 client. - Introduced new data models for login responses and player presence specific to the 2018 client. - Created mappers to convert between internal entities and the 2018 wire formats for players and rooms. - Updated existing storefront APIs to include versioned endpoints for the 2018 client. - Enhanced the version controller to return dual-format responses for compatibility with both 2018 and 2020 clients. - Refactored the configuration service to ensure trailing slashes in URLs for the 2018 client.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using DorkNet.Models.Rooms;
|
||||
using DorkNet.Server.Data.Entities;
|
||||
|
||||
namespace DorkNet.Server.Compat2018;
|
||||
|
||||
/// <summary>
|
||||
/// Maps a <see cref="RoomEntity"/> to the flat June-2018 wire room
|
||||
/// (<see cref="Room2018"/>). Server-side because DorkNet.Models can't reference
|
||||
/// the data entity. Some 2018 fields have no column (Instanced, MaxPlayers,
|
||||
/// ReportCount, ActivityLevelId) and get sensible defaults; IsSandbox is derived
|
||||
/// from IsAGRoom (official AG rooms are not sandbox/maker rooms).
|
||||
/// </summary>
|
||||
public static class Room2018Mapper
|
||||
{
|
||||
public static Room2018 From(RoomEntity r) => new()
|
||||
{
|
||||
RoomId = r.Id,
|
||||
Name = r.Name,
|
||||
Description = r.Description,
|
||||
CreatorPlayerId = r.CreatorPlayerId,
|
||||
ImageName = r.ImageName,
|
||||
DataBlobName = r.CurrentDataBlobName ?? string.Empty,
|
||||
ActivityLevelId = string.Empty,
|
||||
IsSandbox = !r.IsAGRoom,
|
||||
Instanced = true,
|
||||
MaxPlayers = 20,
|
||||
Accessibility = r.Accessibility,
|
||||
AccessibilityLocked = false,
|
||||
VisitorCount = r.VisitorCount,
|
||||
VisitCount = r.VisitCount,
|
||||
CheerCount = r.CheerCount,
|
||||
ReportCount = 0,
|
||||
State = r.State,
|
||||
StateModifiedAt = r.UpdatedAt,
|
||||
CreatedAt = r.CreatedAt,
|
||||
ModifiedAt = r.UpdatedAt,
|
||||
LastVisitedAt = r.UpdatedAt,
|
||||
DataModifiedAt = r.UpdatedAt,
|
||||
CoOwners = [],
|
||||
Hosts = [],
|
||||
PersonalDetails = null,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user