2026-07-17 11:59:05 -03:00
|
|
|
import type { CommentTimelineItem } from "./comment-timeline";
|
|
|
|
|
|
|
|
|
|
type CommentSource = {
|
|
|
|
|
id: string | number;
|
|
|
|
|
userName?: string;
|
|
|
|
|
commenter?: string | null;
|
|
|
|
|
createdDate?: string;
|
|
|
|
|
commenttext: string;
|
2026-08-11 14:07:02 -03:00
|
|
|
mentions?: string[];
|
2026-07-17 11:59:05 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function mapWorkOrderCommentsToTimeline(comments: CommentSource[]): CommentTimelineItem[] {
|
|
|
|
|
return comments.map((comment) => ({
|
|
|
|
|
id: comment.id,
|
|
|
|
|
author: comment.userName || comment.commenter || "System",
|
|
|
|
|
createdAt: comment.createdDate,
|
|
|
|
|
body: comment.commenttext,
|
2026-08-11 14:07:02 -03:00
|
|
|
mentions: comment.mentions,
|
2026-07-17 11:59:05 -03:00
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function mapDispatchCommentsToTimeline(comments: CommentSource[]): CommentTimelineItem[] {
|
|
|
|
|
return mapWorkOrderCommentsToTimeline(comments);
|
|
|
|
|
}
|