fix(audit): use uuid.New() for ticket workflow audit IDs
Fixes 'invalid input syntax for type uuid' error when writing ticket
workflow audit logs. The audit Event.ID field was using fmt.Sprintf
with nanoseconds ('wf-%d') which doesn't match PostgreSQL's uuid type.
Also adds uuid import to ticket_workflow.go.
Verified: full chain webhook→assign→resolve→close produces 3 audit
logs correctly, no more 'invalid uuid' errors in logs.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/bridge/ai-customer-service/internal/domain/audit"
|
||||
"github.com/google/uuid"
|
||||
"github.com/bridge/ai-customer-service/internal/domain/ticket"
|
||||
)
|
||||
|
||||
@@ -36,7 +37,7 @@ func (s *TicketWorkflowStore) writeAudit(ctx context.Context, ticketID, action,
|
||||
}
|
||||
now := time.Now()
|
||||
event := audit.Event{
|
||||
ID: fmt.Sprintf("wf-%d", now.UnixNano()),
|
||||
ID: uuid.New().String(),
|
||||
Type: "ticket_state_changed",
|
||||
Action: action,
|
||||
TicketID: ticketID,
|
||||
|
||||
Reference in New Issue
Block a user