rework from modal to page
This commit is contained in:
@@ -188,6 +188,40 @@ async function updateIssue(
|
||||
}
|
||||
}
|
||||
|
||||
async function addHistoryEntry(
|
||||
issueId: number,
|
||||
aktion: string,
|
||||
details: Record<string, unknown> | null,
|
||||
userId?: string,
|
||||
) {
|
||||
try {
|
||||
await pool.query(
|
||||
`INSERT INTO issue_historie (issue_id, aktion, details, erstellt_von)
|
||||
VALUES ($1, $2, $3, $4)`,
|
||||
[issueId, aktion, details ? JSON.stringify(details) : null, userId || null],
|
||||
);
|
||||
} catch (error) {
|
||||
logger.error('IssueService.addHistoryEntry failed', { error, issueId });
|
||||
}
|
||||
}
|
||||
|
||||
async function getHistory(issueId: number) {
|
||||
try {
|
||||
const result = await pool.query(
|
||||
`SELECT h.*, u.name AS erstellt_von_name
|
||||
FROM issue_historie h
|
||||
LEFT JOIN users u ON u.id = h.erstellt_von
|
||||
WHERE h.issue_id = $1
|
||||
ORDER BY h.erstellt_am DESC`,
|
||||
[issueId],
|
||||
);
|
||||
return result.rows;
|
||||
} catch (error) {
|
||||
logger.error('IssueService.getHistory failed', { error, issueId });
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteIssue(id: number) {
|
||||
try {
|
||||
const result = await pool.query(
|
||||
@@ -575,6 +609,8 @@ export default {
|
||||
getAssignableMembers,
|
||||
getIssueCounts,
|
||||
getIssueStatuses,
|
||||
addHistoryEntry,
|
||||
getHistory,
|
||||
createIssueStatus,
|
||||
updateIssueStatus,
|
||||
deleteIssueStatus,
|
||||
|
||||
Reference in New Issue
Block a user