in apps/chat/src/utils/app/data/storages/api/conversation-api-storage.ts [90:148]
conversation: of((conversation as Conversation) ?? null),
payload: of(payload),
});
}
};
export const getPreparedConversations = ({
conversations,
conversationsFolders,
}: {
conversations: Conversation[];
conversationsFolders: FolderInterface[];
}) =>
conversations.map((conv) => {
const { path } = getPathToFolderById(conversationsFolders, conv.folderId, {
forRenaming: true,
replaceWithSpacesForRenaming: true,
trimEndDotsRequired: true,
prepareNames: true,
});
const newName = prepareEntityName(conv.name, {
forRenaming: true,
replaceWithSpacesForRenaming: true,
trimEndDotsRequired: true,
});
const folderId = isRootConversationsId(path)
? path
: constructPath(getConversationRootId(), path);
return regenerateConversationId({
...conv,
name: newName,
folderId,
});
}); // to send conversation with proper parentPath and lastActivityDate order
export const getImportPreparedConversations = ({
conversations,
conversationsFolders,
}: {
conversations: Conversation[] | ConversationInfo[];
conversationsFolders: FolderInterface[];
}) =>
conversations.map((conv) => {
const { path } = getPathToFolderById(conversationsFolders, conv.folderId, {
forRenaming: false,
trimEndDotsRequired: true,
prepareNames: true,
});
const newName = prepareEntityName(conv.name);
const rootId = isRootConversationsId(path) ? path : getConversationRootId();
const folderId = constructPath(rootId, path);
return {
...conv,
id: getGeneratedConversationId({