From c0e815ae63e82ff717752c2ce9ad4223eb8149de Mon Sep 17 00:00:00 2001 From: Vadim Date: Sun, 11 Oct 2026 21:50:01 +0300 Subject: [PATCH] history component --- src/api/history.api.ts | 33 ++++ src/components/HistoryList.vue | 256 +++++++++++++++++++++++++++++++- src/components/IssueDetails.vue | 7 +- 3 files changed, 292 insertions(+), 4 deletions(-) create mode 100644 src/api/history.api.ts diff --git a/src/api/history.api.ts b/src/api/history.api.ts new file mode 100644 index 0000000..217ac7f --- /dev/null +++ b/src/api/history.api.ts @@ -0,0 +1,33 @@ +import { apiClient } from '@/lib/api-client.ts' +import type { User } from '@/api/user.api.ts' + +/** created — a pseudo-field: the issue creation record, both values are null */ +export type IssueChangeField = 'created' | 'title' | 'content' | 'status' | 'priority' | 'assignee' | 'dueDate' + +/** Values are serialized: priority — number, dueDate — ISO date, assignee — user id */ +export interface IssueFieldChange { + field: IssueChangeField + oldValue: string | null + newValue: string | null + /** Only for field = assignee: null — unassigned or the user was deleted */ + oldUser?: User | null + newUser?: User | null +} + +/** One save of the issue: who, when and which fields changed */ +export interface IssueHistoryEntry { + /** changeId */ + id: string + changedAt: string + actorId: string | null + /** null — system change or the actor deleted their account */ + actor: User | null + changes: IssueFieldChange[] +} + +// CLIENT REQUEST + +/** Oldest first */ +export async function itemsList(issueId: number) { + return apiClient.get(`/api/issues/${issueId}/history`) +} diff --git a/src/components/HistoryList.vue b/src/components/HistoryList.vue index 442b6c6..60e19df 100644 --- a/src/components/HistoryList.vue +++ b/src/components/HistoryList.vue @@ -1,7 +1,257 @@ - + - + diff --git a/src/components/IssueDetails.vue b/src/components/IssueDetails.vue index 5f5025c..661923b 100644 --- a/src/components/IssueDetails.vue +++ b/src/components/IssueDetails.vue @@ -164,7 +164,12 @@ defineExpose({
- +