mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
26 lines
820 B
TypeScript
26 lines
820 B
TypeScript
import * as models from '../../models';
|
|
import { RemoteProject } from '../../models/project';
|
|
import { Project } from '../../models/project';
|
|
import { Workspace, WorkspaceScopeKeys } from '../../models/workspace';
|
|
import { Team } from '../types';
|
|
import { BackendProject } from '../types';
|
|
|
|
export const initializeProjectFromTeam = (team: Team) => models.initModel<RemoteProject>(
|
|
models.project.type,
|
|
{
|
|
_id: `${models.project.prefix}_${team.id}`,
|
|
remoteId: team.id,
|
|
name: team.name,
|
|
}
|
|
);
|
|
|
|
export const initializeWorkspaceFromBackendProject = (backendProject: BackendProject, project: Project) => models.initModel<Workspace>(
|
|
models.workspace.type,
|
|
{
|
|
_id: backendProject.rootDocumentId,
|
|
name: backendProject.name,
|
|
parentId: project._id,
|
|
scope: WorkspaceScopeKeys.collection,
|
|
}
|
|
);
|