Benutzer, Ticketzuweißungen

This commit is contained in:
2026-03-23 03:12:08 +01:00
parent e75a2e5e20
commit 08391cdb6c
29 changed files with 592 additions and 111 deletions

View File

@@ -45,10 +45,29 @@ export function mapTicket(r) {
createdAt: r.created_at,
/** Letzte Änderung: neueres aus Ticket-Zeile oder letztem Event (für Anzeige „Aktualisiert“). */
updatedAt: r.ticket_last_activity_at ?? r.updated_at,
assignedTo: null,
};
if (machine_row) {
t.machine = mapMachine(machine_row);
}
if (r.assignee_row != null && String(r.assignee_row).trim() !== '') {
try {
const ar =
typeof r.assignee_row === 'string'
? JSON.parse(r.assignee_row)
: r.assignee_row;
if (ar && ar.id) {
t.assignedTo = {
id: ar.id,
username: ar.username,
firstName: ar.firstname ?? null,
lastName: ar.lastname ?? null,
};
}
} catch {
/* ignore */
}
}
return t;
}
@@ -135,6 +154,14 @@ export const ticketJoinSelect = `
'extras', m.extras,
'created_at', m.created_at,
'updated_at', m.updated_at
) AS machine_row
) AS machine_row,
CASE WHEN u_assign.id IS NULL THEN NULL ELSE
json_object(
'id', u_assign.id,
'username', u_assign.username,
'firstname', u_assign.firstname,
'lastname', u_assign.lastname
) END AS assignee_row
FROM tickets t
JOIN machines m ON m.id = t.machine_id`;
JOIN machines m ON m.id = t.machine_id
LEFT JOIN users u_assign ON u_assign.id = t.assigned_user_id`;