mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-04 10:12:05 +00:00
23 lines
659 B
TypeScript
23 lines
659 B
TypeScript
|
|
import type { CommentTimelineItem } from "./comment-timeline";
|
||
|
|
|
||
|
|
type CommentSource = {
|
||
|
|
id: string | number;
|
||
|
|
userName?: string;
|
||
|
|
commenter?: string | null;
|
||
|
|
createdDate?: string;
|
||
|
|
commenttext: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
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,
|
||
|
|
}));
|
||
|
|
}
|
||
|
|
|
||
|
|
export function mapDispatchCommentsToTimeline(comments: CommentSource[]): CommentTimelineItem[] {
|
||
|
|
return mapWorkOrderCommentsToTimeline(comments);
|
||
|
|
}
|