How to use the entities.DbFileTreeNode function in entities

To help you get started, we’ve selected a few entities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix / quix / quix-frontend / service / src / modules / event-sourcing / plugins / notebook-plugin.ts View on Github external
private async projectFileTree(
    action: IAction,
    tm: EntityManager,
  ) {
    switch (action.type) {
      case NotebookActionTypes.createNotebook: {
        const {notebook} = action;
        const parent = last(notebook.path);
        const node = new DbFileTreeNode();

        node.id = notebook.id;
        node.notebookId = notebook.id;
        node.owner = action.user;
        node.type = FileType.notebook;
        node.parent = parent ? new DbFileTreeNode(parent.id) : undefined;

        return tm.getCustomRepository(FileTreeRepository).save(node);
      }
    }
  }
github wix / quix / quix-frontend / service / src / modules / web-api / web-api.spec.ts View on Github external
function createFolderNode(defaultUser: string, folderName: string) {
  const folderNode = new DbFileTreeNode();
  folderNode.id = uuid();
  folderNode.owner = defaultUser;
  folderNode.folder = Object.assign(new DbFolder(), {
    id: folderNode.id,
    name: folderName,
    owner: defaultUser,
  });
  return folderNode;
}
github wix / quix / quix-frontend / service / src / modules / web-api / web-api.spec.ts View on Github external
function createNotebookNode(defaultUser: string, notebookName: string) {
  const notebook = createNotebook(defaultUser, notebookName);

  const notebookNode = new DbFileTreeNode();
  notebookNode.id = uuid();
  notebookNode.owner = defaultUser;
  notebookNode.notebookId = notebook.id;
  notebookNode.type = FileType.notebook;
  return [notebookNode, notebook] as const;
}
github wix / quix / quix-frontend / service / src / modules / event-sourcing / plugins / notebook-plugin.ts View on Github external
private async projectFileTree(
    action: IAction,
    tm: EntityManager,
  ) {
    switch (action.type) {
      case NotebookActionTypes.createNotebook: {
        const {notebook} = action;
        const parent = last(notebook.path);
        const node = new DbFileTreeNode();

        node.id = notebook.id;
        node.notebookId = notebook.id;
        node.owner = action.user;
        node.type = FileType.notebook;
        node.parent = parent ? new DbFileTreeNode(parent.id) : undefined;

        return tm.getCustomRepository(FileTreeRepository).save(node);
      }
    }
  }