Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

311
Visualizações
TypeORM: convert JSON into typeorm entities

I'm using Nest.JS and TypeORM. I have two entity types: File and Folder (As you can imagine, they represent files and folders on a hard drive).

Example of Folder entity:

    {
        id: 'aaa',
        name: 'home',
        childFolders: [],
        files: []
    }

example of File entity:

    {
        id: 'iii',
        name: 'spreadsheet.csv',
        size: 236434,
    }

I have JSON from a DB which represents filesystem structure structure. For example:

    {
        id: 'aaa',
        name: 'home',
        childFolders: [
            {
                id: 'bbb',
                name: 'bob',
                childFolders: [],
                files: [
                    {
                        id: 'iii',
                        name: 'spreadsheet.csv',
                        size: 236434,
                    }
                ]
            }
        ],
        files: []
    }

I am building an opengraph API to be able to search for files/folders. If I want to convert this JSON into a collection of folder and file entities, will I have to loop recursively and build these entities manually? Or is there an easier way to do that?

Thank you so much for any insight you can provide.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda