9
respostas

ERRO AO CONECTAR COM BANCO MSSQL

Fala pessoal, preciso de uma força com o sequelize.

Estou usando como base o projeto do curso para um projeto do trabalho.

Criei uma nova tabela e alterei o tipo do banco para mssql. Porém, minha busca não retorna os dados do banco e não retorna nenhum erro também.

Eu não consegui identificar nada de errado no código, se puderem me dar uma segunda opinião, ficarei muito grato.

Uma coisa que fiquei em dúvida foi: Eu já tenho essa tabela criada no meu banco de dados, em tese eu não precisaria rodar o comando migrate, esse raciocínio está correto?

O meu código é esse:

Modelo:

"use strict";
module.exports = (sequelize, DataTypes) => {
  const TOP_10 = sequelize.define(
    "TOP_10",
    {
      BRICK: DataTypes.INTEGER,
      SETOR_NEC_ABERTO: DataTypes.STRING,
      EAN: DataTypes.STRING,
      CEP_INICIAL: DataTypes.INTEGER,
      CEP_FINAL: DataTypes.INTEGER,
      PRODUTO: DataTypes.STRING,
      LABORATORIO: DataTypes.STRING,
      UNIDADES: DataTypes.FLOAT,
      FCC: DataTypes.INTEGER,
      RANK: DataTypes.INTEGER,
    },
    {
      freezeTableName: true,
      tableName: 'dbo.TOP_10',
    }
  );
  TOP_10.associate = function (models) {
    // associations can be defined here
  };
  return TOP_10;
};

Controller:

const database = require("../models");
database.sequelize.sync()

class Top10Controller {
  static async getAllTop10(req, res) {
    try {
      const AllTop10 = await database.TOP_10.findAll();
      return res.status(200).json(AllTop10);
    } catch (error) {
      return res.status(500).json(error.message);
    }
  }

  static async getUniqueTop10(req, res) {
    const { id } = req.params;
    try {
      const uniqueTop10 = await database.TOP_10.findOne({
        where: { id: Number(id) },
      });
      return res.status(200).json(uniqueTop10);
    } catch (error) {
      return res.status(500).json(error.message);
    }
  }
}

module.exports = Top10Controller;

Aquivo de migration:

"use strict";
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable("dbo.TOP_10", {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER,
      },
      BRICK: {
        type: Sequelize.INTEGER,
      },
      SETOR_NEC_ABERTO: {
        type: Sequelize.STRING,
      },
      EAN: {
        type: Sequelize.STRING,
      },
      CEP_INICIAL: {
        type: Sequelize.INTEGER,
      },
      CEP_FINAL: {
        type: Sequelize.INTEGER,
      },
      PRODUTO: {
        type: Sequelize.STRING,
      },
      LABORATORIO: {
        type: Sequelize.STRING,
      },
      UNIDADES: {
        type: Sequelize.FLOAT,
      },
      FCC: {
        type: Sequelize.INTEGER,
      },
      RANK: {
        type: Sequelize.INTEGER,
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE,
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE,
      },
    });
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable("dbo.TOP_10");
  },
};

Rota:

const { Router } = require("express");
const Top10Controller = require("../controllers/Top10Controller");

const router = Router();

router.get("/top", Top10Controller.getAllTop10);
router.get("/top/:id", Top10Controller.getUniqueTop10);

module.exports = router;

Rota index:

const bodyParser = require("body-parser");
const top10Route = require("./top10Route");

module.exports = (app) => {
  app.use(bodyParser.json());
  app.use(top10Route);
};
9 respostas

Olá, Matheus! Tudo bem?

Sim, seu raciocínio está correto! Como a tabela já existe, não é necessário rodar o migrate, apenas se você precisar realizar alguma alteração na estrutura da tabela.

Agora, em relação ao problema de não retornar os dados do banco, pode ser necessário verificar se os dados estão sendo inseridos corretamente na tabela, pois nos trechos de código que você compartilhou não tem nenhum problema aparente. Você pode verificar isso através do próprio banco de dados, executando uma consulta para ver se os dados estão lá.

Além disso, é importante verificar se não há nenhum erro de configuração na conexão com o banco de dados. Verifique se as credenciais de acesso estão corretas, se o servidor e a porta estão configurados corretamente.

