mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 18:01:21 +01:00
18 lines
590 B
JavaScript
18 lines
590 B
JavaScript
/**
|
|
* Import an Insomnia folder object.
|
|
* @param {Object} f - The environment object to import.
|
|
* @param workspaceId - Workspace to import into.
|
|
*/
|
|
export function importFolder(f, workspaceId) {
|
|
console.log('IMPORTING FOLDER', f._id, f.name, JSON.stringify(f, null, 2));
|
|
return {
|
|
id: f._id,
|
|
createdAt: new Date(f.created ?? Date.now()).toISOString().replace('Z', ''),
|
|
updatedAt: new Date(f.updated ?? Date.now()).toISOString().replace('Z', ''),
|
|
folderId: f.parentId === workspaceId ? null : f.parentId,
|
|
workspaceId,
|
|
model: 'folder',
|
|
name: f.name,
|
|
};
|
|
}
|