Queues Ticketoverview

This commit is contained in:
Meik
2026-02-04 09:47:40 +01:00
parent 688c7b1fb6
commit 06d4b16f43
2 changed files with 160 additions and 51 deletions

View File

@@ -98,37 +98,20 @@ namespace C4IT.F4SD
}
[Route("getTicketList"), HttpGet]
public async Task<List<cF4SDTicketSummary>> getTicketList(
string sid,
int hours,
int queueoption = 0,
string queues = ""
)
{
// "HR:2a7e..." → Tuple("HR", "2a7e..."), dann UrlDecode
var decodedPairs = queues
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Select(part =>
{
var segments = part.Split(':');
if (segments.Length != 2)
return null;
var name = HttpUtility.UrlDecode(segments[0]);
var idStr = HttpUtility.UrlDecode(segments[1]);
return Guid.TryParse(idStr, out var guid)
? new cApiM42TicketQueueInfo { QueueName = name, QueueID = guid }
: null;
})
.Where(q => q != null)
.ToList();
// Nun weiterreichen an Service
return await _f4stHelperService.getTicketListByUser(
sid,
hours,
queueoption,
public async Task<List<cF4SDTicketSummary>> getTicketList(
string sid,
int hours,
int queueoption = 0,
string queues = ""
)
{
var decodedPairs = ParseQueues(queues);
// Nun weiterreichen an Service
return await _f4stHelperService.getTicketListByUser(
sid,
hours,
queueoption,
decodedPairs
);
}
@@ -151,7 +134,13 @@ namespace C4IT.F4SD
}
[Route("getTicketOverviewCounts"), HttpGet]
public async Task<F4SDHelperService.TicketOverviewCountsResult> getTicketOverviewCounts(string sid, string scope = "personal", string keys = "")
public async Task<F4SDHelperService.TicketOverviewCountsResult> getTicketOverviewCounts(
string sid,
string scope = "personal",
string keys = "",
int queueoption = 0,
string queues = ""
)
{
var parsedKeys = (keys ?? string.Empty)
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
@@ -159,7 +148,8 @@ namespace C4IT.F4SD
.Where(key => !string.IsNullOrWhiteSpace(key))
.ToList();
return await _f4stHelperService.getTicketOverviewCounts(sid, scope, parsedKeys);
var decodedQueues = ParseQueues(queues);
return await _f4stHelperService.getTicketOverviewCounts(sid, scope, parsedKeys, queueoption, decodedQueues);
}
[Route("getTicketOverviewCountsByRoles"), HttpPost]
@@ -176,13 +166,28 @@ namespace C4IT.F4SD
.Distinct()
.ToList();
return await _f4stHelperService.getTicketOverviewCountsByRoles(request?.Sid, roleGuids, parsedKeys);
var decodedQueues = ParseQueues(request?.Queues ?? string.Empty);
return await _f4stHelperService.getTicketOverviewCountsByRoles(
request?.Sid,
roleGuids,
parsedKeys,
request?.QueueOption ?? 0,
decodedQueues
);
}
[Route("getTicketOverviewRelations"), HttpGet]
public async Task<List<F4SDHelperService.TicketOverviewRelationDto>> getTicketOverviewRelations(string sid, string scope = "personal", string key = "", int count = 0)
public async Task<List<F4SDHelperService.TicketOverviewRelationDto>> getTicketOverviewRelations(
string sid,
string scope = "personal",
string key = "",
int count = 0,
int queueoption = 0,
string queues = ""
)
{
return await _f4stHelperService.getTicketOverviewRelations(sid, scope, key, count);
var decodedQueues = ParseQueues(queues);
return await _f4stHelperService.getTicketOverviewRelations(sid, scope, key, count, queueoption, decodedQueues);
}
/*
[Route("updateActivitySolution/{objectId}"), HttpPost]
@@ -271,6 +276,29 @@ namespace C4IT.F4SD
public string Sid { get; set; }
public List<Guid> RoleGuids { get; set; } = new List<Guid>();
public List<string> Keys { get; set; } = new List<string>();
public int? QueueOption { get; set; }
public string Queues { get; set; }
}
private static List<cApiM42TicketQueueInfo> ParseQueues(string queues)
{
return (queues ?? string.Empty)
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Select(part =>
{
var segments = part.Split(':');
if (segments.Length != 2)
return null;
var name = HttpUtility.UrlDecode(segments[0]);
var idStr = HttpUtility.UrlDecode(segments[1]);
return Guid.TryParse(idStr, out var guid)
? new cApiM42TicketQueueInfo { QueueName = name, QueueID = guid }
: null;
})
.Where(q => q != null)
.ToList();
}
[Route("isAlive"), HttpGet]