1

Im new to sails.js and all the node.js stuff.

I'm creating a API (/game), that shouls produce a json like this(bellow), the problem is that inside the features object, the 'conteudo' field do not get populated. But all other fields that are using the "descricao.js" are fine.

{
"gameid": "memoria",
"secao": "adver",
"nomeLocal": [
        {
            "language": "pt",
            "conteudo": "Descricao PT"
        },
        {
            "language": "en",
            "conteudo": "Descricao EN"
        }
    ],
"descricaoLocal": [
        {
            "language": "pt",
            "conteudo": "Jodo da Memória"
        },
        {
            "language": "en",
            "conteudo": "Peek Game"
        }
    ],
"features": [
        {
     "valor": 85,
     "conteudo": [
         {
             "language": "te",
             "conteudo": "teste"
         }
         ]
        }
    ]

the models I created are:

Game.js

attributes: {
gameid: {
  type: 'string',
  required: true,
  //unique: true
},

secao: {
  type: 'string'
},

nomeLocal: {
  collection: 'descricao'
},

descricaoLocal: {
  collection: 'descricao',
},

features: {
  collection: 'features'
}
}

descricao.js

attributes: {
language: {
  type: 'string'
},
conteudo: {
  type: 'string'
}
}

and the features.js

attributes: {
valor: {
    type: 'integer'
  },
conteudo: {
  collection: 'descricao'
}
}
Flavio Engel
  • 51
  • 1
  • 6

0 Answers0