partially implemented MatchLocationService
This commit is contained in:
@@ -1,12 +1,41 @@
|
||||
using SptCommon.Annotations;
|
||||
using System.Text.Json.Serialization;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Services;
|
||||
|
||||
[Injectable(InjectionType.Singleton)]
|
||||
public class MatchLocationService
|
||||
{
|
||||
public void DeleteGroup(object info)
|
||||
protected Dictionary<string, MatchGroup> _locations = new();
|
||||
|
||||
/// <summary>
|
||||
/// DisbandRaidGroup
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
public void DeleteGroup(DeleteGroupRequest request)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
// Find group by id by iterating over all locations and looking for it by groupId
|
||||
foreach (var locationKvP in _locations)
|
||||
{
|
||||
var matchingGroup = _locations[locationKvP.Key]
|
||||
.Groups.FirstOrDefault(groupKvP => groupKvP == request.GroupId);
|
||||
if (matchingGroup != null)
|
||||
{
|
||||
_locations[locationKvP.Key].Groups.Remove(request.GroupId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MatchGroup
|
||||
{
|
||||
[JsonPropertyName("groups")]
|
||||
public List<string> Groups { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteGroupRequest
|
||||
{
|
||||
[JsonPropertyName("groupId")]
|
||||
public string GroupId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user