Caso você não encontre nenhum erro aparente, pode ser útil adicionar alguns logs no seu código para verificar se está ocorrendo algum erro durante a busca dos dados. Por exemplo, você pode adicionar um console.log logo antes da linha const AllTop10 = await database.TOP_10.findAll(); para verificar se a busca está sendo feita corretamente.

Espero que essas dicas possam te ajudar a identificar o problema. Caso nenhuma das indicações solucione o seu problema, peço que compartilhe comigo o seu projeto, via GitHub ou Drive do Google. Assim poderei entender melhor a sua situação.

No mais, espero ter ajudado e bons estudos!

Caso este post tenha lhe ajudado, por favor, marcar como solucionado ✓.

Fala, Armano. Obrigado pela resposta.

Eu coloquei um log onde falou mas ainda não deu certo:

class Top10Controller {
  static async getAllTop10(req, res) {
    try {
      console.log(database)
      const AllTop10 = await database.TOP_10.findAll();
      return res.status(200).json(AllTop10);
    } catch (error) {
      return res.status(500).json(error.message);
    }
  }

E ele retornou as seguintes informações:

{
  TOP_10: TOP_10,
  sequelize: <ref *1> Sequelize {
    options: {
      dialect: 'mssql',
      dialectModule: null,
      dialectModulePath: null,
      host: 'aqui eu tirei as infos',
      protocol: 'tcp',
      define: {},
      query: {},
      sync: {},
      timezone: '+00:00',
      clientMinMessages: 'warning',
      standardConformingStrings: true,
      logging: [Function: log],
      omitNull: false,
      native: false,
      replication: false,
      ssl: undefined,
      pool: {},
      quoteIdentifiers: true,
      hooks: {},
      retry: [Object],
      transactionType: 'DEFERRED',
      isolationLevel: null,
      databaseVersion: 0,
      typeValidation: false,
      benchmark: false,
      minifyAliases: false,
      logQueryParameters: false,
      username: 'aqui eu tirei os dados',
      password: 'aqui eu tirei os dados',
      database: 'aqui eu tirei os dados'
    },
    config: {
      database: 'aqui eu tirei os dados',
      username: 'aqui eu tirei os dados',
      password: 'aqui eu tirei os dados',
      host: 'aqui eu tirei os dados',
      port: 1433,
      pool: {},
      protocol: 'tcp',
      native: false,
      ssl: undefined,
      replication: false,
      dialectModule: null,
      dialectModulePath: null,
      keepDefaultTimezone: undefined,
      dialectOptions: undefined
    },
    dialect: MssqlDialect {
      sequelize: [Circular *1],
      connectionManager: [ConnectionManager],
      QueryGenerator: [MSSQLQueryGenerator]
    },
    queryInterface: QueryInterface {
      sequelize: [Circular *1],
      QueryGenerator: [MSSQLQueryGenerator]
    },
    models: { TOP_10: TOP_10 },
    modelManager: ModelManager { models: [Array], sequelize: [Circular *1] },
    connectionManager: ConnectionManager {
      sequelize: [Circular *1],
      config: [Object],
      dialect: [MssqlDialect],
      versionPromise: null,
      dialectName: 'mssql',
      pool: [Pool],
      lib: [Object]
    },
    importCache: {
      'C:\\Users\\RafaelMolinaMartinez\\Documents\\rm-dev\\API-MAISIM-SEQUELIZE\\api\\models\\top_10.js': TOP_10
    }
  },
  Sequelize: <ref *6> [class Sequelize] {
    version: '5.21.7',

obs.: vou continuar no próximo comentário, por causa do limite de caracteres.

Depois do trecho:

const AllTop10 = await database.TOP_10.findAll();

Ele não retorna nada

Continuação do retorno:

options: { hooks: {} },
    Utils: {
      classToInvokable: [Function: classToInvokable],
      Promise: [Function],
      useInflection: [Function: useInflection],
      camelizeIf: [Function: camelizeIf],
      underscoredIf: [Function: underscoredIf],
      isPrimitive: [Function: isPrimitive],
      mergeDefaults: [Function: mergeDefaults],
      merge: [Function: merge],
      spliceStr: [Function: spliceStr],
      camelize: [Function: camelize],
      underscore: [Function: underscore],
      singularize: [Function: singularize],
      pluralize: [Function: pluralize],
      format: [Function: format],
      formatNamedParameters: [Function: formatNamedParameters],
      cloneDeep: [Function: cloneDeep],
      mapFinderOptions: [Function: mapFinderOptions],
      mapOptionFieldNames: [Function: mapOptionFieldNames],
      mapWhereFieldNames: [Function: mapWhereFieldNames],
      mapValueFieldNames: [Function: mapValueFieldNames],
      isColString: [Function: isColString],
      canTreatArrayAsAnd: [Function: canTreatArrayAsAnd],
      combineTableNames: [Function: combineTableNames],
      toDefaultValue: [Function: toDefaultValue],
      defaultValueSchemable: [Function: defaultValueSchemable],
      removeNullValuesFromHash: [Function: removeNullValuesFromHash],
      stack: [Function: stack],
      now: [Function: now],
      TICK_CHAR: '`',
      addTicks: [Function: addTicks],
      removeTicks: [Function: removeTicks],
      flattenObjectDeep: [Function: flattenObjectDeep],
      SequelizeMethod: [class SequelizeMethod],
      Fn: [class Fn extends SequelizeMethod],
      Col: [class Col extends SequelizeMethod],
      Cast: [class Cast extends SequelizeMethod],
      Literal: [class Literal extends SequelizeMethod],
      Json: [class Json extends SequelizeMethod],
      Where: [class Where extends SequelizeMethod],
      getOperators: [Function: getOperators],
      getComplexKeys: [Function: getComplexKeys],
      getComplexSize: [Function: getComplexSize],
      isWhereEmpty: [Function: isWhereEmpty],
      generateEnumName: [Function: generateEnumName],
      camelizeObjectKeys: [Function: camelizeObjectKeys],
      defaults: [Function: defaults],
      nameIndex: [Function: nameIndex],
      intersects: [Function: intersects]
    },
    Op: {
      eq: Symbol(eq),
      ne: Symbol(ne),
      gte: Symbol(gte),
      gt: Symbol(gt),
      lte: Symbol(lte),
      lt: Symbol(lt),
      not: Symbol(not),
      is: Symbol(is),
      in: Symbol(in),
      notIn: Symbol(notIn),
      like: Symbol(like),
      notLike: Symbol(notLike),
      iLike: Symbol(iLike),
      notILike: Symbol(notILike),
      startsWith: Symbol(startsWith),
      endsWith: Symbol(endsWith),
      substring: Symbol(substring),
      regexp: Symbol(regexp),
      notRegexp: Symbol(notRegexp),
      iRegexp: Symbol(iRegexp),
      notIRegexp: Symbol(notIRegexp),
      between: Symbol(between),
      notBetween: Symbol(notBetween),
      overlap: Symbol(overlap),
      contains: Symbol(contains),
      contained: Symbol(contained),
      adjacent: Symbol(adjacent),
      strictLeft: Symbol(strictLeft),
      strictRight: Symbol(strictRight),
      noExtendRight: Symbol(noExtendRight),
      noExtendLeft: Symbol(noExtendLeft),
      and: Symbol(and),
      or: Symbol(or),
      any: Symbol(any),
      all: Symbol(all),
      values: Symbol(values),
      col: Symbol(col),
      placeholder: Symbol(placeholder),
      join: Symbol(join)
    },
Promise: <ref *2> [Function: Promise] {
      TypeError: [Function: TypeError],
      RangeError: [Function: RangeError],
      CancellationError: [Function: SubError],
      TimeoutError: [Function: SubError],
      OperationalError: [Function: OperationalError],
      RejectionError: [Function: OperationalError],
      AggregateError: [Function: SubError],
      _peekContext: [Function (anonymous)],
      onPossiblyUnhandledRejection: [Function (anonymous)],
      onUnhandledRejectionHandled: [Function (anonymous)],
      longStackTraces: [Function (anonymous)],
      hasLongStackTraces: [Function (anonymous)],
      config: [Function (anonymous)],
      getNewLibraryCopy: [Function (anonymous)],
      is: [Function (anonymous)],
      fromCallback: [Function (anonymous)],
      fromNode: [Function (anonymous)],
      all: [Function (anonymous)],
      cast: [Function (anonymous)],
      fulfilled: [Function (anonymous)],
      resolve: [Function (anonymous)],
      rejected: [Function (anonymous)],
      reject: [Function (anonymous)],
      setScheduler: [Function (anonymous)],
      pending: [Function (anonymous)],
      defer: [Function (anonymous)],
      method: [Function (anonymous)],
      try: [Function (anonymous)],
      attempt: [Function (anonymous)],
      bind: [Function (anonymous)],
      PromiseInspection: [Function: PromiseInspection],
      join: [Function (anonymous)],
      Promise: [Circular *2],
      version: '3.7.2',
      coroutine: [Function],
      spawn: [Function (anonymous)],
      map: [Function (anonymous)],
      promisify: [Function (anonymous)],
      promisifyAll: [Function (anonymous)],
      props: [Function (anonymous)],
      race: [Function (anonymous)],
      reduce: [Function (anonymous)],
      settle: [Function (anonymous)],
      allSettled: [Function (anonymous)],
      some: [Function (anonymous)],
      _SomePromiseArray: [Function: SomePromiseArray],
      delay: [Function (anonymous)],
      using: [Function (anonymous)],
      any: [Function (anonymous)],
      each: [Function (anonymous)],
      mapSeries: [Function: PromiseMapSeries],
      filter: [Function (anonymous)],
      default: [Circular *2]
    },
    TableHints: {
      NOLOCK: 'NOLOCK',
      READUNCOMMITTED: 'READUNCOMMITTED',
      UPDLOCK: 'UPDLOCK',
      REPEATABLEREAD: 'REPEATABLEREAD',
      SERIALIZABLE: 'SERIALIZABLE',
      READCOMMITTED: 'READCOMMITTED',
      TABLOCK: 'TABLOCK',
      TABLOCKX: 'TABLOCKX',
      PAGLOCK: 'PAGLOCK',
      ROWLOCK: 'ROWLOCK',
      NOWAIT: 'NOWAIT',
      READPAST: 'READPAST',
      XLOCK: 'XLOCK',
      SNAPSHOT: 'SNAPSHOT',
      NOEXPAND: 'NOEXPAND'
    },
    IndexHints: { USE: 'USE', FORCE: 'FORCE', IGNORE: 'IGNORE' },
    Transaction: <ref *3> [class Transaction] {
      Transaction: [Circular *3],
      default: [Circular *3]
    },
    QueryTypes: {
      SELECT: 'SELECT',
      INSERT: 'INSERT',
      UPDATE: 'UPDATE',
      BULKUPDATE: 'BULKUPDATE',
      BULKDELETE: 'BULKDELETE',
      DELETE: 'DELETE',
      UPSERT: 'UPSERT',
      VERSION: 'VERSION',
      SHOWTABLES: 'SHOWTABLES',
      SHOWINDEXES: 'SHOWINDEXES',
      DESCRIBE: 'DESCRIBE',
      RAW: 'RAW',
      FOREIGNKEYS: 'FOREIGNKEYS',
      SHOWCONSTRAINTS: 'SHOWCONSTRAINTS'
    },
Validator: <ref *4> {
      version: '10.11.0',
      toDate: [Function],
      toFloat: [Function],
      toInt: [Function],
      toBoolean: [Function],
      equals: [Function],
      contains: [Function: contains],
      matches: [Function],
      isEmail: [Function],
      isURL: [Function],
      isMACAddress: [Function],
      isIP: [Function],
      isIPRange: [Function],
      isFQDN: [Function],
      isBoolean: [Function],
      isAlpha: [Function: isAlpha],
      isAlphaLocales: [Array],
      isAlphanumeric: [Function: isAlphanumeric],
      isAlphanumericLocales: [Array],
      isNumeric: [Function],
      isPort: [Function],
      isLowercase: [Function],
      isUppercase: [Function],
      isAscii: [Function],
      isFullWidth: [Function: isFullWidth],
      isHalfWidth: [Function: isHalfWidth],
      isVariableWidth: [Function],
      isMultibyte: [Function],
      isSurrogatePair: [Function],
      isInt: [Function],
      isFloat: [Function: isFloat],
      isFloatLocales: [Array],
      isDecimal: [Function: isDecimal],
      isHexadecimal: [Function],
      isDivisibleBy: [Function],
      isHexColor: [Function],
      isISRC: [Function],
      isMD5: [Function],
      isHash: [Function],
      isJWT: [Function],
      isJSON: [Function],
      isEmpty: [Function],
      isLength: [Function],
      isByteLength: [Function],
      isUUID: [Function],
      isMongoId: [Function],
      isAfter: [Function],
      isBefore: [Function],
      isIn: [Function],
      isCreditCard: [Function],
      isIdentityCard: [Function],
      isISIN: [Function],
      isISBN: [Function],
      isISSN: [Function],
      isMobilePhone: [Function: isMobilePhone],
      isMobilePhoneLocales: [Array],
      isPostalCode: [Function: _default],
      isPostalCodeLocales: [Array],
      isCurrency: [Function],
      isISO8601: [Function],
      isRFC3339: [Function],
      isISO31661Alpha2: [Function],
      isISO31661Alpha3: [Function],
      isBase64: [Function],
      isDataURI: [Function],
      isMagnetURI: [Function],
      isMimeType: [Function],
      isLatLong: [Function],
      ltrim: [Function],
      rtrim: [Function],
      trim: [Function],
      escape: [Function],
      unescape: [Function],
      stripLow: [Function],
      whitelist: [Function],
      blacklist: [Function],
      isWhitelisted: [Function],
      normalizeEmail: [Function],
      toString: [Function],
      default: [Circular *4],
      isImmutable: [Function (anonymous)],
      notNull: [Function (anonymous)],
      extend: [Function: extend],
      notEmpty: [Function: notEmpty],
      len: [Function: len],
      isUrl: [Function: isUrl],
      isIPv6: [Function: isIPv6],
      isIPv4: [Function: isIPv4],
      notIn: [Function: notIn],
      regex: [Function: regex],
      notRegex: [Function: notRegex],
      min: [Function: min],
      max: [Function: max],
      not: [Function: not],
      notContains: [Function: notContains],
      is: [Function: is],
      isNull: [Function],
      isDate: [Function (anonymous)]
    },
    Model: Model,
    DataTypes: {
      ABSTRACT: [Function],
      STRING: [Function],
      CHAR: [Function],
      TEXT: [Function],
      NUMBER: [Function],
      TINYINT: [Function],
      SMALLINT: [Function],
      MEDIUMINT: [Function],
      INTEGER: [Function],
      BIGINT: [Function],
      FLOAT: [Function],
      TIME: [Function],
      DATE: [Function],
      DATEONLY: [Function],
      BOOLEAN: [Function],
      NOW: [Function],
      BLOB: [Function],
      DECIMAL: [Function],
      NUMERIC: [Function],
      UUID: [Function],
      UUIDV1: [Function],
      UUIDV4: [Function],
      HSTORE: [Function],
      JSON: [Function],
      JSONB: [Function],
      VIRTUAL: [Function],
      ARRAY: [Function],
      ENUM: [Function],
      RANGE: [Function],
      REAL: [Function],
      'DOUBLE PRECISION': [Function],
      DOUBLE: [Function],
      GEOMETRY: [Function],
      GEOGRAPHY: [Function],
      CIDR: [Function],
      INET: [Function],
      MACADDR: [Function],
      CITEXT: [Function],
      postgres: [Object],
      mysql: [Object],
      mariadb: [Object],
      sqlite: [Object],
      mssql: [Object]
    },
ABSTRACT: [class ABSTRACT] { types: {}, key: 'ABSTRACT' },
    STRING: [class STRING extends ABSTRACT] { types: [Object], key: 'STRING' },
    CHAR: [class CHAR extends STRING] { types: [Object], key: 'CHAR' },
    TEXT: [class TEXT extends ABSTRACT] { types: [Object], key: 'TEXT' },
    NUMBER: [class NUMBER extends ABSTRACT] { types: {}, key: 'NUMBER' },
    TINYINT: [class TINYINT extends INTEGER] { types: [Object], key: 'TINYINT' },
    SMALLINT: [class SMALLINT extends INTEGER] {
      types: [Object],
      key: 'SMALLINT'
    },
    MEDIUMINT: [class MEDIUMINT extends INTEGER] {
      types: [Object],
      key: 'MEDIUMINT'
    },
    INTEGER: [class INTEGER extends NUMBER] { types: [Object], key: 'INTEGER' },
    BIGINT: [class BIGINT extends INTEGER] { types: [Object], key: 'BIGINT' },
    FLOAT: [class FLOAT extends NUMBER] { types: [Object], key: 'FLOAT' },
    TIME: [class TIME extends ABSTRACT] { types: [Object], key: 'TIME' },
    DATE: [class DATE extends ABSTRACT] { types: [Object], key: 'DATE' },
    DATEONLY: [class DATEONLY extends ABSTRACT] {
      types: [Object],
      key: 'DATEONLY'
    },
    BOOLEAN: [class BOOLEAN extends ABSTRACT] {
      parse: [Function: _sanitize],
      types: [Object],
      key: 'BOOLEAN'
    },
    NOW: [class NOW extends ABSTRACT] { types: {}, key: 'NOW' },
    BLOB: [class BLOB extends ABSTRACT] { types: [Object], key: 'BLOB' },
    DECIMAL: [class DECIMAL extends NUMBER] { types: [Object], key: 'DECIMAL' },
    NUMERIC: [class DECIMAL extends NUMBER] { types: [Object], key: 'DECIMAL' },
    UUID: [class UUID extends ABSTRACT] { types: [Object], key: 'UUID' },
    UUIDV1: [class UUIDV1 extends ABSTRACT] { types: {}, key: 'UUIDV1' },
    UUIDV4: [class UUIDV4 extends ABSTRACT] { types: {}, key: 'UUIDV4' },
    HSTORE: [class HSTORE extends ABSTRACT] { types: [Object], key: 'HSTORE' },
    JSON: [class JSONTYPE extends ABSTRACT] { types: [Object], key: 'JSON' },
    JSONB: [class JSONB extends JSONTYPE] { types: [Object], key: 'JSONB' },
    VIRTUAL: [class VIRTUAL extends ABSTRACT] { types: {}, key: 'VIRTUAL' },
    ARRAY: [class ARRAY extends ABSTRACT] { types: {}, key: 'ARRAY' },
    ENUM: [class ENUM extends ABSTRACT] { types: [Object], key: 'ENUM' },
    RANGE: [class RANGE extends ABSTRACT] { types: [Object], key: 'RANGE' },
    REAL: [class REAL extends NUMBER] { types: [Object], key: 'REAL' },
    'DOUBLE PRECISION': [class DOUBLE extends NUMBER] {
      types: [Object],
      key: 'DOUBLE PRECISION'
    },
    DOUBLE: [class DOUBLE extends NUMBER] {
      types: [Object],
      key: 'DOUBLE PRECISION'
    },
    GEOMETRY: [class GEOMETRY extends ABSTRACT] {
      types: [Object],
      key: 'GEOMETRY'
    },
    GEOGRAPHY: [class GEOGRAPHY extends ABSTRACT] {
      types: [Object],
      key: 'GEOGRAPHY'
    },
    CIDR: [class CIDR extends ABSTRACT] { types: [Object], key: 'CIDR' },
    INET: [class INET extends ABSTRACT] { types: [Object], key: 'INET' },
    MACADDR: [class MACADDR extends ABSTRACT] { types: [Object], key: 'MACADDR' },
    CITEXT: [class CITEXT extends ABSTRACT] { types: [Object], key: 'CITEXT' },
    postgres: {
      DECIMAL: [class DECIMAL extends DECIMAL],
      BLOB: [class BLOB extends BLOB],
      STRING: [class STRING extends STRING],
      CHAR: [class CHAR extends CHAR],
      TEXT: [class TEXT extends TEXT],
      CITEXT: [class CITEXT extends CITEXT],
      TINYINT: [class TINYINT extends TINYINT],
      SMALLINT: [class SMALLINT extends SMALLINT],
      INTEGER: [Function],
      BIGINT: [class BIGINT extends BIGINT],
      BOOLEAN: [Function],
      DATE: [class DATE extends DATE],
      DATEONLY: [class DATEONLY extends DATEONLY],
      REAL: [class REAL extends REAL],
      'DOUBLE PRECISION': [class DOUBLE extends DOUBLE],
      FLOAT: [class FLOAT extends FLOAT],
      GEOMETRY: [class GEOMETRY extends GEOMETRY],
      GEOGRAPHY: [class GEOGRAPHY extends GEOGRAPHY],
      HSTORE: [class HSTORE extends HSTORE],
      RANGE: [class RANGE extends RANGE],
      ENUM: [class ENUM extends ENUM]
    },
    mysql: {
      ENUM: [class ENUM extends ENUM],
      DATE: [class DATE extends DATE],
      DATEONLY: [class DATEONLY extends DATEONLY],
      UUID: [class UUID extends UUID],
      GEOMETRY: [class GEOMETRY extends GEOMETRY],
      DECIMAL: [class DECIMAL extends DECIMAL],
      JSON: [class JSONTYPE extends JSONTYPE]
    },
    mariadb: {
      ENUM: [class ENUM extends ENUM],
      DATE: [class DATE extends DATE],
      DATEONLY: [class DATEONLY extends DATEONLY],
      UUID: [class UUID extends UUID],
      GEOMETRY: [class GEOMETRY extends GEOMETRY],
      DECIMAL: [class DECIMAL extends DECIMAL],
      JSON: [class JSONTYPE extends JSONTYPE]
    },
sqlite: {
      DATE: [class DATE extends DATE],
      DATEONLY: [class DATEONLY extends DATEONLY],
      STRING: [class STRING extends STRING],
      CHAR: [class CHAR extends CHAR],
      NUMBER: [class NUMBER extends NUMBER],
      FLOAT: [Function],
      REAL: [Function],
      'DOUBLE PRECISION': [Function],
      TINYINT: [class TINYINT extends TINYINT],
      SMALLINT: [class SMALLINT extends SMALLINT],
      MEDIUMINT: [class MEDIUMINT extends MEDIUMINT],
      INTEGER: [class INTEGER extends INTEGER],
      BIGINT: [class BIGINT extends BIGINT],
      TEXT: [class TEXT extends TEXT],
      ENUM: [class ENUM extends ENUM],
      JSON: [class JSONTYPE extends JSONTYPE],
      CITEXT: [class CITEXT extends CITEXT]
    },
    mssql: {
      BLOB: [class BLOB extends BLOB],
      BOOLEAN: [class BOOLEAN extends BOOLEAN],
      ENUM: [class ENUM extends ENUM],
      STRING: [class STRING extends STRING],
      UUID: [class UUID extends UUID],
      DATE: [class DATE extends DATE],
      DATEONLY: [class DATEONLY extends DATEONLY],
      NOW: [class NOW extends NOW],
      TINYINT: [class TINYINT extends TINYINT],
      SMALLINT: [class SMALLINT extends SMALLINT],
      INTEGER: [class INTEGER extends INTEGER],
      BIGINT: [class BIGINT extends BIGINT],
      REAL: [class REAL extends REAL],
      FLOAT: [class FLOAT extends FLOAT],
      TEXT: [class TEXT extends TEXT]
    },
    Deferrable: {
      INITIALLY_DEFERRED: [class INITIALLY_DEFERRED extends ABSTRACT],
      INITIALLY_IMMEDIATE: [class INITIALLY_IMMEDIATE extends ABSTRACT],
      NOT: [class NOT extends ABSTRACT],
      SET_DEFERRED: [class SET_DEFERRED extends ABSTRACT],
      SET_IMMEDIATE: [class SET_IMMEDIATE extends ABSTRACT]
    },
    Association: <ref *5> [class Association] {
      BelongsTo: [Function],
      HasOne: [class HasOne extends Association],
      HasMany: [Function],
      BelongsToMany: [Function],
      default: [Circular *5],
      Association: [Circular *5]
    },
 
 useInflection: [Function: useInflection],
    _setupHooks: [Function: _setupHooks],
    runHooks: [Function: runHooks],
    addHook: [Function: addHook],
    removeHook: [Function: removeHook],
    hasHook: [Function: hasHook],
    hasHooks: [Function: hasHook],
    beforeValidate: [Function (anonymous)],
    afterValidate: [Function (anonymous)],
    validationFailed: [Function (anonymous)],
    beforeCreate: [Function (anonymous)],
    afterCreate: [Function (anonymous)],
    beforeDestroy: [Function (anonymous)],
    afterDestroy: [Function (anonymous)],
    beforeRestore: [Function (anonymous)],
    afterRestore: [Function (anonymous)],
    beforeUpdate: [Function (anonymous)],
    afterUpdate: [Function (anonymous)],
    beforeSave: [Function (anonymous)],
    afterSave: [Function (anonymous)],
    beforeUpsert: [Function (anonymous)],
    afterUpsert: [Function (anonymous)],
    beforeBulkCreate: [Function (anonymous)],
    afterBulkCreate: [Function (anonymous)],
    beforeBulkDestroy: [Function (anonymous)],
    afterBulkDestroy: [Function (anonymous)],
    beforeBulkRestore: [Function (anonymous)],
    afterBulkRestore: [Function (anonymous)],
    beforeBulkUpdate: [Function (anonymous)],
    afterBulkUpdate: [Function (anonymous)],
    beforeFind: [Function (anonymous)],
    beforeFindAfterExpandIncludeAll: [Function (anonymous)],
    beforeFindAfterOptions: [Function (anonymous)],
    afterFind: [Function (anonymous)],
    beforeCount: [Function (anonymous)],
    beforeDefine: [Function (anonymous)],
    afterDefine: [Function (anonymous)],
    beforeInit: [Function (anonymous)],
    afterInit: [Function (anonymous)],
    beforeAssociate: [Function (anonymous)],
    afterAssociate: [Function (anonymous)],
    beforeConnect: [Function (anonymous)],
    afterConnect: [Function (anonymous)],
    beforeDisconnect: [Function (anonymous)],
    afterDisconnect: [Function (anonymous)],
    beforeSync: [Function (anonymous)],
    afterSync: [Function (anonymous)],
    beforeBulkSync: [Function (anonymous)],
    afterBulkSync: [Function (anonymous)],
    beforeQuery: [Function (anonymous)],
    afterQuery: [Function (anonymous)],
    Error: [class BaseError extends Error],
    BaseError: [class BaseError extends Error],
    AssociationError: [class AssociationError extends BaseError],
    BulkRecordError: [class BulkRecordError extends BaseError],
    ConnectionError: [class ConnectionError extends BaseError],
    DatabaseError: [class DatabaseError extends BaseError],
    EagerLoadingError: [class EagerLoadingError extends BaseError],
    EmptyResultError: [class EmptyResultError extends BaseError],
    InstanceError: [class InstanceError extends BaseError],
    OptimisticLockError: [class OptimisticLockError extends BaseError],
    QueryError: [class QueryError extends BaseError],
    SequelizeScopeError: [class SequelizeScopeError extends BaseError],
    ValidationError: [class ValidationError extends BaseError] {
      ValidationErrorItem: [Function]
    },
    ValidationErrorItem: [class ValidationErrorItem] {
      Origins: [Object],
      TypeStringMap: [Object]
    },
    AccessDeniedError: [class AccessDeniedError extends ConnectionError],
    ConnectionAcquireTimeoutError: [class ConnectionAcquireTimeoutError extends ConnectionError],
    ConnectionRefusedError: [class ConnectionRefusedError extends ConnectionError],
    ConnectionTimedOutError: [class ConnectionTimedOutError extends ConnectionError],
    HostNotFoundError: [class HostNotFoundError extends ConnectionError],
    HostNotReachableError: [class HostNotReachableError extends ConnectionError],
    InvalidConnectionError: [class InvalidConnectionError extends ConnectionError],
    ExclusionConstraintError: [class ExclusionConstraintError extends DatabaseError],
    ForeignKeyConstraintError: [class ForeignKeyConstraintError extends DatabaseError],
    TimeoutError: [class TimeoutError extends DatabaseError],
    UnknownConstraintError: [class UnknownConstraintError extends DatabaseError],
    UniqueConstraintError: [class UniqueConstraintError extends ValidationError],
    Sequelize: [Circular *6],
    default: [Circular *6]
  }
}

Opa Matheus, peço perdão pela demora em retornar.

Nossa, muitas informações nos seus logs em! Brincadeiras a parte, falando mais diretamente sobre os métodos que você criou para a requisição, o problema pode está relacionado a sua instância "TOP_10".

Então, verifique o arquivo que contém o model dessa instância se está configurado corretamente. O maior problema do JavaScript é que seus erros são silenciosos, pode ser um erro bobo, mas ele não alerta corretamente.

Porém, neste caso, seria mais uma questão realizar testes e Debug no código para identificar corretamente onde está o erro. E como o seu projeto é algo mais particular, imagino que você não possa compartilhá-lo completamente.

No mais, estarei à disposição no que eu puder ajudar.