Added MongoId type to various places

This commit is contained in:
Chomp
2025-07-02 19:50:29 +01:00
parent 145b19857d
commit 77ce596056
7 changed files with 9 additions and 23 deletions
@@ -1,4 +1,5 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Location;
@@ -29,7 +30,7 @@ public class LocationController(
var maps = locationsFromDb.GetDictionary();
// keyed by _id location property
var locationResult = new Dictionary<string, LocationBase>();
var locationResult = new Dictionary<MongoId, LocationBase>();
foreach (var (locationId, location) in maps)
{
@@ -47,7 +48,7 @@ public class LocationController(
// Clear out loot array
mapBase.Loot = [];
// Add map base data to dictionary
locationResult.Add(mapBase.IdField!, mapBase);
locationResult.Add(mapBase.IdField, mapBase);
}
return new LocationsGenerateAllResponse
@@ -9,33 +9,17 @@ using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Launcher;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Routers;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
namespace SPTarkov.Server.Core.Controllers;
[Injectable]
public class ProfileController(
ISptLogger<ProfileController> _logger,
HashUtil _hashUtil,
ICloner _cloner,
TimeUtil _timeUtil,
SaveServer _saveServer,
DatabaseService _databaseService,
ItemHelper _itemHelper,
ProfileFixerService _profileFixerService,
ServerLocalisationService _serverLocalisationService,
CreateProfileService _createProfileService,
SeasonalEventService _seasonalEventService,
PlayerScavGenerator _playerScavGenerator,
EventOutputHolder _eventOutputHolder,
TraderHelper _traderHelper,
DialogueHelper _dialogueHelper,
QuestHelper _questHelper,
QuestRewardHelper _questRewardHelper,
ProfileHelper _profileHelper
)
{
@@ -291,7 +291,7 @@ public record LocationBase
public long? UnixDateTime { get; set; }
[JsonPropertyName("_Id")]
public string? IdField { get; set; }
public MongoId IdField { get; set; }
[JsonPropertyName("doors")]
public List<object>? Doors { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Common.Tables;
@@ -8,7 +9,7 @@ public record LocationsGenerateAllResponse
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("locations")]
public Dictionary<string, LocationBase> Locations { get; set; }
public Dictionary<MongoId, LocationBase> Locations { get; set; }
[JsonPropertyName("paths")]
public List<Path>? Paths { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Utils;
namespace SPTarkov.Server.Core.Models.Eft.Prestige;
@@ -11,7 +12,7 @@ public record ObtainPrestigeRequest : IRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("id")]
public string Id { get; set; }
public MongoId Id { get; set; }
[JsonPropertyName("location")]
public Location Location { get; set; }
@@ -87,7 +87,7 @@ public record Info
/// main profile id
/// </summary>
[JsonPropertyName("id")]
public string? ProfileId { get; set; }
public MongoId? ProfileId { get; set; }
[JsonPropertyName("scavId")]
public string? ScavengerId { get; set; }
@@ -21,7 +21,6 @@ namespace SPTarkov.Server.Core.Services;
public class CreateProfileService(
ISptLogger<CreateProfileService> _logger,
TimeUtil _timeUtil,
HashUtil _hashUtil,
DatabaseService _databaseService,
ServerLocalisationService _serverLocalisationService,
ProfileHelper _profileHelper,