Finalize history admin tools and semantic UI navigation

This commit is contained in:
2026-02-23 16:59:09 +03:00
parent 4e8554f5f0
commit 8aa8b26184
43 changed files with 5543 additions and 270 deletions

View File

@@ -54,7 +54,7 @@ func (r *EventRepository) List(ctx context.Context, subjectType string, subjectI
query := `
SELECT id, subject_type, subject_id, event_type, event_time, machine_id, part_id, firmware_version, created_at
FROM timeline_events
WHERE subject_type = ? AND subject_id = ?`
WHERE subject_type = ? AND subject_id = ? AND is_deleted = FALSE`
if cursor != nil {
query += " AND (event_time > ? OR (event_time = ? AND id > ?))"
args = append(args, cursor.Time, cursor.Time, cursor.ID)
@@ -145,12 +145,13 @@ func (r *EventRepository) listLatestBySubjects(ctx context.Context, subjectType
query := `
SELECT t.id, t.subject_id, t.event_type, t.event_time, t.machine_id, t.part_id, t.firmware_version, t.created_at
FROM timeline_events t
WHERE t.subject_type = ? AND t.subject_id IN (` + strings.Join(placeholders, ",") + `)` + eventFilter + `
WHERE t.subject_type = ? AND t.subject_id IN (` + strings.Join(placeholders, ",") + `) AND t.is_deleted = FALSE` + eventFilter + `
AND NOT EXISTS (
SELECT 1
FROM timeline_events t2
WHERE t2.subject_type = t.subject_type
AND t2.subject_id = t.subject_id
AND t2.is_deleted = FALSE
` + eventFilterInner + `
AND (
t2.event_time > t.event_time